radv: Add non-uniform indexing lowering.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 7 Apr 2019 21:57:58 +0000 (23:57 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 10 Apr 2019 00:04:13 +0000 (02:04 +0200)
This patch does it as late as possible so the potential extra
basic blocks don't inhibit other optimizations.

Big thanks to Jason for writing the lowering pass.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_pipeline.c

index 5baf6aad58d6bb6ad1ba250b011e09d88170fdcb..dacaac173aeecaa0c912a351166d33c152751f37 100644 (file)
@@ -817,13 +817,13 @@ void radv_GetPhysicalDeviceFeatures2(
                        features->shaderInputAttachmentArrayDynamicIndexing = true;
                        features->shaderUniformTexelBufferArrayDynamicIndexing = true;
                        features->shaderStorageTexelBufferArrayDynamicIndexing = true;
-                       features->shaderUniformBufferArrayNonUniformIndexing = false;
-                       features->shaderSampledImageArrayNonUniformIndexing = false;
-                       features->shaderStorageBufferArrayNonUniformIndexing = false;
-                       features->shaderStorageImageArrayNonUniformIndexing = false;
-                       features->shaderInputAttachmentArrayNonUniformIndexing = false;
-                       features->shaderUniformTexelBufferArrayNonUniformIndexing = false;
-                       features->shaderStorageTexelBufferArrayNonUniformIndexing = false;
+                       features->shaderUniformBufferArrayNonUniformIndexing = true;
+                       features->shaderSampledImageArrayNonUniformIndexing = true;
+                       features->shaderStorageBufferArrayNonUniformIndexing = true;
+                       features->shaderStorageImageArrayNonUniformIndexing = true;
+                       features->shaderInputAttachmentArrayNonUniformIndexing = true;
+                       features->shaderUniformTexelBufferArrayNonUniformIndexing = true;
+                       features->shaderStorageTexelBufferArrayNonUniformIndexing = true;
                        features->descriptorBindingUniformBufferUpdateAfterBind = true;
                        features->descriptorBindingSampledImageUpdateAfterBind = true;
                        features->descriptorBindingStorageImageUpdateAfterBind = true;
index d96ae9a42239f0629eacc13e7c77c15e8747a55f..619b5a506adcd2e32becef849f9ddec5cdc7c7f2 100644 (file)
@@ -2178,6 +2178,11 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
        for (int i = 0; i < MESA_SHADER_STAGES; ++i) {
                if (nir[i]) {
                        NIR_PASS_V(nir[i], nir_lower_bool_to_int32);
+                       NIR_PASS_V(nir[i], nir_lower_non_uniform_access,
+                                          nir_lower_non_uniform_ubo_access |
+                                          nir_lower_non_uniform_ssbo_access |
+                                          nir_lower_non_uniform_texture_access |
+                                          nir_lower_non_uniform_image_access);
                }
 
                if (radv_can_dump_shader(device, modules[i], false))