From: Juan A. Suarez Romero Date: Wed, 20 Mar 2019 19:20:27 +0000 (+0000) Subject: nir: deref only for OpTypePointer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=efcf9c9f9f01976ef19831fd05d4c48b080d0781;p=mesa.git 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 CC: Jason Ekstrand Reviewed-by: Jason Ekstrand --- 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;