From 6fccacda1eb621e6be728dd33a7df366b58ec475 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Thu, 14 Dec 2023 23:15:18 -0800 Subject: [PATCH] compiler/types: Use a typedef for glsl_type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most of the code now will see `const glsl_type *` instead of `const struct glsl_type *`. Acked-by: Marek Olšák Part-of: --- src/compiler/glsl_types.c | 442 +++++++++++++++++++------------------- src/compiler/glsl_types.h | 416 +++++++++++++++++------------------ 2 files changed, 429 insertions(+), 429 deletions(-) diff --git a/src/compiler/glsl_types.c b/src/compiler/glsl_types.c index 633f6e7613b..71edd9e98b5 100644 --- a/src/compiler/glsl_types.c +++ b/src/compiler/glsl_types.c @@ -57,7 +57,7 @@ static struct { struct hash_table *subroutine_types; } glsl_type_cache; -static const struct glsl_type * +static const glsl_type * make_vector_matrix_type(linear_ctx *lin_ctx, uint32_t gl_type, enum glsl_base_type base_type, unsigned vector_elements, unsigned matrix_columns, const char *name, @@ -71,7 +71,7 @@ make_vector_matrix_type(linear_ctx *lin_ctx, uint32_t gl_type, /* Neither dimension is zero or both dimensions are zero. */ assert((vector_elements == 0) == (matrix_columns == 0)); - struct glsl_type *t = linear_zalloc(lin_ctx, struct glsl_type); + glsl_type *t = linear_zalloc(lin_ctx, glsl_type); t->gl_type = gl_type; t->base_type = base_type; t->sampled_type = GLSL_TYPE_VOID; @@ -86,7 +86,7 @@ make_vector_matrix_type(linear_ctx *lin_ctx, uint32_t gl_type, } static void -fill_struct_type(struct glsl_type *t, const struct glsl_struct_field *fields, unsigned num_fields, +fill_struct_type(glsl_type *t, const glsl_struct_field *fields, unsigned num_fields, const char *name, bool packed, unsigned explicit_alignment) { assert(util_is_power_of_two_or_zero(explicit_alignment)); @@ -99,19 +99,19 @@ fill_struct_type(struct glsl_type *t, const struct glsl_struct_field *fields, un t->fields.structure = fields; } -static const struct glsl_type * -make_struct_type(linear_ctx *lin_ctx, const struct glsl_struct_field *fields, unsigned num_fields, +static const glsl_type * +make_struct_type(linear_ctx *lin_ctx, const glsl_struct_field *fields, unsigned num_fields, const char *name, bool packed, unsigned explicit_alignment) { assert(lin_ctx != NULL); assert(name != NULL); - struct glsl_type *t = linear_zalloc(lin_ctx, struct glsl_type); + glsl_type *t = linear_zalloc(lin_ctx, glsl_type); const char *copied_name = linear_strdup(lin_ctx, name); - struct glsl_struct_field *copied_fields = - linear_zalloc_array(lin_ctx, struct glsl_struct_field, num_fields); + glsl_struct_field *copied_fields = + linear_zalloc_array(lin_ctx, glsl_struct_field, num_fields); for (unsigned i = 0; i < num_fields; i++) { copied_fields[i] = fields[i]; @@ -124,7 +124,7 @@ make_struct_type(linear_ctx *lin_ctx, const struct glsl_struct_field *fields, un } static void -fill_interface_type(struct glsl_type *t, const struct glsl_struct_field *fields, unsigned num_fields, +fill_interface_type(glsl_type *t, const glsl_struct_field *fields, unsigned num_fields, enum glsl_interface_packing packing, bool row_major, const char *name) { @@ -137,19 +137,19 @@ fill_interface_type(struct glsl_type *t, const struct glsl_struct_field *fields, t->fields.structure = fields; } -static const struct glsl_type * -make_interface_type(linear_ctx *lin_ctx, const struct glsl_struct_field *fields, unsigned num_fields, +static const glsl_type * +make_interface_type(linear_ctx *lin_ctx, const glsl_struct_field *fields, unsigned num_fields, enum glsl_interface_packing packing, bool row_major, const char *name) { assert(lin_ctx != NULL); assert(name != NULL); - struct glsl_type *t = linear_zalloc(lin_ctx, struct glsl_type); + glsl_type *t = linear_zalloc(lin_ctx, glsl_type); const char *copied_name = linear_strdup(lin_ctx, name); - struct glsl_struct_field *copied_fields = - linear_zalloc_array(lin_ctx, struct glsl_struct_field, num_fields); + glsl_struct_field *copied_fields = + linear_zalloc_array(lin_ctx, glsl_struct_field, num_fields); for (unsigned i = 0; i < num_fields; i++) { copied_fields[i] = fields[i]; @@ -161,13 +161,13 @@ make_interface_type(linear_ctx *lin_ctx, const struct glsl_struct_field *fields, return t; } -static const struct glsl_type * +static const glsl_type * make_subroutine_type(linear_ctx *lin_ctx, const char *subroutine_name) { assert(lin_ctx != NULL); assert(subroutine_name != NULL); - struct glsl_type *t = linear_zalloc(lin_ctx, struct glsl_type); + glsl_type *t = linear_zalloc(lin_ctx, glsl_type); t->base_type = GLSL_TYPE_SUBROUTINE; t->sampled_type = GLSL_TYPE_VOID; t->vector_elements = 1; @@ -178,7 +178,7 @@ make_subroutine_type(linear_ctx *lin_ctx, const char *subroutine_name) } bool -glsl_contains_sampler(const struct glsl_type *t) +glsl_contains_sampler(const glsl_type *t) { if (glsl_type_is_array(t)) { return glsl_contains_sampler(t->fields.array); @@ -194,7 +194,7 @@ glsl_contains_sampler(const struct glsl_type *t) } bool -glsl_contains_array(const struct glsl_type *t) +glsl_contains_array(const glsl_type *t) { if (glsl_type_is_struct(t) || glsl_type_is_interface(t)) { for (unsigned int i = 0; i < t->length; i++) { @@ -208,7 +208,7 @@ glsl_contains_array(const struct glsl_type *t) } bool -glsl_contains_integer(const struct glsl_type *t) +glsl_contains_integer(const glsl_type *t) { if (glsl_type_is_array(t)) { return glsl_contains_integer(t->fields.array); @@ -224,7 +224,7 @@ glsl_contains_integer(const struct glsl_type *t) } bool -glsl_contains_double(const struct glsl_type *t) +glsl_contains_double(const glsl_type *t) { if (glsl_type_is_array(t)) { return glsl_contains_double(t->fields.array); @@ -240,7 +240,7 @@ glsl_contains_double(const struct glsl_type *t) } bool -glsl_type_contains_64bit(const struct glsl_type *t) +glsl_type_contains_64bit(const glsl_type *t) { if (glsl_type_is_array(t)) { return glsl_type_contains_64bit(t->fields.array); @@ -256,7 +256,7 @@ glsl_type_contains_64bit(const struct glsl_type *t) } bool -glsl_contains_opaque(const struct glsl_type *t) +glsl_contains_opaque(const glsl_type *t) { switch (t->base_type) { case GLSL_TYPE_SAMPLER: @@ -278,7 +278,7 @@ glsl_contains_opaque(const struct glsl_type *t) } bool -glsl_contains_subroutine(const struct glsl_type *t) +glsl_contains_subroutine(const glsl_type *t) { if (glsl_type_is_array(t)) { return glsl_contains_subroutine(t->fields.array); @@ -294,7 +294,7 @@ glsl_contains_subroutine(const struct glsl_type *t) } bool -glsl_type_contains_image(const struct glsl_type *t) +glsl_type_contains_image(const glsl_type *t) { if (glsl_type_is_array(t)) { return glsl_type_contains_image(t->fields.array); @@ -309,8 +309,8 @@ glsl_type_contains_image(const struct glsl_type *t) } } -const struct glsl_type * -glsl_get_base_glsl_type(const struct glsl_type *t) +const glsl_type * +glsl_get_base_glsl_type(const glsl_type *t) { switch (t->base_type) { case GLSL_TYPE_UINT: @@ -342,16 +342,16 @@ glsl_get_base_glsl_type(const struct glsl_type *t) } } -const struct glsl_type * -glsl_get_scalar_type(const struct glsl_type *t) +const glsl_type * +glsl_get_scalar_type(const glsl_type *t) { - const struct glsl_type *type = t; + const glsl_type *type = t; /* Handle arrays */ while (type->base_type == GLSL_TYPE_ARRAY) type = type->fields.array; - const struct glsl_type *scalar_type = glsl_get_base_glsl_type(type); + const glsl_type *scalar_type = glsl_get_base_glsl_type(type); if (scalar_type == &glsl_type_builtin_error) return type; @@ -359,8 +359,8 @@ glsl_get_scalar_type(const struct glsl_type *t) } -const struct glsl_type * -glsl_get_bare_type(const struct glsl_type *t) +const glsl_type * +glsl_get_bare_type(const glsl_type *t) { switch (t->base_type) { case GLSL_TYPE_UINT8: @@ -380,13 +380,13 @@ glsl_get_bare_type(const struct glsl_type *t) case GLSL_TYPE_STRUCT: case GLSL_TYPE_INTERFACE: { - struct glsl_struct_field *bare_fields = (struct glsl_struct_field *) - calloc(t->length, sizeof(struct glsl_struct_field)); + glsl_struct_field *bare_fields = (glsl_struct_field *) + calloc(t->length, sizeof(glsl_struct_field)); for (unsigned i = 0; i < t->length; i++) { bare_fields[i].type = glsl_get_bare_type(t->fields.structure[i].type); bare_fields[i].name = t->fields.structure[i].name; } - const struct glsl_type *bare_type = + const glsl_type *bare_type = glsl_struct_type(bare_fields, t->length, glsl_get_type_name(t), false); free(bare_fields); return bare_type; @@ -410,8 +410,8 @@ glsl_get_bare_type(const struct glsl_type *t) unreachable("Invalid base type"); } -const struct glsl_type * -glsl_float16_type(const struct glsl_type *t) +const glsl_type * +glsl_float16_type(const glsl_type *t) { assert(t->base_type == GLSL_TYPE_FLOAT); @@ -420,8 +420,8 @@ glsl_float16_type(const struct glsl_type *t) t->interface_row_major, 0); } -const struct glsl_type * -glsl_int16_type(const struct glsl_type *t) +const glsl_type * +glsl_int16_type(const glsl_type *t) { assert(t->base_type == GLSL_TYPE_INT); @@ -430,8 +430,8 @@ glsl_int16_type(const struct glsl_type *t) t->interface_row_major, 0); } -const struct glsl_type * -glsl_uint16_type(const struct glsl_type *t) +const glsl_type * +glsl_uint16_type(const glsl_type *t) { assert(t->base_type == GLSL_TYPE_UINT); @@ -450,9 +450,9 @@ glsl_type_singleton_init_or_ref() STATIC_ASSERT((((unsigned)GLSL_TYPE_INT) & 3) == (unsigned)GLSL_TYPE_INT); STATIC_ASSERT((((unsigned)GLSL_TYPE_FLOAT) & 3) == (unsigned)GLSL_TYPE_FLOAT); - ASSERT_BITFIELD_SIZE(struct glsl_type, base_type, GLSL_TYPE_ERROR); - ASSERT_BITFIELD_SIZE(struct glsl_type, sampled_type, GLSL_TYPE_ERROR); - ASSERT_BITFIELD_SIZE(struct glsl_type, sampler_dimensionality, + ASSERT_BITFIELD_SIZE(glsl_type, base_type, GLSL_TYPE_ERROR); + ASSERT_BITFIELD_SIZE(glsl_type, sampled_type, GLSL_TYPE_ERROR); + ASSERT_BITFIELD_SIZE(glsl_type, sampler_dimensionality, GLSL_SAMPLER_DIM_SUBPASS_MS); simple_mtx_lock(&glsl_type_cache_mutex); @@ -482,13 +482,13 @@ glsl_type_singleton_decref() simple_mtx_unlock(&glsl_type_cache_mutex); } -static const struct glsl_type * -make_array_type(linear_ctx *lin_ctx, const struct glsl_type *element_type, unsigned length, +static const glsl_type * +make_array_type(linear_ctx *lin_ctx, const glsl_type *element_type, unsigned length, unsigned explicit_stride) { assert(lin_ctx != NULL); - struct glsl_type *t = linear_zalloc(lin_ctx, struct glsl_type); + glsl_type *t = linear_zalloc(lin_ctx, glsl_type); t->base_type = GLSL_TYPE_ARRAY; t->sampled_type = GLSL_TYPE_VOID; t->length = length; @@ -543,8 +543,8 @@ glsl_cmat_use_to_string(enum glsl_cmat_use use) } }; -static const struct glsl_type * -vec(unsigned components, const struct glsl_type *const ts[]) +static const glsl_type * +vec(unsigned components, const glsl_type *const ts[]) { unsigned n = components; @@ -560,10 +560,10 @@ vec(unsigned components, const struct glsl_type *const ts[]) } #define VECN(components, sname, vname) \ -const struct glsl_type * \ +const glsl_type * \ glsl_ ## vname ## _type (unsigned components) \ { \ - static const struct glsl_type *const ts[] = { \ + static const glsl_type *const ts[] = { \ &glsl_type_builtin_ ## sname, \ &glsl_type_builtin_ ## vname ## 2, \ &glsl_type_builtin_ ## vname ## 3, \ @@ -588,11 +588,11 @@ VECN(components, uint16_t, u16vec) VECN(components, int8_t, i8vec) VECN(components, uint8_t, u8vec) -static const struct glsl_type * +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 struct glsl_type * +const glsl_type * glsl_simple_explicit_type(unsigned base_type, unsigned rows, unsigned columns, unsigned explicit_stride, bool row_major, unsigned explicit_alignment) @@ -732,7 +732,7 @@ compare_explicit_matrix_key(const void *a, const void *b) return memcmp(a, b, sizeof(struct explicit_matrix_key)) == 0; } -static const struct glsl_type * +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) { @@ -744,7 +744,7 @@ get_explicit_matrix_instance(unsigned int base_type, unsigned int rows, unsigned assert(explicit_stride % explicit_alignment == 0); } - const struct glsl_type *bare_type = glsl_simple_type(base_type, rows, columns); + const glsl_type *bare_type = glsl_simple_type(base_type, rows, columns); assert(columns > 1 || (rows > 1 && !row_major)); @@ -778,7 +778,7 @@ get_explicit_matrix_instance(unsigned int base_type, unsigned int rows, unsigned explicit_stride, explicit_alignment, row_major ? "RM" : ""); linear_ctx *lin_ctx = glsl_type_cache.lin_ctx; - const struct glsl_type *t = + const glsl_type *t = make_vector_matrix_type(lin_ctx, bare_type->gl_type, (enum glsl_base_type)base_type, rows, columns, name, @@ -792,7 +792,7 @@ get_explicit_matrix_instance(unsigned int base_type, unsigned int rows, unsigned key_hash, stored_key, (void *)t); } - const struct glsl_type *t = (const struct glsl_type *) entry->data; + const glsl_type *t = (const glsl_type *) entry->data; simple_mtx_unlock(&glsl_type_cache_mutex); assert(t->base_type == base_type); @@ -804,7 +804,7 @@ get_explicit_matrix_instance(unsigned int base_type, unsigned int rows, unsigned return t; } -const struct glsl_type * +const glsl_type * glsl_sampler_type(enum glsl_sampler_dim dim, bool shadow, bool array, enum glsl_base_type type) { @@ -928,19 +928,19 @@ glsl_sampler_type(enum glsl_sampler_dim dim, bool shadow, unreachable("switch statement above should be complete"); } -const struct glsl_type * +const glsl_type * glsl_bare_sampler_type() { return &glsl_type_builtin_sampler; } -const struct glsl_type * +const glsl_type * glsl_bare_shadow_sampler_type() { return &glsl_type_builtin_samplerShadow; } -const struct glsl_type * +const glsl_type * glsl_texture_type(enum glsl_sampler_dim dim, bool array, enum glsl_base_type type) { switch (type) { @@ -1057,7 +1057,7 @@ glsl_texture_type(enum glsl_sampler_dim dim, bool array, enum glsl_base_type typ unreachable("switch statement above should be complete"); } -const struct glsl_type * +const glsl_type * glsl_image_type(enum glsl_sampler_dim dim, bool array, enum glsl_base_type type) { switch (type) { @@ -1245,8 +1245,8 @@ compare_array_key(const void *a, const void *b) return memcmp(a, b, sizeof(struct array_key)) == 0; } -const struct glsl_type * -glsl_array_type(const struct glsl_type *element, +const glsl_type * +glsl_array_type(const glsl_type *element, unsigned array_size, unsigned explicit_stride) { @@ -1273,7 +1273,7 @@ glsl_array_type(const struct glsl_type *element, const struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(array_types, key_hash, &key); if (entry == NULL) { linear_ctx *lin_ctx = glsl_type_cache.lin_ctx; - const struct glsl_type *t = make_array_type(lin_ctx, element, array_size, explicit_stride); + const glsl_type *t = make_array_type(lin_ctx, element, array_size, explicit_stride); struct array_key *stored_key = linear_zalloc(lin_ctx, struct array_key); memcpy(stored_key, &key, sizeof(key)); @@ -1282,7 +1282,7 @@ glsl_array_type(const struct glsl_type *element, (void *) t); } - const struct glsl_type *t = (const struct glsl_type *) entry->data; + const glsl_type *t = (const glsl_type *) entry->data; simple_mtx_unlock(&glsl_type_cache_mutex); assert(t->base_type == GLSL_TYPE_ARRAY); @@ -1292,18 +1292,18 @@ glsl_array_type(const struct glsl_type *element, return t; } -static const struct glsl_type * +static const glsl_type * make_cmat_type(linear_ctx *lin_ctx, const struct glsl_cmat_description desc) { assert(lin_ctx != NULL); - struct glsl_type *t = linear_zalloc(lin_ctx, struct glsl_type); + glsl_type *t = linear_zalloc(lin_ctx, glsl_type); t->base_type = GLSL_TYPE_COOPERATIVE_MATRIX; t->sampled_type = GLSL_TYPE_VOID; t->vector_elements = 1; t->cmat_desc = desc; - const struct glsl_type *element_type = glsl_simple_type(desc.element_type, 1, 1); + const glsl_type *element_type = glsl_simple_type(desc.element_type, 1, 1); t->name_id = (uintptr_t ) linear_asprintf(lin_ctx, "coopmat<%s, %s, %u, %u, %s>", glsl_get_type_name(element_type), mesa_scope_name((mesa_scope)desc.scope), @@ -1313,7 +1313,7 @@ make_cmat_type(linear_ctx *lin_ctx, const struct glsl_cmat_description desc) return t; } -const struct glsl_type * +const glsl_type * glsl_cmat_type(const struct glsl_cmat_description *desc) { STATIC_ASSERT(sizeof(struct glsl_cmat_description) == 4); @@ -1336,12 +1336,12 @@ glsl_cmat_type(const struct glsl_cmat_description *desc) const struct hash_entry *entry = _mesa_hash_table_search_pre_hashed( cmat_types, key_hash, (void *) (uintptr_t) key); if (entry == NULL) { - const struct glsl_type *t = make_cmat_type(glsl_type_cache.lin_ctx, *desc); + const glsl_type *t = make_cmat_type(glsl_type_cache.lin_ctx, *desc); entry = _mesa_hash_table_insert_pre_hashed(cmat_types, key_hash, (void *) (uintptr_t) key, (void *) t); } - const struct glsl_type *t = (const struct glsl_type *)entry->data; + const glsl_type *t = (const glsl_type *)entry->data; simple_mtx_unlock(&glsl_type_cache_mutex); assert(t->base_type == GLSL_TYPE_COOPERATIVE_MATRIX); @@ -1355,7 +1355,7 @@ glsl_cmat_type(const struct glsl_cmat_description *desc) } bool -glsl_type_compare_no_precision(const struct glsl_type *a, const struct glsl_type *b) +glsl_type_compare_no_precision(const glsl_type *a, const glsl_type *b) { if (a == b) return true; @@ -1364,7 +1364,7 @@ glsl_type_compare_no_precision(const struct glsl_type *a, const struct glsl_type if (!glsl_type_is_array(b) || a->length != b->length) return false; - const struct glsl_type *b_no_array = b->fields.array; + const glsl_type *b_no_array = b->fields.array; return glsl_type_compare_no_precision(a->fields.array, b_no_array); } @@ -1386,7 +1386,7 @@ glsl_type_compare_no_precision(const struct glsl_type *a, const struct glsl_type } bool -glsl_record_compare(const struct glsl_type *a, const struct glsl_type *b, bool match_name, +glsl_record_compare(const glsl_type *a, const glsl_type *b, bool match_name, bool match_locations, bool match_precision) { if (a->length != b->length) @@ -1426,8 +1426,8 @@ glsl_record_compare(const struct glsl_type *a, const struct glsl_type *b, bool m if (a->fields.structure[i].type != b->fields.structure[i].type) return false; } else { - const struct glsl_type *ta = a->fields.structure[i].type; - const struct glsl_type *tb = b->fields.structure[i].type; + const glsl_type *ta = a->fields.structure[i].type; + const glsl_type *tb = b->fields.structure[i].type; if (!glsl_type_compare_no_precision(ta, tb)) return false; } @@ -1498,8 +1498,8 @@ glsl_record_compare(const struct glsl_type *a, const struct glsl_type *b, bool m static bool record_key_compare(const void *a, const void *b) { - const struct glsl_type *const key1 = (struct glsl_type *) a; - const struct glsl_type *const key2 = (struct glsl_type *) b; + const glsl_type *const key1 = (glsl_type *) a; + const glsl_type *const key2 = (glsl_type *) b; return strcmp(glsl_get_type_name(key1), glsl_get_type_name(key2)) == 0 && glsl_record_compare(key1, key2, true, true, true); @@ -1512,7 +1512,7 @@ record_key_compare(const void *a, const void *b) static unsigned record_key_hash(const void *a) { - const struct glsl_type *const key = (struct glsl_type *) a; + const glsl_type *const key = (glsl_type *) a; uintptr_t hash = key->length; unsigned retval; @@ -1529,13 +1529,13 @@ record_key_hash(const void *a) return retval; } -const struct glsl_type * -glsl_struct_type_with_explicit_alignment(const struct glsl_struct_field *fields, +const glsl_type * +glsl_struct_type_with_explicit_alignment(const glsl_struct_field *fields, unsigned num_fields, const char *name, bool packed, unsigned explicit_alignment) { - struct glsl_type key = {0}; + glsl_type key = {0}; fill_struct_type(&key, fields, num_fields, name, packed, explicit_alignment); const uint32_t key_hash = record_key_hash(&key); @@ -1552,13 +1552,13 @@ glsl_struct_type_with_explicit_alignment(const struct glsl_struct_field *fields, const struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(struct_types, key_hash, &key); if (entry == NULL) { - const struct glsl_type *t = make_struct_type(glsl_type_cache.lin_ctx, fields, num_fields, + const glsl_type *t = make_struct_type(glsl_type_cache.lin_ctx, fields, num_fields, name, packed, explicit_alignment); entry = _mesa_hash_table_insert_pre_hashed(struct_types, key_hash, t, (void *) t); } - const struct glsl_type *t = (const struct glsl_type *) entry->data; + const glsl_type *t = (const glsl_type *) entry->data; simple_mtx_unlock(&glsl_type_cache_mutex); assert(t->base_type == GLSL_TYPE_STRUCT); @@ -1571,14 +1571,14 @@ glsl_struct_type_with_explicit_alignment(const struct glsl_struct_field *fields, } -const struct glsl_type * -glsl_interface_type(const struct glsl_struct_field *fields, +const glsl_type * +glsl_interface_type(const glsl_struct_field *fields, unsigned num_fields, enum glsl_interface_packing packing, bool row_major, const char *block_name) { - struct glsl_type key = {0}; + glsl_type key = {0}; fill_interface_type(&key, fields, num_fields, packing, row_major, block_name); const uint32_t key_hash = record_key_hash(&key); @@ -1595,13 +1595,13 @@ glsl_interface_type(const struct glsl_struct_field *fields, const struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(interface_types, key_hash, &key); if (entry == NULL) { - const struct glsl_type *t = make_interface_type(glsl_type_cache.lin_ctx, fields, num_fields, + const glsl_type *t = make_interface_type(glsl_type_cache.lin_ctx, fields, num_fields, packing, row_major, block_name); entry = _mesa_hash_table_insert_pre_hashed(interface_types, key_hash, t, (void *) t); } - const struct glsl_type *t = (const struct glsl_type *) entry->data; + const glsl_type *t = (const glsl_type *) entry->data; simple_mtx_unlock(&glsl_type_cache_mutex); assert(t->base_type == GLSL_TYPE_INTERFACE); @@ -1611,7 +1611,7 @@ glsl_interface_type(const struct glsl_struct_field *fields, return t; } -const struct glsl_type * +const glsl_type * glsl_subroutine_type(const char *subroutine_name) { const uint32_t key_hash = _mesa_hash_string(subroutine_name); @@ -1629,12 +1629,12 @@ glsl_subroutine_type(const char *subroutine_name) const struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(subroutine_types, key_hash, subroutine_name); if (entry == NULL) { - const struct glsl_type *t = make_subroutine_type(glsl_type_cache.lin_ctx, subroutine_name); + const glsl_type *t = make_subroutine_type(glsl_type_cache.lin_ctx, subroutine_name); entry = _mesa_hash_table_insert_pre_hashed(subroutine_types, key_hash, glsl_get_type_name(t), (void *) t); } - const struct glsl_type *t = (const struct glsl_type *) entry->data; + const glsl_type *t = (const glsl_type *) entry->data; simple_mtx_unlock(&glsl_type_cache_mutex); assert(t->base_type == GLSL_TYPE_SUBROUTINE); @@ -1643,8 +1643,8 @@ glsl_subroutine_type(const char *subroutine_name) return t; } -const struct glsl_type * -glsl_get_mul_type(const struct glsl_type *type_a, const struct glsl_type *type_b) +const glsl_type * +glsl_get_mul_type(const glsl_type *type_a, const glsl_type *type_b) { if (glsl_type_is_matrix(type_a) && glsl_type_is_matrix(type_b)) { /* Matrix multiply. The columns of A must match the rows of B. Given @@ -1658,7 +1658,7 @@ glsl_get_mul_type(const struct glsl_type *type_a, const struct glsl_type *type_b * looking at the size of a vector that makes up a column. The * transpose (size of a row) is done for B. */ - const struct glsl_type *const type = + const glsl_type *const type = glsl_simple_type(type_a->base_type, glsl_get_column_type(type_a)->vector_elements, glsl_get_row_type(type_b)->vector_elements); @@ -1677,7 +1677,7 @@ glsl_get_mul_type(const struct glsl_type *type_a, const struct glsl_type *type_b if (glsl_get_row_type(type_a) == type_b) { /* The resulting vector has a number of elements equal to * the number of rows of matrix A. */ - const struct glsl_type *const type = + const glsl_type *const type = glsl_simple_type(type_a->base_type, glsl_get_column_type(type_a)->vector_elements, 1); assert(type != &glsl_type_builtin_error); @@ -1695,7 +1695,7 @@ glsl_get_mul_type(const struct glsl_type *type_a, const struct glsl_type *type_b if (type_a == glsl_get_column_type(type_b)) { /* The resulting vector has a number of elements equal to * the number of columns of matrix B. */ - const struct glsl_type *const type = + const glsl_type *const type = glsl_simple_type(type_a->base_type, glsl_get_row_type(type_b)->vector_elements, 1); assert(type != &glsl_type_builtin_error); @@ -1708,7 +1708,7 @@ glsl_get_mul_type(const struct glsl_type *type_a, const struct glsl_type *type_b } int -glsl_get_field_index(const struct glsl_type *t, const char *name) +glsl_get_field_index(const glsl_type *t, const char *name) { if (t->base_type != GLSL_TYPE_STRUCT && t->base_type != GLSL_TYPE_INTERFACE) @@ -1722,8 +1722,8 @@ glsl_get_field_index(const struct glsl_type *t, const char *name) return -1; } -const struct glsl_type * -glsl_get_field_type(const struct glsl_type *t, const char *name) +const glsl_type * +glsl_get_field_type(const glsl_type *t, const char *name) { const int idx = glsl_get_field_index(t, name); if (idx == -1) @@ -1732,7 +1732,7 @@ glsl_get_field_type(const struct glsl_type *t, const char *name) } unsigned -glsl_get_component_slots(const struct glsl_type *t) +glsl_get_component_slots(const glsl_type *t) { switch (t->base_type) { case GLSL_TYPE_UINT: @@ -1783,7 +1783,7 @@ glsl_get_component_slots(const struct glsl_type *t) } unsigned -glsl_get_component_slots_aligned(const struct glsl_type *t, unsigned offset) +glsl_get_component_slots_aligned(const glsl_type *t, unsigned offset) { /* Align 64bit type only if it crosses attribute slot boundary. */ switch (t->base_type) { @@ -1814,7 +1814,7 @@ glsl_get_component_slots_aligned(const struct glsl_type *t, unsigned offset) unsigned size = 0; for (unsigned i = 0; i < t->length; i++) { - const struct glsl_type *member = t->fields.structure[i].type; + const glsl_type *member = t->fields.structure[i].type; size += glsl_get_component_slots_aligned(member, size + offset); } @@ -1851,7 +1851,7 @@ glsl_get_component_slots_aligned(const struct glsl_type *t, unsigned offset) } unsigned -glsl_get_struct_location_offset(const struct glsl_type *t, unsigned length) +glsl_get_struct_location_offset(const glsl_type *t, unsigned length) { unsigned offset = 0; t = glsl_without_array(t); @@ -1859,15 +1859,15 @@ glsl_get_struct_location_offset(const struct glsl_type *t, unsigned length) assert(length <= t->length); for (unsigned i = 0; i < length; i++) { - const struct glsl_type *st = t->fields.structure[i].type; - const struct glsl_type *wa = glsl_without_array(st); + const glsl_type *st = t->fields.structure[i].type; + const glsl_type *wa = glsl_without_array(st); if (glsl_type_is_struct(wa)) { unsigned r_offset = glsl_get_struct_location_offset(wa, wa->length); offset += glsl_type_is_array(st) ? glsl_get_aoa_size(st) * r_offset : r_offset; } else if (glsl_type_is_array(st) && glsl_type_is_array(st->fields.array)) { unsigned outer_array_size = st->length; - const struct glsl_type *base_type = st->fields.array; + const glsl_type *base_type = st->fields.array; /* For arrays of arrays the outer arrays take up a uniform * slot for each element. The innermost array elements share a @@ -1892,7 +1892,7 @@ glsl_get_struct_location_offset(const struct glsl_type *t, unsigned length) } unsigned -glsl_type_uniform_locations(const struct glsl_type *t) +glsl_type_uniform_locations(const glsl_type *t) { unsigned size = 0; @@ -1928,7 +1928,7 @@ glsl_type_uniform_locations(const struct glsl_type *t) } unsigned -glsl_varying_count(const struct glsl_type *t) +glsl_varying_count(const glsl_type *t) { unsigned size = 0; @@ -1967,7 +1967,7 @@ glsl_varying_count(const struct glsl_type *t) } unsigned -glsl_get_std140_base_alignment(const struct glsl_type *t, bool row_major) +glsl_get_std140_base_alignment(const glsl_type *t, bool row_major) { unsigned N = glsl_type_is_64bit(t) ? 8 : 4; @@ -2035,7 +2035,7 @@ glsl_get_std140_base_alignment(const struct glsl_type *t, bool row_major) * row vectors with components each, according to rule (4). */ if (glsl_type_is_matrix(t)) { - const struct glsl_type *vec_type, *array_type; + const glsl_type *vec_type, *array_type; int c = t->matrix_columns; int r = t->vector_elements; @@ -2074,7 +2074,7 @@ glsl_get_std140_base_alignment(const struct glsl_type *t, bool row_major) field_row_major = false; } - const struct glsl_type *field_type = t->fields.structure[i].type; + const glsl_type *field_type = t->fields.structure[i].type; base_alignment = MAX2(base_alignment, glsl_get_std140_base_alignment(field_type, field_row_major)); } @@ -2086,7 +2086,7 @@ glsl_get_std140_base_alignment(const struct glsl_type *t, bool row_major) } unsigned -glsl_get_std140_size(const struct glsl_type *t, bool row_major) +glsl_get_std140_size(const glsl_type *t, bool row_major) { unsigned N = glsl_type_is_64bit(t) ? 8 : 4; @@ -2124,8 +2124,8 @@ glsl_get_std140_size(const struct glsl_type *t, bool row_major) * row vectors with components each, according to rule (4). */ if (glsl_type_is_matrix(glsl_without_array(t))) { - const struct glsl_type *element_type; - const struct glsl_type *vec_type; + const glsl_type *element_type; + const glsl_type *vec_type; unsigned int array_len; if (glsl_type_is_array(t)) { @@ -2146,7 +2146,7 @@ glsl_get_std140_size(const struct glsl_type *t, bool row_major) element_type->vector_elements, 1); array_len *= element_type->matrix_columns; } - const struct glsl_type *array_type = + const glsl_type *array_type = glsl_array_type(vec_type, array_len, 0); return glsl_get_std140_size(array_type, false); @@ -2204,7 +2204,7 @@ glsl_get_std140_size(const struct glsl_type *t, bool row_major) field_row_major = false; } - const struct glsl_type *field_type = t->fields.structure[i].type; + const glsl_type *field_type = t->fields.structure[i].type; unsigned base_alignment = glsl_get_std140_base_alignment(field_type, field_row_major); @@ -2228,13 +2228,13 @@ glsl_get_std140_size(const struct glsl_type *t, bool row_major) return -1; } -const struct glsl_type * -glsl_get_explicit_std140_type(const struct glsl_type *t, bool row_major) +const glsl_type * +glsl_get_explicit_std140_type(const glsl_type *t, bool row_major) { if (glsl_type_is_vector(t) || glsl_type_is_scalar(t)) { return t; } else if (glsl_type_is_matrix(t)) { - const struct glsl_type *vec_type; + const glsl_type *vec_type; if (row_major) vec_type = glsl_simple_type(t->base_type, t->matrix_columns, 1); else @@ -2246,13 +2246,13 @@ glsl_get_explicit_std140_type(const struct glsl_type *t, bool row_major) 0); } else if (glsl_type_is_array(t)) { unsigned elem_size = glsl_get_std140_size(t->fields.array, row_major); - const struct glsl_type *elem_type = + const glsl_type *elem_type = glsl_get_explicit_std140_type(t->fields.array, row_major); unsigned stride = align(elem_size, 16); return glsl_array_type(elem_type, t->length, stride); } else if (glsl_type_is_struct(t) || glsl_type_is_interface(t)) { - struct glsl_struct_field *fields = (struct glsl_struct_field *) - calloc(t->length, sizeof(struct glsl_struct_field)); + glsl_struct_field *fields = (glsl_struct_field *) + calloc(t->length, sizeof(glsl_struct_field)); unsigned offset = 0; for (unsigned i = 0; i < t->length; i++) { fields[i] = t->fields.structure[i]; @@ -2289,7 +2289,7 @@ glsl_get_explicit_std140_type(const struct glsl_type *t, bool row_major) offset += fsize; } - const struct glsl_type *type; + const glsl_type *type; if (glsl_type_is_struct(t)) type = glsl_struct_type(fields, t->length, glsl_get_type_name(t), false); else @@ -2305,7 +2305,7 @@ glsl_get_explicit_std140_type(const struct glsl_type *t, bool row_major) } unsigned -glsl_get_std430_base_alignment(const struct glsl_type *t, bool row_major) +glsl_get_std430_base_alignment(const glsl_type *t, bool row_major) { unsigned N = glsl_type_is_64bit(t) ? 8 : 4; @@ -2364,7 +2364,7 @@ glsl_get_std430_base_alignment(const struct glsl_type *t, bool row_major) * row vectors with components each, according to rule (4). */ if (glsl_type_is_matrix(t)) { - const struct glsl_type *vec_type, *array_type; + const glsl_type *vec_type, *array_type; int c = t->matrix_columns; int r = t->vector_elements; @@ -2403,7 +2403,7 @@ glsl_get_std430_base_alignment(const struct glsl_type *t, bool row_major) field_row_major = false; } - const struct glsl_type *field_type = t->fields.structure[i].type; + const glsl_type *field_type = t->fields.structure[i].type; base_alignment = MAX2(base_alignment, glsl_get_std430_base_alignment(field_type, field_row_major)); } @@ -2415,7 +2415,7 @@ glsl_get_std430_base_alignment(const struct glsl_type *t, bool row_major) } unsigned -glsl_get_std430_array_stride(const struct glsl_type *t, bool row_major) +glsl_get_std430_array_stride(const glsl_type *t, bool row_major) { unsigned N = glsl_type_is_64bit(t) ? 8 : 4; @@ -2440,7 +2440,7 @@ glsl_get_std430_array_stride(const struct glsl_type *t, bool row_major) */ unsigned -glsl_get_explicit_size(const struct glsl_type *t, bool align_to_stride) +glsl_get_explicit_size(const glsl_type *t, bool align_to_stride) { if (glsl_type_is_struct(t) || glsl_type_is_interface(t)) { if (t->length > 0) { @@ -2479,7 +2479,7 @@ glsl_get_explicit_size(const struct glsl_type *t, bool align_to_stride) return t->explicit_stride * (t->length - 1) + elem_size; } else if (glsl_type_is_matrix(t)) { - const struct glsl_type *elem_type; + const glsl_type *elem_type; unsigned length; if (t->interface_row_major) { @@ -2503,7 +2503,7 @@ glsl_get_explicit_size(const struct glsl_type *t, bool align_to_stride) } unsigned -glsl_get_std430_size(const struct glsl_type *t, bool row_major) +glsl_get_std430_size(const glsl_type *t, bool row_major) { unsigned N = glsl_type_is_64bit(t) ? 8 : 4; @@ -2521,8 +2521,8 @@ glsl_get_std430_size(const struct glsl_type *t, bool row_major) } if (glsl_type_is_matrix(glsl_without_array(t))) { - const struct glsl_type *element_type; - const struct glsl_type *vec_type; + const glsl_type *element_type; + const glsl_type *vec_type; unsigned int array_len; if (glsl_type_is_array(t)) { @@ -2543,7 +2543,7 @@ glsl_get_std430_size(const struct glsl_type *t, bool row_major) element_type->vector_elements, 1); array_len *= element_type->matrix_columns; } - const struct glsl_type *array_type = + const glsl_type *array_type = glsl_array_type(vec_type, array_len, 0); return glsl_get_std430_size(array_type, false); @@ -2577,7 +2577,7 @@ glsl_get_std430_size(const struct glsl_type *t, bool row_major) field_row_major = false; } - const struct glsl_type *field_type = t->fields.structure[i].type; + const glsl_type *field_type = t->fields.structure[i].type; unsigned base_alignment = glsl_get_std430_base_alignment(field_type, field_row_major); size = align(size, base_alignment); @@ -2593,13 +2593,13 @@ glsl_get_std430_size(const struct glsl_type *t, bool row_major) return -1; } -const struct glsl_type * -glsl_get_explicit_std430_type(const struct glsl_type *t, bool row_major) +const glsl_type * +glsl_get_explicit_std430_type(const glsl_type *t, bool row_major) { if (glsl_type_is_vector(t) || glsl_type_is_scalar(t)) { return t; } else if (glsl_type_is_matrix(t)) { - const struct glsl_type *vec_type; + const glsl_type *vec_type; if (row_major) vec_type = glsl_simple_type(t->base_type, t->matrix_columns, 1); else @@ -2609,14 +2609,14 @@ glsl_get_explicit_std430_type(const struct glsl_type *t, bool row_major) t->matrix_columns, stride, row_major, 0); } else if (glsl_type_is_array(t)) { - const struct glsl_type *elem_type = + const glsl_type *elem_type = glsl_get_explicit_std430_type(t->fields.array, row_major); unsigned stride = glsl_get_std430_array_stride(t->fields.array, row_major); return glsl_array_type(elem_type, t->length, stride); } else if (glsl_type_is_struct(t) || glsl_type_is_interface(t)) { - struct glsl_struct_field *fields = (struct glsl_struct_field *) - calloc(t->length, sizeof(struct glsl_struct_field)); + glsl_struct_field *fields = (glsl_struct_field *) + calloc(t->length, sizeof(glsl_struct_field)); unsigned offset = 0; for (unsigned i = 0; i < t->length; i++) { fields[i] = t->fields.structure[i]; @@ -2653,7 +2653,7 @@ glsl_get_explicit_std430_type(const struct glsl_type *t, bool row_major) offset += fsize; } - const struct glsl_type *type; + const glsl_type *type; if (glsl_type_is_struct(t)) type = glsl_struct_type(fields, t->length, glsl_get_type_name(t), false); else @@ -2669,7 +2669,7 @@ glsl_get_explicit_std430_type(const struct glsl_type *t, bool row_major) } static unsigned -explicit_type_scalar_byte_size(const struct glsl_type *type) +explicit_type_scalar_byte_size(const glsl_type *type) { if (type->base_type == GLSL_TYPE_BOOL) return 4; @@ -2685,8 +2685,8 @@ explicit_type_scalar_byte_size(const struct glsl_type *type) * - overrides any struct field offsets but get_explicit_std430_type() tries to * respect any existing ones */ -const struct glsl_type * -glsl_get_explicit_type_for_size_align(const struct glsl_type *t, +const glsl_type * +glsl_get_explicit_type_for_size_align(const glsl_type *t, glsl_type_size_align_func type_info, unsigned *size, unsigned *alignment) { @@ -2711,7 +2711,7 @@ glsl_get_explicit_type_for_size_align(const struct glsl_type *t, false, *alignment); } else if (glsl_type_is_array(t)) { unsigned elem_size, elem_align; - const struct glsl_type *explicit_element = + const glsl_type *explicit_element = glsl_get_explicit_type_for_size_align(t->fields.array, type_info, &elem_size, &elem_align); @@ -2721,8 +2721,8 @@ glsl_get_explicit_type_for_size_align(const struct glsl_type *t, *alignment = elem_align; return glsl_array_type(explicit_element, t->length, stride); } else if (glsl_type_is_struct(t) || glsl_type_is_interface(t)) { - struct glsl_struct_field *fields = (struct glsl_struct_field *) - malloc(sizeof(struct glsl_struct_field) * t->length); + glsl_struct_field *fields = (glsl_struct_field *) + malloc(sizeof(glsl_struct_field) * t->length); *size = 0; *alignment = 1; @@ -2751,7 +2751,7 @@ glsl_get_explicit_type_for_size_align(const struct glsl_type *t, */ *size = align(*size, *alignment); - const struct glsl_type *type; + const glsl_type *type; if (glsl_type_is_struct(t)) { type = glsl_struct_type_with_explicit_alignment(fields, t->length, glsl_get_type_name(t), t->packed, @@ -2781,8 +2781,8 @@ glsl_get_explicit_type_for_size_align(const struct glsl_type *t, } } -const struct glsl_type * -glsl_type_replace_vec3_with_vec4(const struct glsl_type *t) +const glsl_type * +glsl_type_replace_vec3_with_vec4(const glsl_type *t) { if (glsl_type_is_scalar(t) || glsl_type_is_vector(t) || glsl_type_is_matrix(t)) { if (t->interface_row_major) { @@ -2806,14 +2806,14 @@ glsl_type_replace_vec3_with_vec4(const struct glsl_type *t) } } } else if (glsl_type_is_array(t)) { - const struct glsl_type *vec4_elem_type = + const glsl_type *vec4_elem_type = glsl_type_replace_vec3_with_vec4(t->fields.array); if (vec4_elem_type == t->fields.array) return t; return glsl_array_type(vec4_elem_type, t->length, t->explicit_stride); } else if (glsl_type_is_struct(t) || glsl_type_is_interface(t)) { - struct glsl_struct_field *fields = (struct glsl_struct_field *) - malloc(sizeof(struct glsl_struct_field) * t->length); + glsl_struct_field *fields = (glsl_struct_field *) + malloc(sizeof(glsl_struct_field) * t->length); bool needs_new_type = false; for (unsigned i = 0; i < t->length; i++) { @@ -2824,7 +2824,7 @@ glsl_type_replace_vec3_with_vec4(const struct glsl_type *t) needs_new_type = true; } - const struct glsl_type *type; + const glsl_type *type; if (!needs_new_type) { type = t; } else if (glsl_type_is_struct(t)) { @@ -2845,7 +2845,7 @@ glsl_type_replace_vec3_with_vec4(const struct glsl_type *t) } unsigned -glsl_count_vec4_slots(const struct glsl_type *t, bool is_gl_vertex_input, bool is_bindless) +glsl_count_vec4_slots(const glsl_type *t, bool is_gl_vertex_input, bool is_bindless) { /* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec: * @@ -2895,7 +2895,7 @@ glsl_count_vec4_slots(const struct glsl_type *t, bool is_gl_vertex_input, bool i unsigned size = 0; for (unsigned i = 0; i < t->length; i++) { - const struct glsl_type *member_type = t->fields.structure[i].type; + const glsl_type *member_type = t->fields.structure[i].type; size += glsl_count_vec4_slots(member_type, is_gl_vertex_input, is_bindless); } @@ -2904,7 +2904,7 @@ glsl_count_vec4_slots(const struct glsl_type *t, bool is_gl_vertex_input, bool i } case GLSL_TYPE_ARRAY: { - const struct glsl_type *element = t->fields.array; + const glsl_type *element = t->fields.array; return t->length * glsl_count_vec4_slots(element, is_gl_vertex_input, is_bindless); } @@ -2933,7 +2933,7 @@ glsl_count_vec4_slots(const struct glsl_type *t, bool is_gl_vertex_input, bool i } unsigned -glsl_count_dword_slots(const struct glsl_type *t, bool is_bindless) +glsl_count_dword_slots(const glsl_type *t, bool is_bindless) { switch (t->base_type) { case GLSL_TYPE_UINT: @@ -2986,7 +2986,7 @@ glsl_count_dword_slots(const struct glsl_type *t, bool is_bindless) } int -glsl_get_sampler_coordinate_components(const struct glsl_type *t) +glsl_get_sampler_coordinate_components(const glsl_type *t) { assert(glsl_type_is_sampler(t) || glsl_type_is_texture(t) || @@ -3040,7 +3040,7 @@ union packed_type { }; static void -encode_glsl_struct_field(struct blob *blob, const struct glsl_struct_field *struct_field) +encode_glsl_struct_field(struct blob *blob, const glsl_struct_field *struct_field) { encode_type_to_blob(blob, struct_field->type); blob_write_string(blob, struct_field->name); @@ -3054,7 +3054,7 @@ encode_glsl_struct_field(struct blob *blob, const struct glsl_struct_field *stru } static void -decode_glsl_struct_field_from_blob(struct blob_reader *blob, struct glsl_struct_field *struct_field) +decode_glsl_struct_field_from_blob(struct blob_reader *blob, glsl_struct_field *struct_field) { struct_field->type = decode_type_from_blob(blob); struct_field->name = blob_read_string(blob); @@ -3068,7 +3068,7 @@ decode_glsl_struct_field_from_blob(struct blob_reader *blob, struct glsl_struct_ } void -encode_type_to_blob(struct blob *blob, const struct glsl_type *type) +encode_type_to_blob(struct blob *blob, const glsl_type *type) { if (!type) { blob_write_uint32(blob, 0); @@ -3183,7 +3183,7 @@ encode_type_to_blob(struct blob *blob, const struct glsl_type *type) blob_write_uint32(blob, encoded.u32); } -const struct glsl_type * +const glsl_type * decode_type_from_blob(struct blob_reader *blob) { union packed_type encoded; @@ -3269,12 +3269,12 @@ decode_type_from_blob(struct blob_reader *blob) else if (explicit_alignment > 0) explicit_alignment = 1 << (explicit_alignment - 1); - struct glsl_struct_field *fields = (struct glsl_struct_field *) - malloc(sizeof(struct glsl_struct_field) * num_fields); + glsl_struct_field *fields = (glsl_struct_field *) + malloc(sizeof(glsl_struct_field) * num_fields); for (unsigned i = 0; i < num_fields; i++) decode_glsl_struct_field_from_blob(blob, &fields[i]); - const struct glsl_type *t; + const glsl_type *t; if (base_type == GLSL_TYPE_INTERFACE) { assert(explicit_alignment == 0); enum glsl_interface_packing packing = @@ -3301,7 +3301,7 @@ decode_type_from_blob(struct blob_reader *blob) } unsigned -glsl_get_cl_alignment(const struct glsl_type *t) +glsl_get_cl_alignment(const glsl_type *t) { /* vectors unlike arrays are aligned to their size */ if (glsl_type_is_scalar(t) || glsl_type_is_vector(t)) @@ -3315,7 +3315,7 @@ glsl_get_cl_alignment(const struct glsl_type *t) unsigned res = 1; for (unsigned i = 0; i < t->length; ++i) { - const struct glsl_struct_field *field = &t->fields.structure[i]; + const glsl_struct_field *field = &t->fields.structure[i]; res = MAX2(res, glsl_get_cl_alignment(field->type)); } return res; @@ -3324,7 +3324,7 @@ glsl_get_cl_alignment(const struct glsl_type *t) } unsigned -glsl_get_cl_size(const struct glsl_type *t) +glsl_get_cl_size(const glsl_type *t) { if (glsl_type_is_scalar(t) || glsl_type_is_vector(t)) { return util_next_power_of_two(t->vector_elements) * @@ -3336,7 +3336,7 @@ glsl_get_cl_size(const struct glsl_type *t) unsigned size = 0; unsigned max_alignment = 1; for (unsigned i = 0; i < t->length; ++i) { - const struct glsl_struct_field *field = &t->fields.structure[i]; + const glsl_struct_field *field = &t->fields.structure[i]; /* if a struct is packed, members don't get aligned */ if (!t->packed) { unsigned alignment = glsl_get_cl_alignment(field->type); @@ -3356,7 +3356,7 @@ glsl_get_cl_size(const struct glsl_type *t) extern const char glsl_type_builtin_names[]; const char * -glsl_get_type_name(const struct glsl_type *type) +glsl_get_type_name(const glsl_type *type) { if (type->has_builtin_name) { return &glsl_type_builtin_names[type->name_id]; @@ -3366,7 +3366,7 @@ glsl_get_type_name(const struct glsl_type *type) } void -glsl_get_cl_type_size_align(const struct glsl_type *t, +glsl_get_cl_type_size_align(const glsl_type *t, unsigned *size, unsigned *align) { *size = glsl_get_cl_size(t); @@ -3396,7 +3396,7 @@ glsl_get_sampler_dim_coordinate_components(enum glsl_sampler_dim dim) } bool -glsl_type_is_vector(const struct glsl_type *t) +glsl_type_is_vector(const glsl_type *t) { return t->vector_elements > 1 && t->matrix_columns == 1 && @@ -3405,7 +3405,7 @@ glsl_type_is_vector(const struct glsl_type *t) } bool -glsl_type_is_scalar(const struct glsl_type *t) +glsl_type_is_scalar(const glsl_type *t) { return t->vector_elements == 1 && t->base_type >= GLSL_TYPE_UINT && @@ -3413,13 +3413,13 @@ glsl_type_is_scalar(const struct glsl_type *t) } bool -glsl_type_is_vector_or_scalar(const struct glsl_type *t) +glsl_type_is_vector_or_scalar(const glsl_type *t) { return glsl_type_is_vector(t) || glsl_type_is_scalar(t); } bool -glsl_type_is_matrix(const struct glsl_type *t) +glsl_type_is_matrix(const glsl_type *t) { /* GLSL only has float matrices. */ return t->matrix_columns > 1 && (t->base_type == GLSL_TYPE_FLOAT || @@ -3428,19 +3428,19 @@ glsl_type_is_matrix(const struct glsl_type *t) } bool -glsl_type_is_array_or_matrix(const struct glsl_type *t) +glsl_type_is_array_or_matrix(const glsl_type *t) { return glsl_type_is_array(t) || glsl_type_is_matrix(t); } bool -glsl_type_is_dual_slot(const struct glsl_type *t) +glsl_type_is_dual_slot(const glsl_type *t) { return glsl_type_is_64bit(t) && t->vector_elements > 2; } -const struct glsl_type * -glsl_get_array_element(const struct glsl_type *t) +const glsl_type * +glsl_get_array_element(const glsl_type *t) { if (glsl_type_is_matrix(t)) return glsl_get_column_type(t); @@ -3450,7 +3450,7 @@ glsl_get_array_element(const struct glsl_type *t) } bool -glsl_type_is_leaf(const struct glsl_type *t) +glsl_type_is_leaf(const glsl_type *t) { if (glsl_type_is_struct_or_ifc(t) || (glsl_type_is_array(t) && @@ -3463,21 +3463,21 @@ glsl_type_is_leaf(const struct glsl_type *t) } bool -glsl_contains_atomic(const struct glsl_type *t) +glsl_contains_atomic(const glsl_type *t) { return glsl_atomic_size(t) > 0; } -const struct glsl_type * -glsl_without_array(const struct glsl_type *t) +const glsl_type * +glsl_without_array(const glsl_type *t) { while (glsl_type_is_array(t)) t = t->fields.array; return t; } -const struct glsl_type * -glsl_without_array_or_matrix(const struct glsl_type *t) +const glsl_type * +glsl_without_array_or_matrix(const glsl_type *t) { t = glsl_without_array(t); if (glsl_type_is_matrix(t)) @@ -3485,35 +3485,35 @@ glsl_without_array_or_matrix(const struct glsl_type *t) return t; } -const struct glsl_type * -glsl_type_wrap_in_arrays(const struct glsl_type *t, - const struct glsl_type *arrays) +const glsl_type * +glsl_type_wrap_in_arrays(const glsl_type *t, + const glsl_type *arrays) { if (!glsl_type_is_array(arrays)) return t; - const struct glsl_type *elem_type = + const glsl_type *elem_type = glsl_type_wrap_in_arrays(t, glsl_get_array_element(arrays)); return glsl_array_type(elem_type, glsl_get_length(arrays), glsl_get_explicit_stride(arrays)); } -const struct glsl_type * -glsl_get_cmat_element(const struct glsl_type *t) +const glsl_type * +glsl_get_cmat_element(const glsl_type *t) { assert(t->base_type == GLSL_TYPE_COOPERATIVE_MATRIX); return glsl_simple_type(t->cmat_desc.element_type, 1, 1); } const struct glsl_cmat_description * -glsl_get_cmat_description(const struct glsl_type *t) +glsl_get_cmat_description(const glsl_type *t) { assert(t->base_type == GLSL_TYPE_COOPERATIVE_MATRIX); return &t->cmat_desc; } unsigned -glsl_get_length(const struct glsl_type *t) +glsl_get_length(const glsl_type *t) { if (glsl_type_is_matrix(t)) return t->matrix_columns; @@ -3523,13 +3523,13 @@ glsl_get_length(const struct glsl_type *t) } unsigned -glsl_get_aoa_size(const struct glsl_type *t) +glsl_get_aoa_size(const glsl_type *t) { if (!glsl_type_is_array(t)) return 0; unsigned size = t->length; - const struct glsl_type *array_base_type = t->fields.array; + const glsl_type *array_base_type = t->fields.array; while (glsl_type_is_array(array_base_type)) { size = size * array_base_type->length; @@ -3538,16 +3538,16 @@ glsl_get_aoa_size(const struct glsl_type *t) return size; } -const struct glsl_type * -glsl_get_struct_field(const struct glsl_type *t, unsigned index) +const glsl_type * +glsl_get_struct_field(const glsl_type *t, unsigned index) { assert(glsl_type_is_struct(t) || glsl_type_is_interface(t)); assert(index < t->length); return t->fields.structure[index].type; } -const struct glsl_struct_field * -glsl_get_struct_field_data(const struct glsl_type *t, unsigned index) +const glsl_struct_field * +glsl_get_struct_field_data(const glsl_type *t, unsigned index) { assert(glsl_type_is_struct(t) || glsl_type_is_interface(t)); assert(index < t->length); @@ -3555,7 +3555,7 @@ glsl_get_struct_field_data(const struct glsl_type *t, unsigned index) } enum glsl_interface_packing -glsl_get_internal_ifc_packing(const struct glsl_type *t, +glsl_get_internal_ifc_packing(const glsl_type *t, bool std430_supported) { enum glsl_interface_packing packing = glsl_get_ifc_packing(t); @@ -3573,8 +3573,8 @@ glsl_get_internal_ifc_packing(const struct glsl_type *t, } } -const struct glsl_type * -glsl_get_row_type(const struct glsl_type *t) +const glsl_type * +glsl_get_row_type(const glsl_type *t) { if (!glsl_type_is_matrix(t)) return &glsl_type_builtin_error; @@ -3586,8 +3586,8 @@ glsl_get_row_type(const struct glsl_type *t) return glsl_simple_type(t->base_type, t->matrix_columns, 1); } -const struct glsl_type * -glsl_get_column_type(const struct glsl_type *t) +const glsl_type * +glsl_get_column_type(const glsl_type *t) { if (!glsl_type_is_matrix(t)) return &glsl_type_builtin_error; @@ -3610,7 +3610,7 @@ glsl_get_column_type(const struct glsl_type *t) } unsigned -glsl_atomic_size(const struct glsl_type *t) +glsl_atomic_size(const glsl_type *t) { if (glsl_type_is_atomic_uint(t)) return 4; /* ATOMIC_COUNTER_SIZE */ @@ -3620,8 +3620,8 @@ glsl_atomic_size(const struct glsl_type *t) return 0; } -const struct glsl_type * -glsl_type_to_16bit(const struct glsl_type *old_type) +const glsl_type * +glsl_type_to_16bit(const glsl_type *old_type) { if (glsl_type_is_array(old_type)) { return glsl_array_type(glsl_type_to_16bit(glsl_get_array_element(old_type)), @@ -3645,8 +3645,8 @@ glsl_type_to_16bit(const struct glsl_type *old_type) return old_type; } -const struct glsl_type * -glsl_replace_vector_type(const struct glsl_type *t, unsigned components) +const glsl_type * +glsl_replace_vector_type(const glsl_type *t, unsigned components) { if (glsl_type_is_array(t)) { return glsl_array_type( @@ -3659,8 +3659,8 @@ glsl_replace_vector_type(const struct glsl_type *t, unsigned components) } } -const struct glsl_type * -glsl_channel_type(const struct glsl_type *t) +const glsl_type * +glsl_channel_type(const glsl_type *t) { switch (t->base_type) { case GLSL_TYPE_ARRAY: @@ -3685,7 +3685,7 @@ glsl_channel_type(const struct glsl_type *t) } static void -glsl_size_align_handle_array_and_structs(const struct glsl_type *type, +glsl_size_align_handle_array_and_structs(const glsl_type *type, glsl_type_size_align_func size_align, unsigned *size, unsigned *align) { @@ -3710,7 +3710,7 @@ glsl_size_align_handle_array_and_structs(const struct glsl_type *type, } void -glsl_get_natural_size_align_bytes(const struct glsl_type *type, +glsl_get_natural_size_align_bytes(const glsl_type *type, unsigned *size, unsigned *align) { switch (type->base_type) { @@ -3769,7 +3769,7 @@ glsl_get_natural_size_align_bytes(const struct glsl_type *type, * field is aligned to 16 bytes. */ void -glsl_get_vec4_size_align_bytes(const struct glsl_type *type, +glsl_get_vec4_size_align_bytes(const glsl_type *type, unsigned *size, unsigned *align) { switch (type->base_type) { @@ -3819,7 +3819,7 @@ glsl_get_vec4_size_align_bytes(const struct glsl_type *type, } static unsigned -glsl_type_count(const struct glsl_type *type, enum glsl_base_type base_type) +glsl_type_count(const glsl_type *type, enum glsl_base_type base_type) { if (glsl_type_is_array(type)) { return glsl_get_length(type) * @@ -3843,19 +3843,19 @@ glsl_type_count(const struct glsl_type *type, enum glsl_base_type base_type) } unsigned -glsl_type_get_sampler_count(const struct glsl_type *type) +glsl_type_get_sampler_count(const glsl_type *type) { return glsl_type_count(type, GLSL_TYPE_SAMPLER); } unsigned -glsl_type_get_texture_count(const struct glsl_type *type) +glsl_type_get_texture_count(const glsl_type *type) { return glsl_type_count(type, GLSL_TYPE_TEXTURE); } unsigned -glsl_type_get_image_count(const struct glsl_type *type) +glsl_type_get_image_count(const glsl_type *type) { return glsl_type_count(type, GLSL_TYPE_IMAGE); } diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index e3c56aad09e..ad1c4dbe0ef 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -35,12 +35,12 @@ #include "util/format/u_format.h" #include "util/macros.h" -struct glsl_type; - #ifdef __cplusplus extern "C" { #endif +typedef struct glsl_type glsl_type; +typedef struct glsl_struct_field glsl_struct_field; struct _mesa_glsl_parse_state; struct glsl_symbol_table; @@ -53,11 +53,11 @@ glsl_type_singleton_decref(void); extern void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state); -void encode_type_to_blob(struct blob *blob, const struct glsl_type *type); +void encode_type_to_blob(struct blob *blob, const glsl_type *type); -const struct glsl_type *decode_type_from_blob(struct blob_reader *blob); +const glsl_type *decode_type_from_blob(struct blob_reader *blob); -typedef void (*glsl_type_size_align_func)(const struct glsl_type *type, +typedef void (*glsl_type_size_align_func)(const glsl_type *type, unsigned *size, unsigned *alignment); enum glsl_base_type { @@ -299,7 +299,7 @@ struct glsl_cmat_description { uint8_t use; /* enum glsl_cmat_use */ }; -const char *glsl_get_type_name(const struct glsl_type *type); +const char *glsl_get_type_name(const glsl_type *type); struct glsl_type { uint32_t gl_type; @@ -372,15 +372,15 @@ struct glsl_type { * Subtype of composite data types. */ union { - const struct glsl_type *array; /**< Type of array elements. */ - const struct glsl_struct_field *structure; /**< List of struct fields. */ + const glsl_type *array; /**< Type of array elements. */ + const glsl_struct_field *structure; /**< List of struct fields. */ } fields; }; #include "builtin_types.h" struct glsl_struct_field { - const struct glsl_type *type; + const glsl_type *type; const char *name; /** @@ -485,7 +485,7 @@ struct glsl_struct_field { type(_type), name(_name), location(-1), component(-1), offset(-1), \ xfb_buffer(0), xfb_stride(0), image_format(PIPE_FORMAT_NONE), flags(0) \ - glsl_struct_field(const struct glsl_type *_type, + glsl_struct_field(const glsl_type *_type, int _precision, const char *_name) : DEFAULT_CONSTRUCTORS(_type, _name) @@ -494,7 +494,7 @@ struct glsl_struct_field { precision = _precision; } - glsl_struct_field(const struct glsl_type *_type, const char *_name) + glsl_struct_field(const glsl_type *_type, const char *_name) : DEFAULT_CONSTRUCTORS(_type, _name) { matrix_layout = GLSL_MATRIX_LAYOUT_INHERITED; @@ -511,62 +511,62 @@ struct glsl_struct_field { #endif }; -static inline enum glsl_base_type glsl_get_base_type(const struct glsl_type *t) { return t->base_type; } +static inline enum glsl_base_type glsl_get_base_type(const glsl_type *t) { return t->base_type; } static inline unsigned -glsl_get_bit_size(const struct glsl_type *t) +glsl_get_bit_size(const glsl_type *t) { return glsl_base_type_get_bit_size(glsl_get_base_type(t)); } -static inline bool glsl_type_is_boolean(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_BOOL; } -static inline bool glsl_type_is_sampler(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_SAMPLER; } -static inline bool glsl_type_is_texture(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_TEXTURE; } -static inline bool glsl_type_is_image(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_IMAGE; } -static inline bool glsl_type_is_atomic_uint(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_ATOMIC_UINT; } -static inline bool glsl_type_is_struct(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_STRUCT; } -static inline bool glsl_type_is_interface(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_INTERFACE; } -static inline bool glsl_type_is_array(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_ARRAY; } -static inline bool glsl_type_is_cmat(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_COOPERATIVE_MATRIX; } -static inline bool glsl_type_is_void(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_VOID; } -static inline bool glsl_type_is_subroutine(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_SUBROUTINE; } -static inline bool glsl_type_is_error(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_ERROR; } -static inline bool glsl_type_is_double(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_DOUBLE; } -static inline bool glsl_type_is_float(const struct glsl_type *t) { return t->base_type == GLSL_TYPE_FLOAT; } +static inline bool glsl_type_is_boolean(const glsl_type *t) { return t->base_type == GLSL_TYPE_BOOL; } +static inline bool glsl_type_is_sampler(const glsl_type *t) { return t->base_type == GLSL_TYPE_SAMPLER; } +static inline bool glsl_type_is_texture(const glsl_type *t) { return t->base_type == GLSL_TYPE_TEXTURE; } +static inline bool glsl_type_is_image(const glsl_type *t) { return t->base_type == GLSL_TYPE_IMAGE; } +static inline bool glsl_type_is_atomic_uint(const glsl_type *t) { return t->base_type == GLSL_TYPE_ATOMIC_UINT; } +static inline bool glsl_type_is_struct(const glsl_type *t) { return t->base_type == GLSL_TYPE_STRUCT; } +static inline bool glsl_type_is_interface(const glsl_type *t) { return t->base_type == GLSL_TYPE_INTERFACE; } +static inline bool glsl_type_is_array(const glsl_type *t) { return t->base_type == GLSL_TYPE_ARRAY; } +static inline bool glsl_type_is_cmat(const glsl_type *t) { return t->base_type == GLSL_TYPE_COOPERATIVE_MATRIX; } +static inline bool glsl_type_is_void(const glsl_type *t) { return t->base_type == GLSL_TYPE_VOID; } +static inline bool glsl_type_is_subroutine(const glsl_type *t) { return t->base_type == GLSL_TYPE_SUBROUTINE; } +static inline bool glsl_type_is_error(const glsl_type *t) { return t->base_type == GLSL_TYPE_ERROR; } +static inline bool glsl_type_is_double(const glsl_type *t) { return t->base_type == GLSL_TYPE_DOUBLE; } +static inline bool glsl_type_is_float(const glsl_type *t) { return t->base_type == GLSL_TYPE_FLOAT; } static inline bool -glsl_type_is_numeric(const struct glsl_type *t) +glsl_type_is_numeric(const glsl_type *t) { return t->base_type >= GLSL_TYPE_UINT && t->base_type <= GLSL_TYPE_INT64; } static inline bool -glsl_type_is_integer(const struct glsl_type *t) +glsl_type_is_integer(const glsl_type *t) { return glsl_base_type_is_integer(t->base_type); } static inline bool -glsl_type_is_struct_or_ifc(const struct glsl_type *t) +glsl_type_is_struct_or_ifc(const glsl_type *t) { return glsl_type_is_struct(t) || glsl_type_is_interface(t); } static inline bool -glsl_type_is_packed(const struct glsl_type *t) +glsl_type_is_packed(const glsl_type *t) { return t->packed; } static inline bool -glsl_type_is_16bit(const struct glsl_type *t) +glsl_type_is_16bit(const glsl_type *t) { return glsl_base_type_is_16bit(t->base_type); } static inline bool -glsl_type_is_32bit(const struct glsl_type *t) +glsl_type_is_32bit(const glsl_type *t) { return t->base_type == GLSL_TYPE_UINT || t->base_type == GLSL_TYPE_INT || @@ -574,67 +574,67 @@ glsl_type_is_32bit(const struct glsl_type *t) } static inline bool -glsl_type_is_64bit(const struct glsl_type *t) +glsl_type_is_64bit(const glsl_type *t) { return glsl_base_type_is_64bit(t->base_type); } static inline bool -glsl_type_is_integer_16(const struct glsl_type *t) +glsl_type_is_integer_16(const glsl_type *t) { return t->base_type == GLSL_TYPE_UINT16 || t->base_type == GLSL_TYPE_INT16; } static inline bool -glsl_type_is_integer_32(const struct glsl_type *t) +glsl_type_is_integer_32(const glsl_type *t) { return t->base_type == GLSL_TYPE_UINT || t->base_type == GLSL_TYPE_INT; } static inline bool -glsl_type_is_integer_64(const struct glsl_type *t) +glsl_type_is_integer_64(const glsl_type *t) { return t->base_type == GLSL_TYPE_UINT64 || t->base_type == GLSL_TYPE_INT64; } static inline bool -glsl_type_is_integer_32_64(const struct glsl_type *t) +glsl_type_is_integer_32_64(const glsl_type *t) { return glsl_type_is_integer_32(t) || glsl_type_is_integer_64(t); } static inline bool -glsl_type_is_integer_16_32(const struct glsl_type *t) +glsl_type_is_integer_16_32(const glsl_type *t) { return glsl_type_is_integer_16(t) || glsl_type_is_integer_32(t); } static inline bool -glsl_type_is_integer_16_32_64(const struct glsl_type *t) +glsl_type_is_integer_16_32_64(const glsl_type *t) { return glsl_type_is_integer_16(t) || glsl_type_is_integer_32(t) || glsl_type_is_integer_64(t); } static inline bool -glsl_type_is_float_16_32(const struct glsl_type *t) +glsl_type_is_float_16_32(const glsl_type *t) { return t->base_type == GLSL_TYPE_FLOAT16 || glsl_type_is_float(t); } static inline bool -glsl_type_is_float_16_32_64(const struct glsl_type *t) +glsl_type_is_float_16_32_64(const glsl_type *t) { return t->base_type == GLSL_TYPE_FLOAT16 || glsl_type_is_float(t) || glsl_type_is_double(t); } static inline bool -glsl_type_is_float_32_64(const struct glsl_type *t) +glsl_type_is_float_32_64(const glsl_type *t) { return glsl_type_is_float(t) || glsl_type_is_double(t); } static inline bool -glsl_type_is_int_16_32_64(const struct glsl_type *t) +glsl_type_is_int_16_32_64(const glsl_type *t) { return t->base_type == GLSL_TYPE_INT16 || t->base_type == GLSL_TYPE_INT || @@ -642,7 +642,7 @@ glsl_type_is_int_16_32_64(const struct glsl_type *t) } static inline bool -glsl_type_is_uint_16_32_64(const struct glsl_type *t) +glsl_type_is_uint_16_32_64(const glsl_type *t) { return t->base_type == GLSL_TYPE_UINT16 || t->base_type == GLSL_TYPE_UINT || @@ -650,66 +650,66 @@ glsl_type_is_uint_16_32_64(const struct glsl_type *t) } static inline bool -glsl_type_is_int_16_32(const struct glsl_type *t) +glsl_type_is_int_16_32(const glsl_type *t) { return t->base_type == GLSL_TYPE_INT || t->base_type == GLSL_TYPE_INT16; } static inline bool -glsl_type_is_uint_16_32(const struct glsl_type *t) +glsl_type_is_uint_16_32(const glsl_type *t) { return t->base_type == GLSL_TYPE_UINT || t->base_type == GLSL_TYPE_UINT16; } static inline bool -glsl_type_is_unsized_array(const struct glsl_type *t) +glsl_type_is_unsized_array(const glsl_type *t) { return glsl_type_is_array(t) && t->length == 0; } static inline bool -glsl_type_is_array_of_arrays(const struct glsl_type *t) +glsl_type_is_array_of_arrays(const glsl_type *t) { return glsl_type_is_array(t) && glsl_type_is_array(t->fields.array); } static inline bool -glsl_type_is_bare_sampler(const struct glsl_type *t) +glsl_type_is_bare_sampler(const glsl_type *t) { return glsl_type_is_sampler(t) && t->sampled_type == GLSL_TYPE_VOID; } -bool glsl_type_is_vector(const struct glsl_type *t); -bool glsl_type_is_scalar(const struct glsl_type *t); -bool glsl_type_is_vector_or_scalar(const struct glsl_type *t); -bool glsl_type_is_matrix(const struct glsl_type *t); -bool glsl_type_is_array_or_matrix(const struct glsl_type *t); +bool glsl_type_is_vector(const glsl_type *t); +bool glsl_type_is_scalar(const glsl_type *t); +bool glsl_type_is_vector_or_scalar(const glsl_type *t); +bool glsl_type_is_matrix(const glsl_type *t); +bool glsl_type_is_array_or_matrix(const glsl_type *t); /** * Query whether a 64-bit type takes two slots. */ -bool glsl_type_is_dual_slot(const struct glsl_type *t); +bool glsl_type_is_dual_slot(const glsl_type *t); -bool glsl_type_is_leaf(const struct glsl_type *type); +bool glsl_type_is_leaf(const glsl_type *type); static inline bool -glsl_matrix_type_is_row_major(const struct glsl_type *t) +glsl_matrix_type_is_row_major(const glsl_type *t) { assert((glsl_type_is_matrix(t) && t->explicit_stride) || glsl_type_is_interface(t)); return t->interface_row_major; } static inline bool -glsl_sampler_type_is_shadow(const struct glsl_type *t) +glsl_sampler_type_is_shadow(const glsl_type *t) { assert(glsl_type_is_sampler(t)); return t->sampler_shadow; } static inline bool -glsl_sampler_type_is_array(const struct glsl_type *t) +glsl_sampler_type_is_array(const glsl_type *t) { assert(glsl_type_is_sampler(t) || glsl_type_is_texture(t) || @@ -718,7 +718,7 @@ glsl_sampler_type_is_array(const struct glsl_type *t) } static inline bool -glsl_struct_type_is_packed(const struct glsl_type *t) +glsl_struct_type_is_packed(const glsl_type *t) { assert(glsl_type_is_struct(t)); return t->packed; @@ -727,7 +727,7 @@ glsl_struct_type_is_packed(const struct glsl_type *t) /** * Gets the "bare" type without any decorations or layout information. */ -const struct glsl_type *glsl_get_bare_type(const struct glsl_type *t); +const glsl_type *glsl_get_bare_type(const glsl_type *t); /** * Get the basic scalar type which this type aggregates. @@ -738,7 +738,7 @@ const struct glsl_type *glsl_get_bare_type(const struct glsl_type *t); * returns the struct type. For samplers and arrays of samplers, this * function returns the sampler type. */ -const struct glsl_type *glsl_get_scalar_type(const struct glsl_type *t); +const glsl_type *glsl_get_scalar_type(const glsl_type *t); /** * For numeric and boolean derived types returns the basic scalar type @@ -748,12 +748,12 @@ const struct glsl_type *glsl_get_scalar_type(const struct glsl_type *t); * all other types, including arrays of numeric or boolean types, the * error type is returned. */ -const struct glsl_type *glsl_get_base_glsl_type(const struct glsl_type *t); +const glsl_type *glsl_get_base_glsl_type(const glsl_type *t); -unsigned glsl_get_length(const struct glsl_type *t); +unsigned glsl_get_length(const glsl_type *t); static inline unsigned -glsl_get_vector_elements(const struct glsl_type *t) +glsl_get_vector_elements(const glsl_type *t) { return t->vector_elements; } @@ -762,19 +762,19 @@ glsl_get_vector_elements(const struct glsl_type *t) * Query the total number of scalars that make up a scalar, vector or matrix */ static inline unsigned -glsl_get_components(const struct glsl_type *t) +glsl_get_components(const glsl_type *t) { return t->vector_elements * t->matrix_columns; } static inline unsigned -glsl_get_matrix_columns(const struct glsl_type *t) +glsl_get_matrix_columns(const glsl_type *t) { return t->matrix_columns; } -const struct glsl_type *glsl_type_wrap_in_arrays(const struct glsl_type *t, - const struct glsl_type *arrays); +const glsl_type *glsl_type_wrap_in_arrays(const glsl_type *t, + const glsl_type *arrays); /** * Query the number of elements in an array type @@ -785,7 +785,7 @@ const struct glsl_type *glsl_type_wrap_in_arrays(const struct glsl_type *t, * zero is returned. */ static inline int -glsl_array_size(const struct glsl_type *t) +glsl_array_size(const glsl_type *t) { return glsl_type_is_array(t) ? t->length : -1; } @@ -794,9 +794,9 @@ glsl_array_size(const struct glsl_type *t) * Return the total number of elements in an array including the elements * in arrays of arrays. */ -unsigned glsl_get_aoa_size(const struct glsl_type *t); +unsigned glsl_get_aoa_size(const glsl_type *t); -const struct glsl_type *glsl_get_array_element(const struct glsl_type *t); +const glsl_type *glsl_get_array_element(const glsl_type *t); /** * Get the type stripped of any arrays @@ -805,36 +805,36 @@ const struct glsl_type *glsl_get_array_element(const struct glsl_type *t); * Pointer to the type of elements of the first non-array type for array * types, or pointer to itself for non-array types. */ -const struct glsl_type *glsl_without_array(const struct glsl_type *t); +const glsl_type *glsl_without_array(const glsl_type *t); -const struct glsl_type *glsl_without_array_or_matrix(const struct glsl_type *t); -const struct glsl_type *glsl_type_wrap_in_arrays(const struct glsl_type *t, - const struct glsl_type *arrays); +const glsl_type *glsl_without_array_or_matrix(const glsl_type *t); +const glsl_type *glsl_type_wrap_in_arrays(const glsl_type *t, + const glsl_type *arrays); -const struct glsl_type *glsl_get_cmat_element(const struct glsl_type *t); -const struct glsl_cmat_description *glsl_get_cmat_description(const struct glsl_type *t); +const glsl_type *glsl_get_cmat_element(const glsl_type *t); +const struct glsl_cmat_description *glsl_get_cmat_description(const glsl_type *t); /** * Return the amount of atomic counter storage required for a type. */ -unsigned glsl_atomic_size(const struct glsl_type *type); +unsigned glsl_atomic_size(const glsl_type *type); /** * Type A contains type B if A is B or A is a composite type (struct, * interface, array) that has an element that contains B. */ -bool glsl_type_contains_64bit(const struct glsl_type *t); -bool glsl_type_contains_image(const struct glsl_type *t); -bool glsl_contains_atomic(const struct glsl_type *t); -bool glsl_contains_double(const struct glsl_type *t); -bool glsl_contains_integer(const struct glsl_type *t); -bool glsl_contains_opaque(const struct glsl_type *t); -bool glsl_contains_sampler(const struct glsl_type *t); -bool glsl_contains_array(const struct glsl_type *t); -bool glsl_contains_subroutine(const struct glsl_type *t); +bool glsl_type_contains_64bit(const glsl_type *t); +bool glsl_type_contains_image(const glsl_type *t); +bool glsl_contains_atomic(const glsl_type *t); +bool glsl_contains_double(const glsl_type *t); +bool glsl_contains_integer(const glsl_type *t); +bool glsl_contains_opaque(const glsl_type *t); +bool glsl_contains_sampler(const glsl_type *t); +bool glsl_contains_array(const glsl_type *t); +bool glsl_contains_subroutine(const glsl_type *t); static inline enum glsl_sampler_dim -glsl_get_sampler_dim(const struct glsl_type *t) +glsl_get_sampler_dim(const glsl_type *t) { assert(glsl_type_is_sampler(t) || glsl_type_is_texture(t) || @@ -843,7 +843,7 @@ glsl_get_sampler_dim(const struct glsl_type *t) } static inline enum glsl_base_type -glsl_get_sampler_result_type(const struct glsl_type *t) +glsl_get_sampler_result_type(const glsl_type *t) { assert(glsl_type_is_sampler(t) || glsl_type_is_texture(t) || @@ -862,7 +862,7 @@ glsl_get_sampler_result_type(const struct glsl_type *t) * a texturing built-in function, since those pack additional values (such * as the shadow comparator or projector) into the coordinate type. */ -int glsl_get_sampler_coordinate_components(const struct glsl_type *t); +int glsl_get_sampler_coordinate_components(const glsl_type *t); /** * Compares whether this type matches another type without taking into @@ -871,7 +871,7 @@ int glsl_get_sampler_coordinate_components(const struct glsl_type *t); * This is applied recursively so that structures containing structure * members can also ignore the precision. */ -bool glsl_type_compare_no_precision(const struct glsl_type *a, const struct glsl_type *b); +bool glsl_type_compare_no_precision(const glsl_type *a, const glsl_type *b); /** * Compare a record type against another record type. @@ -883,12 +883,12 @@ bool glsl_type_compare_no_precision(const struct glsl_type *a, const struct glsl * The option to not match locations is to deal with places where the * same struct is defined in a block which has a location set on it. */ -bool glsl_record_compare(const struct glsl_type *a, const struct glsl_type *b, +bool glsl_record_compare(const glsl_type *a, const glsl_type *b, bool match_name, bool match_locations, bool match_precision); -const struct glsl_type *glsl_get_struct_field(const struct glsl_type *t, unsigned index); -const struct glsl_struct_field *glsl_get_struct_field_data(const struct glsl_type *t, unsigned index); +const glsl_type *glsl_get_struct_field(const glsl_type *t, unsigned index); +const glsl_struct_field *glsl_get_struct_field_data(const glsl_type *t, unsigned index); /** * Calculate offset between the base location of the struct in @@ -896,12 +896,12 @@ const struct glsl_struct_field *glsl_get_struct_field_data(const struct glsl_typ * For the initial call, length is the index of the member to find the * offset for. */ -unsigned glsl_get_struct_location_offset(const struct glsl_type *t, unsigned length); +unsigned glsl_get_struct_location_offset(const glsl_type *t, unsigned length); /** * Get the location of a field within a record type */ -int glsl_get_field_index(const struct glsl_type *t, const char *name); +int glsl_get_field_index(const glsl_type *t, const char *name); /** * Get the type of a structure field @@ -910,46 +910,46 @@ int glsl_get_field_index(const struct glsl_type *t, const char *name); * Pointer to the type of the named field. If the type is not a structure * or the named field does not exist, \c &glsl_type_builtin_error is returned. */ -const struct glsl_type *glsl_get_field_type(const struct glsl_type *t, const char *name); +const glsl_type *glsl_get_field_type(const glsl_type *t, const char *name); static inline int -glsl_get_struct_field_offset(const struct glsl_type *t, unsigned index) +glsl_get_struct_field_offset(const glsl_type *t, unsigned index) { return t->fields.structure[index].offset; } static inline const char * -glsl_get_struct_elem_name(const struct glsl_type *t, unsigned index) +glsl_get_struct_elem_name(const glsl_type *t, unsigned index) { return t->fields.structure[index].name; } -static inline const struct glsl_type *glsl_void_type(void) { return &glsl_type_builtin_void; } -static inline const struct glsl_type *glsl_float_type(void) { return &glsl_type_builtin_float; } -static inline const struct glsl_type *glsl_float16_t_type(void) { return &glsl_type_builtin_float16_t; } -static inline const struct glsl_type *glsl_double_type(void) { return &glsl_type_builtin_double; } -static inline const struct glsl_type *glsl_vec2_type(void) { return &glsl_type_builtin_vec2; } -static inline const struct glsl_type *glsl_dvec2_type(void) { return &glsl_type_builtin_ivec2; } -static inline const struct glsl_type *glsl_uvec2_type(void) { return &glsl_type_builtin_uvec2; } -static inline const struct glsl_type *glsl_ivec2_type(void) { return &glsl_type_builtin_ivec2; } -static inline const struct glsl_type *glsl_bvec2_type(void) { return &glsl_type_builtin_bvec2; } -static inline const struct glsl_type *glsl_vec4_type(void) { return &glsl_type_builtin_vec4; } -static inline const struct glsl_type *glsl_dvec4_type(void) { return &glsl_type_builtin_ivec4; } -static inline const struct glsl_type *glsl_uvec4_type(void) { return &glsl_type_builtin_uvec4; } -static inline const struct glsl_type *glsl_ivec4_type(void) { return &glsl_type_builtin_ivec4; } -static inline const struct glsl_type *glsl_bvec4_type(void) { return &glsl_type_builtin_bvec4; } -static inline const struct glsl_type *glsl_int_type(void) { return &glsl_type_builtin_int; } -static inline const struct glsl_type *glsl_uint_type(void) { return &glsl_type_builtin_uint; } -static inline const struct glsl_type *glsl_int64_t_type(void) { return &glsl_type_builtin_int64_t; } -static inline const struct glsl_type *glsl_uint64_t_type(void) { return &glsl_type_builtin_uint64_t; } -static inline const struct glsl_type *glsl_int16_t_type(void) { return &glsl_type_builtin_int16_t; } -static inline const struct glsl_type *glsl_uint16_t_type(void) { return &glsl_type_builtin_uint16_t; } -static inline const struct glsl_type *glsl_int8_t_type(void) { return &glsl_type_builtin_int8_t; } -static inline const struct glsl_type *glsl_uint8_t_type(void) { return &glsl_type_builtin_uint8_t; } -static inline const struct glsl_type *glsl_bool_type(void) { return &glsl_type_builtin_bool; } -static inline const struct glsl_type *glsl_atomic_uint_type(void) { return &glsl_type_builtin_atomic_uint; } +static inline const glsl_type *glsl_void_type(void) { return &glsl_type_builtin_void; } +static inline const glsl_type *glsl_float_type(void) { return &glsl_type_builtin_float; } +static inline const glsl_type *glsl_float16_t_type(void) { return &glsl_type_builtin_float16_t; } +static inline const glsl_type *glsl_double_type(void) { return &glsl_type_builtin_double; } +static inline const glsl_type *glsl_vec2_type(void) { return &glsl_type_builtin_vec2; } +static inline const glsl_type *glsl_dvec2_type(void) { return &glsl_type_builtin_ivec2; } +static inline const glsl_type *glsl_uvec2_type(void) { return &glsl_type_builtin_uvec2; } +static inline const glsl_type *glsl_ivec2_type(void) { return &glsl_type_builtin_ivec2; } +static inline const glsl_type *glsl_bvec2_type(void) { return &glsl_type_builtin_bvec2; } +static inline const glsl_type *glsl_vec4_type(void) { return &glsl_type_builtin_vec4; } +static inline const glsl_type *glsl_dvec4_type(void) { return &glsl_type_builtin_ivec4; } +static inline const glsl_type *glsl_uvec4_type(void) { return &glsl_type_builtin_uvec4; } +static inline const glsl_type *glsl_ivec4_type(void) { return &glsl_type_builtin_ivec4; } +static inline const glsl_type *glsl_bvec4_type(void) { return &glsl_type_builtin_bvec4; } +static inline const glsl_type *glsl_int_type(void) { return &glsl_type_builtin_int; } +static inline const glsl_type *glsl_uint_type(void) { return &glsl_type_builtin_uint; } +static inline const glsl_type *glsl_int64_t_type(void) { return &glsl_type_builtin_int64_t; } +static inline const glsl_type *glsl_uint64_t_type(void) { return &glsl_type_builtin_uint64_t; } +static inline const glsl_type *glsl_int16_t_type(void) { return &glsl_type_builtin_int16_t; } +static inline const glsl_type *glsl_uint16_t_type(void) { return &glsl_type_builtin_uint16_t; } +static inline const glsl_type *glsl_int8_t_type(void) { return &glsl_type_builtin_int8_t; } +static inline const glsl_type *glsl_uint8_t_type(void) { return &glsl_type_builtin_uint8_t; } +static inline const glsl_type *glsl_bool_type(void) { return &glsl_type_builtin_bool; } +static inline const glsl_type *glsl_atomic_uint_type(void) { return &glsl_type_builtin_atomic_uint; } -static inline const struct glsl_type * +static inline const glsl_type * glsl_floatN_t_type(unsigned bit_size) { switch (bit_size) { @@ -961,7 +961,7 @@ glsl_floatN_t_type(unsigned bit_size) } } -static inline const struct glsl_type * +static inline const glsl_type * glsl_intN_t_type(unsigned bit_size) { switch (bit_size) { @@ -974,7 +974,7 @@ glsl_intN_t_type(unsigned bit_size) } } -static inline const struct glsl_type * +static inline const glsl_type * glsl_uintN_t_type(unsigned bit_size) { switch (bit_size) { @@ -987,65 +987,65 @@ glsl_uintN_t_type(unsigned bit_size) } } -const struct glsl_type *glsl_vec_type(unsigned components); -const struct glsl_type *glsl_f16vec_type(unsigned components); -const struct glsl_type *glsl_dvec_type(unsigned components); -const struct glsl_type *glsl_ivec_type(unsigned components); -const struct glsl_type *glsl_uvec_type(unsigned components); -const struct glsl_type *glsl_bvec_type(unsigned components); -const struct glsl_type *glsl_i64vec_type(unsigned components); -const struct glsl_type *glsl_u64vec_type(unsigned components); -const struct glsl_type *glsl_i16vec_type(unsigned components); -const struct glsl_type *glsl_u16vec_type(unsigned components); -const struct glsl_type *glsl_i8vec_type(unsigned components); -const struct glsl_type *glsl_u8vec_type(unsigned components); +const glsl_type *glsl_vec_type(unsigned components); +const glsl_type *glsl_f16vec_type(unsigned components); +const glsl_type *glsl_dvec_type(unsigned components); +const glsl_type *glsl_ivec_type(unsigned components); +const glsl_type *glsl_uvec_type(unsigned components); +const glsl_type *glsl_bvec_type(unsigned components); +const glsl_type *glsl_i64vec_type(unsigned components); +const glsl_type *glsl_u64vec_type(unsigned components); +const glsl_type *glsl_i16vec_type(unsigned components); +const glsl_type *glsl_u16vec_type(unsigned components); +const glsl_type *glsl_i8vec_type(unsigned components); +const glsl_type *glsl_u8vec_type(unsigned components); -const struct glsl_type *glsl_simple_explicit_type(unsigned base_type, unsigned rows, +const glsl_type *glsl_simple_explicit_type(unsigned base_type, unsigned rows, unsigned columns, unsigned explicit_stride, bool row_major, unsigned explicit_alignment); -static inline const struct glsl_type * +static inline const glsl_type * glsl_simple_type(unsigned base_type, unsigned rows, unsigned columns) { return glsl_simple_explicit_type(base_type, rows, columns, 0, false, 0); } -const struct glsl_type *glsl_sampler_type(enum glsl_sampler_dim dim, +const glsl_type *glsl_sampler_type(enum glsl_sampler_dim dim, bool shadow, bool array, enum glsl_base_type type); -const struct glsl_type *glsl_bare_sampler_type(void); -const struct glsl_type *glsl_bare_shadow_sampler_type(void); -const struct glsl_type *glsl_texture_type(enum glsl_sampler_dim dim, +const glsl_type *glsl_bare_sampler_type(void); +const glsl_type *glsl_bare_shadow_sampler_type(void); +const glsl_type *glsl_texture_type(enum glsl_sampler_dim dim, bool array, enum glsl_base_type type); -const struct glsl_type *glsl_image_type(enum glsl_sampler_dim dim, +const glsl_type *glsl_image_type(enum glsl_sampler_dim dim, bool array, enum glsl_base_type type); -const struct glsl_type *glsl_array_type(const struct glsl_type *element, +const glsl_type *glsl_array_type(const glsl_type *element, unsigned array_size, unsigned explicit_stride); -const struct glsl_type *glsl_cmat_type(const struct glsl_cmat_description *desc); -const struct glsl_type *glsl_struct_type_with_explicit_alignment(const struct glsl_struct_field *fields, +const glsl_type *glsl_cmat_type(const struct glsl_cmat_description *desc); +const glsl_type *glsl_struct_type_with_explicit_alignment(const glsl_struct_field *fields, unsigned num_fields, const char *name, bool packed, unsigned explicit_alignment); -static inline const struct glsl_type * -glsl_struct_type(const struct glsl_struct_field *fields, unsigned num_fields, +static inline const glsl_type * +glsl_struct_type(const glsl_struct_field *fields, unsigned num_fields, const char *name, bool packed) { return glsl_struct_type_with_explicit_alignment(fields, num_fields, name, packed, 0); } -const struct glsl_type *glsl_interface_type(const struct glsl_struct_field *fields, +const glsl_type *glsl_interface_type(const glsl_struct_field *fields, unsigned num_fields, enum glsl_interface_packing packing, bool row_major, const char *block_name); -const struct glsl_type *glsl_subroutine_type(const char *subroutine_name); +const glsl_type *glsl_subroutine_type(const char *subroutine_name); /** * Query the full type of a matrix row @@ -1054,7 +1054,7 @@ const struct glsl_type *glsl_subroutine_type(const char *subroutine_name); * If the type is not a matrix, \c glsl_type::error_type is returned. * Otherwise a type matching the rows of the matrix is returned. */ -const struct glsl_type *glsl_get_row_type(const struct glsl_type *t); +const glsl_type *glsl_get_row_type(const glsl_type *t); /** * Query the full type of a matrix column @@ -1063,7 +1063,7 @@ const struct glsl_type *glsl_get_row_type(const struct glsl_type *t); * If the type is not a matrix, \c glsl_type::error_type is returned. * Otherwise a type matching the columns of the matrix is returned. */ -const struct glsl_type *glsl_get_column_type(const struct glsl_type *t); +const glsl_type *glsl_get_column_type(const glsl_type *t); /** Returns an explicitly laid out type given a type and size/align func * @@ -1082,57 +1082,57 @@ const struct glsl_type *glsl_get_column_type(const struct glsl_type *t); * or SSBO layout because they do not add the extra array and substructure * alignment that is required by std140 and std430. */ -const struct glsl_type *glsl_get_explicit_type_for_size_align(const struct glsl_type *type, +const glsl_type *glsl_get_explicit_type_for_size_align(const glsl_type *type, glsl_type_size_align_func type_info, unsigned *size, unsigned *align); -const struct glsl_type *glsl_type_replace_vec3_with_vec4(const struct glsl_type *type); +const glsl_type *glsl_type_replace_vec3_with_vec4(const glsl_type *type); /** * Gets the float16 version of this type. */ -const struct glsl_type *glsl_float16_type(const struct glsl_type *t); +const glsl_type *glsl_float16_type(const glsl_type *t); /** * Gets the int16 version of this type. */ -const struct glsl_type *glsl_int16_type(const struct glsl_type *t); +const glsl_type *glsl_int16_type(const glsl_type *t); /** * Gets the uint16 version of this type. */ -const struct glsl_type *glsl_uint16_type(const struct glsl_type *t); +const glsl_type *glsl_uint16_type(const glsl_type *t); -const struct glsl_type *glsl_type_to_16bit(const struct glsl_type *old_type); +const glsl_type *glsl_type_to_16bit(const glsl_type *old_type); -static inline const struct glsl_type * +static inline const glsl_type * glsl_scalar_type(enum glsl_base_type base_type) { return glsl_simple_type(base_type, 1, 1); } -static inline const struct glsl_type * +static inline const glsl_type * glsl_vector_type(enum glsl_base_type base_type, unsigned components) { - const struct glsl_type *t = glsl_simple_type(base_type, components, 1); + const glsl_type *t = glsl_simple_type(base_type, components, 1); assert(t != &glsl_type_builtin_error); return t; } -static inline const struct glsl_type * +static inline const glsl_type * glsl_matrix_type(enum glsl_base_type base_type, unsigned rows, unsigned columns) { - const struct glsl_type *t = glsl_simple_type(base_type, rows, columns); + const glsl_type *t = glsl_simple_type(base_type, rows, columns); assert(t != &glsl_type_builtin_error); return t; } -static inline const struct glsl_type * -glsl_explicit_matrix_type(const struct glsl_type *mat, unsigned stride, +static inline const glsl_type * +glsl_explicit_matrix_type(const glsl_type *mat, unsigned stride, bool row_major) { assert(stride > 0); - const struct glsl_type *t = glsl_simple_explicit_type(mat->base_type, + const glsl_type *t = glsl_simple_explicit_type(mat->base_type, mat->vector_elements, mat->matrix_columns, stride, row_major, 0); @@ -1141,15 +1141,15 @@ glsl_explicit_matrix_type(const struct glsl_type *mat, unsigned stride, } -static inline const struct glsl_type * -glsl_transposed_type(const struct glsl_type *t) +static inline const glsl_type * +glsl_transposed_type(const glsl_type *t) { assert(glsl_type_is_matrix(t)); return glsl_simple_type(t->base_type, t->matrix_columns, t->vector_elements); } -static inline const struct glsl_type * -glsl_texture_type_to_sampler(const struct glsl_type *t, bool is_shadow) +static inline const glsl_type * +glsl_texture_type_to_sampler(const glsl_type *t, bool is_shadow) { assert(glsl_type_is_texture(t)); return glsl_sampler_type((enum glsl_sampler_dim)t->sampler_dimensionality, @@ -1157,8 +1157,8 @@ glsl_texture_type_to_sampler(const struct glsl_type *t, bool is_shadow) (enum glsl_base_type)t->sampled_type); } -static inline const struct glsl_type * -glsl_sampler_type_to_texture(const struct glsl_type *t) +static inline const glsl_type * +glsl_sampler_type_to_texture(const glsl_type *t) { assert(glsl_type_is_sampler(t) && !glsl_type_is_bare_sampler(t)); return glsl_texture_type((enum glsl_sampler_dim)t->sampler_dimensionality, @@ -1166,17 +1166,17 @@ glsl_sampler_type_to_texture(const struct glsl_type *t) (enum glsl_base_type)t->sampled_type); } -const struct glsl_type *glsl_replace_vector_type(const struct glsl_type *t, unsigned components); -const struct glsl_type *glsl_channel_type(const struct glsl_type *t); +const glsl_type *glsl_replace_vector_type(const glsl_type *t, unsigned components); +const glsl_type *glsl_channel_type(const glsl_type *t); /** * Get the type resulting from a multiplication of \p type_a * \p type_b */ -const struct glsl_type *glsl_get_mul_type(const struct glsl_type *type_a, const struct glsl_type *type_b); +const glsl_type *glsl_get_mul_type(const glsl_type *type_a, const glsl_type *type_b); -unsigned glsl_type_get_sampler_count(const struct glsl_type *t); -unsigned glsl_type_get_texture_count(const struct glsl_type *t); -unsigned glsl_type_get_image_count(const struct glsl_type *t); +unsigned glsl_type_get_sampler_count(const glsl_type *t); +unsigned glsl_type_get_texture_count(const glsl_type *t); +unsigned glsl_type_get_image_count(const glsl_type *t); /** * Calculate the number of vec4 slots required to hold this type. @@ -1185,7 +1185,7 @@ unsigned glsl_type_get_image_count(const struct glsl_type *t); * count_attribute_slots() (vertex inputs and varyings) but also for * gallium's !PIPE_CAP_PACKED_UNIFORMS case. */ -unsigned glsl_count_vec4_slots(const struct glsl_type *t, bool is_gl_vertex_input, bool is_bindless); +unsigned glsl_count_vec4_slots(const glsl_type *t, bool is_gl_vertex_input, bool is_bindless); /** * Calculate the number of vec4 slots required to hold this type. @@ -1193,7 +1193,7 @@ unsigned glsl_count_vec4_slots(const struct glsl_type *t, bool is_gl_vertex_inpu * This is the underlying recursive type_size function for * gallium's PIPE_CAP_PACKED_UNIFORMS case. */ -unsigned glsl_count_dword_slots(const struct glsl_type *t, bool is_bindless); +unsigned glsl_count_dword_slots(const glsl_type *t, bool is_bindless); /** * Calculate the number of components slots required to hold this type @@ -1201,15 +1201,15 @@ unsigned glsl_count_dword_slots(const struct glsl_type *t, bool is_bindless); * This is used to determine how many uniform or varying locations a type * might occupy. */ -unsigned glsl_get_component_slots(const struct glsl_type *t); +unsigned glsl_get_component_slots(const glsl_type *t); -unsigned glsl_get_component_slots_aligned(const struct glsl_type *t, unsigned offset); +unsigned glsl_get_component_slots_aligned(const glsl_type *t, unsigned offset); /** * Used to count the number of varyings contained in the type ignoring * innermost array elements. */ -unsigned glsl_varying_count(const struct glsl_type *t); +unsigned glsl_varying_count(const glsl_type *t); /** * Calculate the number of unique values from glGetUniformLocation for the @@ -1218,7 +1218,7 @@ unsigned glsl_varying_count(const struct glsl_type *t); * This is used to allocate slots in the UniformRemapTable, the amount of * locations may not match with actual used storage space by the driver. */ -unsigned glsl_type_uniform_locations(const struct glsl_type *t); +unsigned glsl_type_uniform_locations(const glsl_type *t); /** * Calculate the number of attribute slots required to hold this type @@ -1236,7 +1236,7 @@ unsigned glsl_type_uniform_locations(const struct glsl_type *t); * false. */ static inline unsigned -glsl_count_attribute_slots(const struct glsl_type *t, bool is_gl_vertex_input) +glsl_count_attribute_slots(const glsl_type *t, bool is_gl_vertex_input) { return glsl_count_vec4_slots(t, is_gl_vertex_input, true); } @@ -1244,24 +1244,24 @@ glsl_count_attribute_slots(const struct glsl_type *t, bool is_gl_vertex_input) /** * Size in bytes of this type in OpenCL memory */ -unsigned glsl_get_cl_size(const struct glsl_type *t); +unsigned glsl_get_cl_size(const glsl_type *t); /** * Alignment in bytes of the start of this type in OpenCL memory. */ -unsigned glsl_get_cl_alignment(const struct glsl_type *t); +unsigned glsl_get_cl_alignment(const glsl_type *t); -void glsl_get_cl_type_size_align(const struct glsl_type *t, +void glsl_get_cl_type_size_align(const glsl_type *t, unsigned *size, unsigned *align); /** * Get the type interface packing used internally. For shared and packing * layouts this is implementation defined. */ -enum glsl_interface_packing glsl_get_internal_ifc_packing(const struct glsl_type *t, bool std430_supported); +enum glsl_interface_packing glsl_get_internal_ifc_packing(const glsl_type *t, bool std430_supported); static inline enum glsl_interface_packing -glsl_get_ifc_packing(const struct glsl_type *t) +glsl_get_ifc_packing(const glsl_type *t) { return (enum glsl_interface_packing)t->interface_packing; } @@ -1270,33 +1270,33 @@ glsl_get_ifc_packing(const struct glsl_type *t) * Alignment in bytes of the start of this type in a std140 uniform * block. */ -unsigned glsl_get_std140_base_alignment(const struct glsl_type *t, bool row_major); +unsigned glsl_get_std140_base_alignment(const glsl_type *t, bool row_major); /** Size in bytes of this type in a std140 uniform block. * * Note that this is not GL_UNIFORM_SIZE (which is the number of * elements in the array) */ -unsigned glsl_get_std140_size(const struct glsl_type *t, bool row_major); +unsigned glsl_get_std140_size(const glsl_type *t, bool row_major); /** * Calculate array stride in bytes of this type in a std430 shader storage * block. */ -unsigned glsl_get_std430_array_stride(const struct glsl_type *t, bool row_major); +unsigned glsl_get_std430_array_stride(const glsl_type *t, bool row_major); /** * Alignment in bytes of the start of this type in a std430 shader * storage block. */ -unsigned glsl_get_std430_base_alignment(const struct glsl_type *t, bool row_major); +unsigned glsl_get_std430_base_alignment(const glsl_type *t, bool row_major); /** * Size in bytes of this type in a std430 shader storage block. * * Note that this is not GL_BUFFER_SIZE */ -unsigned glsl_get_std430_size(const struct glsl_type *t, bool row_major); +unsigned glsl_get_std430_size(const glsl_type *t, bool row_major); /** * Size in bytes of this type based on its explicit data. @@ -1309,16 +1309,16 @@ unsigned glsl_get_std430_size(const struct glsl_type *t, bool row_major); * values are set, so only with SPIR-V shaders. Should not be used with * GLSL shaders. */ -unsigned glsl_get_explicit_size(const struct glsl_type *t, bool align_to_stride); +unsigned glsl_get_explicit_size(const glsl_type *t, bool align_to_stride); static inline unsigned -glsl_get_explicit_stride(const struct glsl_type *t) +glsl_get_explicit_stride(const glsl_type *t) { return t->explicit_stride; } static inline unsigned -glsl_get_explicit_alignment(const struct glsl_type *t) +glsl_get_explicit_alignment(const glsl_type *t) { return t->explicit_alignment; } @@ -1326,18 +1326,18 @@ glsl_get_explicit_alignment(const struct glsl_type *t) /** * Gets an explicitly laid out type with the std140 layout. */ -const struct glsl_type *glsl_get_explicit_std140_type(const struct glsl_type *t, bool row_major); +const glsl_type *glsl_get_explicit_std140_type(const glsl_type *t, bool row_major); /** * Gets an explicitly laid out type with the std430 layout. */ -const struct glsl_type *glsl_get_explicit_std430_type(const struct glsl_type *t, bool row_major); +const glsl_type *glsl_get_explicit_std430_type(const glsl_type *t, bool row_major); /** * Gets an explicitly laid out interface type. */ -static inline const struct glsl_type * -glsl_get_explicit_interface_type(const struct glsl_type *t, bool supports_std430) +static inline const glsl_type * +glsl_get_explicit_interface_type(const glsl_type *t, bool supports_std430) { enum glsl_interface_packing packing = glsl_get_internal_ifc_packing(t, supports_std430); if (packing == GLSL_INTERFACE_PACKING_STD140) { @@ -1348,8 +1348,8 @@ glsl_get_explicit_interface_type(const struct glsl_type *t, bool supports_std430 } } -void glsl_get_natural_size_align_bytes(const struct glsl_type *t, unsigned *size, unsigned *align); -void glsl_get_vec4_size_align_bytes(const struct glsl_type *type, unsigned *size, unsigned *align); +void glsl_get_natural_size_align_bytes(const glsl_type *t, unsigned *size, unsigned *align); +void glsl_get_vec4_size_align_bytes(const glsl_type *type, unsigned *size, unsigned *align); #ifdef __cplusplus } /* extern "C" */