From dac4901c8a5df55359b1171357a3729206b47e51 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Fri, 1 Sep 2023 14:07:41 -0700 Subject: [PATCH] compiler/types: Remove private related declarations Now there's no private data in glsl_type anymore, so we can remove the friend declaration and move the private functions into file local statics. Reviewed-by: Adam Jackson Reviewed-by: Emma Anholt Part-of: --- src/compiler/glsl_types.cpp | 20 ++++++++++++-------- src/compiler/glsl_types.h | 19 ------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index d563b20..a4ae831 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -584,6 +584,10 @@ VECN(components, uint16_t, u16vec) VECN(components, int8_t, i8vec) VECN(components, uint8_t, u8vec) +static const glsl_type * +get_explicit_matrix_instance(unsigned int base_type, unsigned int rows, unsigned int columns, + unsigned int explicit_stride, bool row_major, unsigned int explicit_alignment); + const glsl_type * glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns, unsigned explicit_stride, bool row_major, @@ -724,9 +728,9 @@ compare_explicit_matrix_key(const void *a, const void *b) return memcmp(a, b, sizeof(struct explicit_matrix_key)) == 0; } -const glsl_type * -glsl_type::get_explicit_matrix_instance(unsigned int base_type, unsigned int rows, unsigned int columns, - unsigned int explicit_stride, bool row_major, unsigned int explicit_alignment) +static const glsl_type * +get_explicit_matrix_instance(unsigned int base_type, unsigned int rows, unsigned int columns, + unsigned int explicit_stride, bool row_major, unsigned int explicit_alignment) { assert(explicit_stride > 0 || explicit_alignment > 0); assert(base_type != GLSL_TYPE_VOID); @@ -736,7 +740,7 @@ glsl_type::get_explicit_matrix_instance(unsigned int base_type, unsigned int row assert(explicit_stride % explicit_alignment == 0); } - const glsl_type *bare_type = get_instance(base_type, rows, columns); + const glsl_type *bare_type = glsl_type::get_instance(base_type, rows, columns); assert(columns > 1 || (rows > 1 && !row_major)); @@ -1468,8 +1472,8 @@ glsl_type::record_compare(const glsl_type *b, bool match_name, } -bool -glsl_type::record_key_compare(const void *a, const void *b) +static bool +record_key_compare(const void *a, const void *b) { const glsl_type *const key1 = (glsl_type *) a; const glsl_type *const key2 = (glsl_type *) b; @@ -1482,8 +1486,8 @@ glsl_type::record_key_compare(const void *a, const void *b) /** * Generate an integer hash value for a glsl_type structure type. */ -unsigned -glsl_type::record_key_hash(const void *a) +static unsigned +record_key_hash(const void *a) { const glsl_type *const key = (glsl_type *) a; uintptr_t hash = key->length; diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index 9d2e704..4ccbf97 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -1244,25 +1244,6 @@ struct glsl_type { return (bool) interface_row_major; } -private: - static bool record_key_compare(const void *a, const void *b); - static unsigned record_key_hash(const void *key); - - /** - * \name Friend functions. - * - * These functions are friends because they must have C linkage and the - * need to call various private methods or access various private static - * data. - */ - /*@{*/ - friend void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *); - /*@}*/ - - static const glsl_type *get_explicit_matrix_instance(unsigned int base_type, unsigned int rows, unsigned int columns, - unsigned int explicit_stride, bool row_major, - unsigned int explicit_alignment); - #endif /* __cplusplus */ }; -- 2.7.4