compiler/types: Add a C wrapper to get full struct field data
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 11 Mar 2019 02:43:37 +0000 (21:43 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Fri, 15 Mar 2019 01:02:19 +0000 (01:02 +0000)
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/compiler/nir_types.cpp
src/compiler/nir_types.h

index 31c463b..9101d49 100644 (file)
@@ -78,6 +78,14 @@ glsl_get_struct_field_offset(const struct glsl_type *type,
    return type->fields.structure[index].offset;
 }
 
+const struct glsl_struct_field *
+glsl_get_struct_field_data(const struct glsl_type *type, unsigned index)
+{
+   assert(type->is_struct() || type->is_interface());
+   assert(index < type->length);
+   return &type->fields.structure[index];
+}
+
 unsigned
 glsl_get_explicit_stride(const struct glsl_type *type)
 {
index 0c4bd4d..4d8aada 100644 (file)
@@ -49,6 +49,9 @@ const struct glsl_type *glsl_get_struct_field(const struct glsl_type *type,
 int glsl_get_struct_field_offset(const struct glsl_type *type,
                                  unsigned index);
 
+const struct glsl_struct_field *
+glsl_get_struct_field_data(const struct glsl_type *type, unsigned index);
+
 unsigned glsl_get_explicit_stride(const struct glsl_type *type);
 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);