glsl_type: Add a C wrapper to get struct field offsets

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:
Jason Ekstrand 2018-12-18 10:30:23 -06:00 committed by Jason Ekstrand
parent d34f19feba
commit d8a11bfc08
2 changed files with 10 additions and 0 deletions

View file

@ -65,6 +65,13 @@ glsl_get_struct_field(const glsl_type *type, unsigned index)
return type->fields.structure[index].type;
}
const int
glsl_get_struct_field_offset(const struct glsl_type *type,
unsigned index)
{
return type->fields.structure[index].offset;
}
const glsl_type *
glsl_get_function_return_type(const glsl_type *type)
{

View file

@ -46,6 +46,9 @@ const char *glsl_get_type_name(const struct glsl_type *type);
const struct glsl_type *glsl_get_struct_field(const struct glsl_type *type,
unsigned index);
const int glsl_get_struct_field_offset(const struct glsl_type *type,
unsigned index);
const struct glsl_type *glsl_get_array_element(const struct glsl_type *type);
const struct glsl_type *glsl_without_array(const struct glsl_type *type);
const struct glsl_type *glsl_without_array_or_matrix(const struct glsl_type *type);