summaryrefslogtreecommitdiff
path: root/lib/mesa/src/compiler/nir/nir_deref.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-04-06 10:16:13 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-04-06 10:16:13 +0000
commita0d742befadcae89d35a2e4a5d65a85c53c886a5 (patch)
tree06ace984c944de045af3cc77e84e3da0188f1456 /lib/mesa/src/compiler/nir/nir_deref.c
parentb96000c8a346b7a5b93cd0e557a59f759b81a9af (diff)
Import Mesa 22.3.7
Diffstat (limited to 'lib/mesa/src/compiler/nir/nir_deref.c')
-rw-r--r--lib/mesa/src/compiler/nir/nir_deref.c7
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);