summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/spirv_to_nir.c
diff options
context:
space:
mode:
authorJuan A. Suarez Romero <[email protected]>2019-03-20 19:20:27 +0000
committerJuan A. Suarez Romero <[email protected]>2019-03-20 19:26:32 +0000
commitefcf9c9f9f01976ef19831fd05d4c48b080d0781 (patch)
treecf9c6588cb3df97a824f7b5131422283bda0b4f9 /src/compiler/spirv/spirv_to_nir.c
parent04189565a01afbecc179fb4945a80754ee6fcfb4 (diff)
nir: deref only for OpTypePointer
Fixes dEQP-VK.binding_model.buffer_device_address.* and dEQP-VK.ssbo.phys.layout* Vulkan CTS tests. v2: set val->type->stride in the section below (Jason) v3: restore val->type->type to original place (Jason) Fixes: d0ba326f238 ("nir/spirv: support physical pointers") CC: Karol Herbst <[email protected]> CC: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/spirv/spirv_to_nir.c')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 6d6aed287ac..ce3e0781afc 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1319,7 +1319,6 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
* declaration.
*/
val = vtn_untyped_value(b, w[1]);
- struct vtn_type *deref_type = vtn_untyped_value(b, w[3])->type;
SpvStorageClass storage_class = w[2];
@@ -1348,19 +1347,13 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
break;
case SpvStorageClassWorkgroup:
val->type->type = b->options->shared_ptr_type;
- if (b->physical_ptrs)
- val->type->stride = align(glsl_get_cl_size(deref_type->type), glsl_get_cl_alignment(deref_type->type));
break;
case SpvStorageClassCrossWorkgroup:
val->type->type = b->options->global_ptr_type;
- if (b->physical_ptrs)
- val->type->stride = align(glsl_get_cl_size(deref_type->type), glsl_get_cl_alignment(deref_type->type));
break;
case SpvStorageClassFunction:
- if (b->physical_ptrs) {
+ if (b->physical_ptrs)
val->type->type = b->options->temp_ptr_type;
- val->type->stride = align(glsl_get_cl_size(deref_type->type), glsl_get_cl_alignment(deref_type->type));
- }
break;
default:
/* In this case, no variable pointers are allowed so all deref
@@ -1386,6 +1379,19 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
vtn_foreach_decoration(b, val, array_stride_decoration_cb, NULL);
+ if (b->physical_ptrs) {
+ switch (storage_class) {
+ case SpvStorageClassFunction:
+ case SpvStorageClassWorkgroup:
+ case SpvStorageClassCrossWorkgroup:
+ val->type->stride = align(glsl_get_cl_size(val->type->deref->type),
+ glsl_get_cl_alignment(val->type->deref->type));
+ break;
+ default:
+ break;
+ }
+ }
+
if (storage_class == SpvStorageClassWorkgroup &&
b->options->lower_workgroup_access_to_offsets) {
uint32_t size, align;