Module: Mesa
Branch: main
Commit: 15796bdd0efdf18e81618efdaac669acde4f2683
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=15796bdd0efdf18e81618efdaac669acde4f2683

Author: Jason Ekstrand <[email protected]>
Date:   Mon Oct 31 22:32:19 2022 -0500

nir/types: Add some asserts to glsl_get_struct_field()

Reviewed-by: Jesse Natalie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19430>

---

 src/compiler/nir_types.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
index 1391665ce77..65d8847c3ea 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -75,6 +75,8 @@ glsl_get_bare_type(const glsl_type *type)
 const glsl_type *
 glsl_get_struct_field(const glsl_type *type, unsigned index)
 {
+   assert(type->is_struct() || type->is_interface());
+   assert(index < type->length);
    return type->fields.structure[index].type;
 }
 

Reply via email to