compiler/types: Be consistent when naming array element/size

The element type passed is different than the array type and it is not
a "base type" in the glsl_type sense, so pick a name that reflects that.
Also stick to a single name for the array_size.

Just renames, no behavior change.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23279>
This commit is contained in:
Caio Oliveira 2023-05-26 13:43:05 -07:00 committed by Marge Bot
parent 83f741124b
commit efbbdeffc0
4 changed files with 10 additions and 11 deletions

View file

@ -1231,7 +1231,7 @@ glsl_type::get_image_instance(enum glsl_sampler_dim dim,
}
const glsl_type *
glsl_type::get_array_instance(const glsl_type *base,
glsl_type::get_array_instance(const glsl_type *element,
unsigned array_size,
unsigned explicit_stride)
{
@ -1241,7 +1241,7 @@ glsl_type::get_array_instance(const glsl_type *base,
* named 'foo'.
*/
char key[128];
snprintf(key, sizeof(key), "%p[%u]x%uB", (void *) base, array_size,
snprintf(key, sizeof(key), "%p[%u]x%uB", (void *) element, array_size,
explicit_stride);
simple_mtx_lock(&glsl_type::hash_mutex);
@ -1254,7 +1254,7 @@ glsl_type::get_array_instance(const glsl_type *base,
const struct hash_entry *entry = _mesa_hash_table_search(array_types, key);
if (entry == NULL) {
const glsl_type *t = new glsl_type(base, array_size, explicit_stride);
const glsl_type *t = new glsl_type(element, array_size, explicit_stride);
entry = _mesa_hash_table_insert(array_types,
strdup(key),
@ -1263,7 +1263,7 @@ glsl_type::get_array_instance(const glsl_type *base,
assert(((glsl_type *) entry->data)->base_type == GLSL_TYPE_ARRAY);
assert(((glsl_type *) entry->data)->length == array_size);
assert(((glsl_type *) entry->data)->fields.array == base);
assert(((glsl_type *) entry->data)->fields.array == element);
glsl_type *t = (glsl_type *) entry->data;
@ -1447,7 +1447,6 @@ glsl_type::record_key_hash(const void *a)
return retval;
}
const glsl_type *
glsl_type::get_struct_instance(const glsl_struct_field *fields,
unsigned num_fields,

View file

@ -479,8 +479,8 @@ public:
/**
* Get the instance of an array type
*/
static const glsl_type *get_array_instance(const glsl_type *base,
unsigned elements,
static const glsl_type *get_array_instance(const glsl_type *element,
unsigned array_size,
unsigned explicit_stride = 0);
/**

View file

@ -649,10 +649,10 @@ glsl_explicit_matrix_type(const glsl_type *mat,
}
const glsl_type *
glsl_array_type(const glsl_type *base, unsigned elements,
glsl_array_type(const glsl_type *element, unsigned array_size,
unsigned explicit_stride)
{
return glsl_type::get_array_instance(base, elements, explicit_stride);
return glsl_type::get_array_instance(element, array_size, explicit_stride);
}
const glsl_type *

View file

@ -205,8 +205,8 @@ const struct glsl_type *glsl_explicit_matrix_type(const struct glsl_type *mat,
unsigned stride,
bool row_major);
const struct glsl_type *glsl_array_type(const struct glsl_type *base,
unsigned elements,
const struct glsl_type *glsl_array_type(const struct glsl_type *element,
unsigned array_size,
unsigned explicit_stride);
const struct glsl_type *glsl_struct_type(const struct glsl_struct_field *fields,