compiler/types: Change glsl_type::name to be an uintptr_t

This will allow us later to store builtin names in a different way.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25191>
This commit is contained in:
Caio Oliveira 2023-09-12 12:12:33 -07:00 committed by Marge Bot
parent bf01000a50
commit 53149cdd6e
4 changed files with 10 additions and 10 deletions

View file

@ -23,7 +23,7 @@ const struct glsl_type glsl_type_builtin_${t["name"]} = {
%if v is None:
<% continue %>
%elif k == "name":
.${k} = "${v}",
.name_id = (uintptr_t) "${v}",
%else:
.${k} = ${v},
%endif

View file

@ -79,7 +79,7 @@ make_vector_matrix_type(void *lin_ctx, uint32_t gl_type,
t->matrix_columns = matrix_columns;
t->explicit_stride = explicit_stride;
t->explicit_alignment = explicit_alignment;
t->name = linear_strdup(lin_ctx, name);
t->name_id = (uintptr_t)linear_strdup(lin_ctx, name);
return t;
}
@ -93,7 +93,7 @@ fill_struct_type(glsl_type *t, const glsl_struct_field *fields, unsigned num_fie
t->sampled_type = GLSL_TYPE_VOID;
t->packed = packed;
t->length = num_fields;
t->name = name;
t->name_id = (uintptr_t)name;
t->explicit_alignment = explicit_alignment;
t->fields.structure = fields;
}
@ -132,7 +132,7 @@ fill_interface_type(glsl_type *t, const glsl_struct_field *fields, unsigned num_
t->interface_packing = (unsigned)packing;
t->interface_row_major = (unsigned)row_major;
t->length = num_fields;
t->name = name;
t->name_id = (uintptr_t)name;
t->fields.structure = fields;
}
@ -171,7 +171,7 @@ make_subroutine_type(void *lin_ctx, const char *subroutine_name)
t->sampled_type = GLSL_TYPE_VOID;
t->vector_elements = 1;
t->matrix_columns = 1;
t->name = linear_strdup(lin_ctx, subroutine_name);
t->name_id = (uintptr_t)linear_strdup(lin_ctx, subroutine_name);
return t;
}
@ -522,7 +522,7 @@ make_array_type(void *lin_ctx, const glsl_type *element_type, unsigned length,
memcpy(base + array_part, pos, element_part);
}
t->name = n;
t->name_id = (uintptr_t)n;
return t;
}

View file

@ -324,11 +324,11 @@ struct glsl_type {
unsigned length;
/**
* Name of the data type
* Identifier to the name of the data type
*
* Will never be \c NULL.
* Use glsl_get_type_name() to access the actual name.
*/
const char *name;
uintptr_t name_id;
/**
* Explicit array, matrix, or vector stride. This is used to communicate

View file

@ -31,7 +31,7 @@
const char *
glsl_get_type_name(const glsl_type *type)
{
return type->name;
return (const char *)type->name_id;
}
int