spirv/vtn: handle variable pointers without offset lowering
authorDave Airlie <airlied@redhat.com>
Wed, 4 Jul 2018 06:21:49 +0000 (16:21 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 19 Nov 2018 19:36:16 +0000 (05:36 +1000)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/spirv_to_nir.c
src/compiler/spirv/vtn_variables.c

index 4fa02b6fd7b21a35bd0fe727d655c5d28af0a9cb..a05c4d236cad935d675ece3ccc27478d72b14105 100644 (file)
@@ -1224,17 +1224,18 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
          val->type->type = glsl_uint_type();
       }
 
-      if (storage_class == SpvStorageClassWorkgroup &&
-          b->options->lower_workgroup_access_to_offsets) {
-         uint32_t size, align;
-         val->type->deref = vtn_type_layout_std430(b, val->type->deref,
-                                                   &size, &align);
-         val->type->length = size;
-         val->type->align = align;
+      if (storage_class == SpvStorageClassWorkgroup) {
          /* These can actually be stored to nir_variables and used as SSA
           * values so they need a real glsl_type.
           */
          val->type->type = glsl_uint_type();
+         if (b->options->lower_workgroup_access_to_offsets) {
+            uint32_t size, align;
+            val->type->deref = vtn_type_layout_std430(b, val->type->deref,
+                                                      &size, &align);
+            val->type->length = size;
+            val->type->align = align;
+         }
       }
       break;
    }
index 53f52255dc371e7ff79e696460ea56e34972e9dc..55721fc36e38f0e76da15a98be901abebb3d5680 100644 (file)
@@ -1650,7 +1650,8 @@ vtn_pointer_from_ssa(struct vtn_builder *b, nir_ssa_def *ssa,
       vtn_assert(ssa->num_components == 2);
       ptr->block_index = nir_channel(&b->nb, ssa, 0);
       ptr->offset = nir_channel(&b->nb, ssa, 1);
-   } else if (ptr->mode == vtn_variable_mode_workgroup ||
+   } else if ((ptr->mode == vtn_variable_mode_workgroup &&
+               b->options->lower_workgroup_access_to_offsets) ||
               ptr->mode == vtn_variable_mode_push_constant) {
       /* This pointer type needs to have actual storage */
       vtn_assert(ptr_type->type);