vtn: create cast with type stride.
authorDave Airlie <airlied@redhat.com>
Mon, 27 May 2019 01:07:52 +0000 (11:07 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 30 May 2019 23:57:45 +0000 (09:57 +1000)
When creating function parameters, we create pointers from ssa
values, this creates nir casts with stride 0, however we have
no where else to get this value from. Later passes to lower
explicit io need this stride value to do the right thing.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
src/compiler/spirv/vtn_variables.c

index 1e888bb8bbee149140c39ea7372120cb7d95de93..ee76230768c40ae241aa9b6a4cef29eaccbed4e2 100644 (file)
@@ -1945,7 +1945,7 @@ vtn_pointer_from_ssa(struct vtn_builder *b, nir_ssa_def *ssa,
       const struct glsl_type *deref_type = ptr_type->deref->type;
       if (!vtn_pointer_is_external_block(b, ptr)) {
          ptr->deref = nir_build_deref_cast(&b->nb, ssa, nir_mode,
-                                           deref_type, 0);
+                                           deref_type, ptr_type->stride);
       } else if (vtn_type_contains_block(b, ptr->type) &&
                  ptr->mode != vtn_variable_mode_phys_ssbo) {
          /* This is a pointer to somewhere in an array of blocks, not a