Mesa (master): compiler/types: Add a C wrapper to get full struct field data

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 15 01:50:35 UTC 2019


Module: Mesa
Branch: master
Commit: 5b2b1445660e260122773acea1c3b2032149d453
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b2b1445660e260122773acea1c3b2032149d453

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Sun Mar 10 21:43:37 2019 -0500

compiler/types: Add a C wrapper to get full struct field data

Reviewed-by: Kristian H. Kristensen <hoegsberg at chromium.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>

---

 src/compiler/nir_types.cpp | 8 ++++++++
 src/compiler/nir_types.h   | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
index 31c463bda46..9101d49ffbb 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -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)
 {
diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h
index 0c4bd4d1dbb..4d8aada5f27 100644
--- a/src/compiler/nir_types.h
+++ b/src/compiler/nir_types.h
@@ -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);




More information about the mesa-commit mailing list