diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index e0e37e2b289..6995a897d60 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -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) { diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h index e7ffad43ad0..6e671b4cc71 100644 --- a/src/compiler/nir_types.h +++ b/src/compiler/nir_types.h @@ -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);