From cdbc8a8c85fff0bb2cabb384cf3f310f42fca1be Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 10 Jun 2022 00:21:55 -0700 Subject: [PATCH] spirv: Add a dst/src type to image deref loads/stores coming from OpAtomic{Load,Store} nir_to_dxil() uses those types to pick the right operation overload, and atomic loads/stores are no different from their non-atomic counterpart apart from the atomicity property, so it makes sense to pass a type to the deref_{load,store} intrinsic in that case too. Suggested-by: Jesse Natalie Reviewed-by: Jesse Natalie Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/spirv/spirv_to_nir.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index ca2e92ab148..177acd5dede 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -3504,11 +3504,9 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode, */ intrin->src[4] = nir_src_for_ssa(image.lod); - if (opcode == SpvOpImageWrite) { - nir_alu_type src_type = - get_image_type(b, nir_get_nir_type_for_glsl_type(value->type), operands); - nir_intrinsic_set_src_type(intrin, src_type); - } + nir_alu_type src_type = + get_image_type(b, nir_get_nir_type_for_glsl_type(value->type), operands); + nir_intrinsic_set_src_type(intrin, src_type); break; } @@ -3592,7 +3590,8 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode, vtn_push_nir_ssa(b, w[2], result); } - if (opcode == SpvOpImageRead || opcode == SpvOpImageSparseRead) { + if (opcode == SpvOpImageRead || opcode == SpvOpImageSparseRead || + opcode == SpvOpAtomicLoad) { nir_alu_type dest_type = get_image_type(b, nir_get_nir_type_for_glsl_type(type->type), operands); nir_intrinsic_set_dest_type(intrin, dest_type);