diff options
Diffstat (limited to 'lib/mesa/src/compiler/nir/nir_deref.c')
-rw-r--r-- | lib/mesa/src/compiler/nir/nir_deref.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/mesa/src/compiler/nir/nir_deref.c b/lib/mesa/src/compiler/nir/nir_deref.c index e03be3ac6..c883d2229 100644 --- a/lib/mesa/src/compiler/nir/nir_deref.c +++ b/lib/mesa/src/compiler/nir/nir_deref.c @@ -1134,7 +1134,12 @@ opt_replace_struct_wrapper_cast(nir_builder *b, nir_deref_instr *cast) if (glsl_get_struct_field_offset(parent->type, 0) != 0) return false; - if (cast->type != glsl_get_struct_field(parent->type, 0)) + const struct glsl_type *field_type = glsl_get_struct_field(parent->type, 0); + if (cast->type != field_type) + return false; + + /* we can't drop the stride information */ + if (cast->cast.ptr_stride != glsl_get_explicit_stride(field_type)) return false; nir_deref_instr *replace = nir_build_deref_struct(b, parent, 0); |