radv: add VK_NV_compute_shader_derivates support
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 19 Apr 2019 10:40:37 +0000 (12:40 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 22 Apr 2019 12:51:57 +0000 (14:51 +0200)
Only computeDerivativeGroupLinear is supported for now.

All crucible tests pass.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_extensions.py
src/amd/vulkan/radv_shader.c

index 774ee5b91dfcecb29209cf49f8b1a1822355be24..a31860eabf4bab55efcc6cc36586295ebfe50fc0 100644 (file)
@@ -927,6 +927,13 @@ void radv_GetPhysicalDeviceFeatures2(
                        features->descriptorBindingInlineUniformBlockUpdateAfterBind = true;
                        break;
                }
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV: {
+                       VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *features =
+                               (VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *)ext;
+                       features->computeDerivativeGroupQuads = false;
+                       features->computeDerivativeGroupLinear = true;
+                       break;
+               }
                default:
                        break;
                }
index 40fc585c503b05099244df456172b441846bf247..9743ce1a774bfa8c2811d8cd4200e218978dad47 100644 (file)
@@ -133,6 +133,7 @@ EXTENSIONS = [
     Extension('VK_AMD_shader_trinary_minmax',             1, True),
     Extension('VK_GOOGLE_decorate_string',                1, True),
     Extension('VK_GOOGLE_hlsl_functionality1',            1, True),
+    Extension('VK_NV_compute_shader_derivatives',         1, 'device->rad_info.chip_class >= VI'),
 ]
 
 class VkVersion:
index c802abb0e081837e4048b22c9e5bd214078a60c3..13f1f9aa9dc9fcf4ec39f1ac462886cc7470bfe5 100644 (file)
@@ -223,6 +223,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
                const struct spirv_to_nir_options spirv_options = {
                        .lower_ubo_ssbo_access_to_offsets = true,
                        .caps = {
+                               .derivative_group = true,
                                .descriptor_array_dynamic_indexing = true,
                                .device_group = true,
                                .draw_parameters = true,