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 <jenatali@microsoft.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16926>
This commit is contained in:
Boris Brezillon
2022-06-10 00:21:55 -07:00
committed by Marge Bot
parent b78d3ebe72
commit cdbc8a8c85

View File

@@ -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);