spirv: Add support for SPV_EXT_shader_atomic_float_min_max
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8750>
This commit is contained in:

committed by
Marge Bot

parent
1ba9c262fd
commit
a572471edc
@@ -45,9 +45,12 @@ struct spirv_supported_capabilities {
|
||||
bool descriptor_indexing;
|
||||
bool device_group;
|
||||
bool draw_parameters;
|
||||
bool float16_atomic_min_max;
|
||||
bool float32_atomic_add;
|
||||
bool float32_atomic_min_max;
|
||||
bool float64;
|
||||
bool float64_atomic_add;
|
||||
bool float64_atomic_min_max;
|
||||
bool fragment_shader_sample_interlock;
|
||||
bool fragment_shader_pixel_interlock;
|
||||
bool fragment_shading_rate;
|
||||
|
@@ -3045,6 +3045,8 @@ fill_common_atomic_sources(struct vtn_builder *b, SpvOp opcode,
|
||||
case SpvOpAtomicOr:
|
||||
case SpvOpAtomicXor:
|
||||
case SpvOpAtomicFAddEXT:
|
||||
case SpvOpAtomicFMinEXT:
|
||||
case SpvOpAtomicFMaxEXT:
|
||||
src[0] = nir_src_for_ssa(vtn_get_nir_ssa(b, w[6]));
|
||||
break;
|
||||
|
||||
@@ -3119,6 +3121,8 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
|
||||
case SpvOpAtomicOr:
|
||||
case SpvOpAtomicXor:
|
||||
case SpvOpAtomicFAddEXT:
|
||||
case SpvOpAtomicFMinEXT:
|
||||
case SpvOpAtomicFMaxEXT:
|
||||
res_val = vtn_value(b, w[3], vtn_value_type_image_pointer);
|
||||
image = *res_val->image;
|
||||
scope = vtn_constant_uint(b, w[4]);
|
||||
@@ -3272,6 +3276,8 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
|
||||
OP(AtomicOr, atomic_or)
|
||||
OP(AtomicXor, atomic_xor)
|
||||
OP(AtomicFAddEXT, atomic_fadd)
|
||||
OP(AtomicFMinEXT, atomic_fmin)
|
||||
OP(AtomicFMaxEXT, atomic_fmax)
|
||||
OP(ImageQueryFormat, format)
|
||||
OP(ImageQueryOrder, order)
|
||||
#undef OP
|
||||
@@ -3370,6 +3376,8 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
|
||||
case SpvOpAtomicOr:
|
||||
case SpvOpAtomicXor:
|
||||
case SpvOpAtomicFAddEXT:
|
||||
case SpvOpAtomicFMinEXT:
|
||||
case SpvOpAtomicFMaxEXT:
|
||||
fill_common_atomic_sources(b, opcode, w, &intrin->src[3]);
|
||||
break;
|
||||
|
||||
@@ -3488,6 +3496,8 @@ get_deref_nir_atomic_op(struct vtn_builder *b, SpvOp opcode)
|
||||
OP(AtomicOr, atomic_or)
|
||||
OP(AtomicXor, atomic_xor)
|
||||
OP(AtomicFAddEXT, atomic_fadd)
|
||||
OP(AtomicFMinEXT, atomic_fmin)
|
||||
OP(AtomicFMaxEXT, atomic_fmax)
|
||||
#undef OP
|
||||
default:
|
||||
vtn_fail_with_opcode("Invalid shared atomic", opcode);
|
||||
@@ -3525,6 +3535,8 @@ vtn_handle_atomics(struct vtn_builder *b, SpvOp opcode,
|
||||
case SpvOpAtomicOr:
|
||||
case SpvOpAtomicXor:
|
||||
case SpvOpAtomicFAddEXT:
|
||||
case SpvOpAtomicFMinEXT:
|
||||
case SpvOpAtomicFMaxEXT:
|
||||
ptr = vtn_value(b, w[3], vtn_value_type_pointer)->pointer;
|
||||
scope = vtn_constant_uint(b, w[4]);
|
||||
semantics = vtn_constant_uint(b, w[5]);
|
||||
@@ -3618,6 +3630,8 @@ vtn_handle_atomics(struct vtn_builder *b, SpvOp opcode,
|
||||
case SpvOpAtomicOr:
|
||||
case SpvOpAtomicXor:
|
||||
case SpvOpAtomicFAddEXT:
|
||||
case SpvOpAtomicFMinEXT:
|
||||
case SpvOpAtomicFMaxEXT:
|
||||
fill_common_atomic_sources(b, opcode, w, &atomic->src[1]);
|
||||
break;
|
||||
|
||||
@@ -4572,6 +4586,18 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
||||
spv_check_supported(storage_16bit, cap);
|
||||
break;
|
||||
|
||||
case SpvCapabilityAtomicFloat16MinMaxEXT:
|
||||
spv_check_supported(float16_atomic_min_max, cap);
|
||||
break;
|
||||
|
||||
case SpvCapabilityAtomicFloat32MinMaxEXT:
|
||||
spv_check_supported(float32_atomic_min_max, cap);
|
||||
break;
|
||||
|
||||
case SpvCapabilityAtomicFloat64MinMaxEXT:
|
||||
spv_check_supported(float64_atomic_min_max, cap);
|
||||
break;
|
||||
|
||||
default:
|
||||
vtn_fail("Unhandled capability: %s (%u)",
|
||||
spirv_capability_to_string(cap), cap);
|
||||
@@ -5379,7 +5405,9 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
|
||||
case SpvOpAtomicAnd:
|
||||
case SpvOpAtomicOr:
|
||||
case SpvOpAtomicXor:
|
||||
case SpvOpAtomicFAddEXT: {
|
||||
case SpvOpAtomicFAddEXT:
|
||||
case SpvOpAtomicFMinEXT:
|
||||
case SpvOpAtomicFMaxEXT: {
|
||||
struct vtn_value *pointer = vtn_untyped_value(b, w[3]);
|
||||
if (pointer->value_type == vtn_value_type_image_pointer) {
|
||||
vtn_handle_image(b, opcode, w, count);
|
||||
|
Reference in New Issue
Block a user