From 6c1108d25b46ddf7789b2c9f9f7b0a79b3e279a0 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 20 Jul 2020 18:38:17 +0200 Subject: [PATCH] radv: advertise VK_EXT_shader_atomic_float MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit No hw support for float atomic add for buffer and (sparse) images. Signed-off-by: Samuel Pitoiset Reviewed-by: Daniel Schürmann Part-of: --- src/amd/vulkan/radv_device.c | 18 ++++++++++++++++++ src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_formats.c | 4 +++- src/amd/vulkan/radv_shader.c | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index b9969e4e5eb..c474c78eb21 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1340,6 +1340,24 @@ void radv_GetPhysicalDeviceFeatures2( features->robustImageAccess = true; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT: { + VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *features = + (VkPhysicalDeviceShaderAtomicFloatFeaturesEXT *)ext; + features->shaderBufferFloat32Atomics = true; + features->shaderBufferFloat32AtomicAdd = false; + features->shaderBufferFloat64Atomics = true; + features->shaderBufferFloat64AtomicAdd = false; + features->shaderSharedFloat32Atomics = true; + features->shaderSharedFloat32AtomicAdd = pdevice->rad_info.chip_class >= GFX8 && + (!pdevice->use_llvm || LLVM_VERSION_MAJOR >= 10); + features->shaderSharedFloat64Atomics = true; + features->shaderSharedFloat64AtomicAdd = false; + features->shaderImageFloat32Atomics = true; + features->shaderImageFloat32AtomicAdd = false; + features->sparseImageFloat32Atomics = false; + features->sparseImageFloat32AtomicAdd = false; + break; + } default: break; } diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 90b5ef41e83..2a3e995e309 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -153,6 +153,7 @@ EXTENSIONS = [ Extension('VK_EXT_sample_locations', 1, 'device->rad_info.chip_class < GFX10'), Extension('VK_EXT_sampler_filter_minmax', 1, True), Extension('VK_EXT_scalar_block_layout', 1, 'device->rad_info.chip_class >= GFX7'), + Extension('VK_EXT_shader_atomic_float', 1, True), Extension('VK_EXT_shader_demote_to_helper_invocation',1, 'LLVM_VERSION_MAJOR >= 9 || !device->use_llvm'), Extension('VK_EXT_shader_viewport_index_layer', 1, True), Extension('VK_EXT_shader_stencil_export', 1, True), diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c index 2e753f47be8..9360fb31bcc 100644 --- a/src/amd/vulkan/radv_formats.c +++ b/src/amd/vulkan/radv_formats.c @@ -749,7 +749,9 @@ radv_physical_device_get_format_properties(struct radv_physical_device *physical VK_FORMAT_FEATURE_TRANSFER_DST_BIT; } - if (format == VK_FORMAT_R32_UINT || format == VK_FORMAT_R32_SINT) { + if (format == VK_FORMAT_R32_UINT || + format == VK_FORMAT_R32_SINT || + format == VK_FORMAT_R32_SFLOAT) { buffer |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT; linear |= VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT; tiled |= VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT; diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 072201fe66b..3af15d4e844 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -377,6 +377,7 @@ radv_shader_compile_to_nir(struct radv_device *device, .draw_parameters = true, .float_controls = true, .float16 = device->physical_device->rad_info.has_packed_math_16bit, + .float32_atomic_add = true, .float64 = true, .geometry_streams = true, .image_ms_array = true, -- 2.30.2