diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index ce83bf02635..e52fdde10c4 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -1051,7 +1051,7 @@ radv_physical_device_get_features(const struct radv_physical_device *pdev, struc .depthClipEnable = true, /* VK_KHR_compute_shader_derivatives */ - .computeDerivativeGroupQuads = pdev->info.gfx_level >= GFX12, + .computeDerivativeGroupQuads = true, .computeDerivativeGroupLinear = true, /* VK_EXT_ycbcr_image_arrays */ diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 8d598ebefc4..07f9391cbd8 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -628,6 +628,17 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_shader_st NIR_PASS(_, nir, nir_lower_view_index_to_device_index); NIR_PASS(_, nir, nir_lower_system_values); + + if (pdev->info.gfx_level < GFX12 && nir->info.derivative_group == DERIVATIVE_GROUP_QUADS) { + nir_lower_compute_system_values_options csv_options = { + .shuffle_local_ids_for_quad_derivatives = true, + .lower_local_invocation_index = true, + }; + + NIR_PASS(_, nir, nir_opt_cse); /* CSE load_local_invocation_id */ + NIR_PASS(_, nir, nir_lower_compute_system_values, &csv_options); + } + nir_lower_compute_system_values_options csv_options = { /* Mesh shaders run as NGG which can implement local_invocation_index from * the wave ID in merged_wave_info, but they don't have local_invocation_ids on GFX10.3.