Module: Mesa Branch: main Commit: cdbc8a8c85fff0bb2cabb384cf3f310f42fca1be URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cdbc8a8c85fff0bb2cabb384cf3f310f42fca1be
Author: Boris Brezillon <[email protected]> Date: Fri Jun 10 00:21:55 2022 -0700 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 <[email protected]> Reviewed-by: Jesse Natalie <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16926> --- 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);
