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