[Mesa-dev] [PATCH 10/10] radv: Enable VK_EXT_descriptor_indexing.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Wed Apr 11 23:44:23 UTC 2018


This adds everything except non-uniform indexing, which needs a bit
more work and testing.
---
 src/amd/vulkan/radv_device.c      | 39 +++++++++++++++++++++++++++++++
 src/amd/vulkan/radv_extensions.py |  1 +
 src/amd/vulkan/radv_shader.c      |  2 ++
 3 files changed, 42 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index c81b69fef5c..bdbbfc162a2 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -735,6 +735,31 @@ void radv_GetPhysicalDeviceFeatures2(
 			features->samplerYcbcrConversion = false;
 			break;
 		}
+		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT: {
+			VkPhysicalDeviceDescriptorIndexingFeaturesEXT *features =
+				(VkPhysicalDeviceDescriptorIndexingFeaturesEXT*)features;
+			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->descriptorBindingUniformBufferUpdateAfterBind = true;
+			features->descriptorBindingSampledImageUpdateAfterBind = true;
+			features->descriptorBindingStorageImageUpdateAfterBind = true;
+			features->descriptorBindingStorageBufferUpdateAfterBind = true;
+			features->descriptorBindingUniformTexelBufferUpdateAfterBind = true;
+			features->descriptorBindingStorageTexelBufferUpdateAfterBind = true;
+			features->descriptorBindingUpdateUnusedWhilePending = true;
+			features->descriptorBindingPartiallyBound = true;
+			features->descriptorBindingVariableDescriptorCount = true;
+			features->runtimeDescriptorArray = true;
+			break;
+		}
 		default:
 			break;
 		}
@@ -1002,6 +1027,20 @@ void radv_GetPhysicalDeviceProperties2(
 			properties->vgprAllocationGranularity = 4;
 			break;
 		}
+		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT: {
+			VkPhysicalDeviceDescriptorIndexingPropertiesEXT *properties =
+				(VkPhysicalDeviceDescriptorIndexingPropertiesEXT*)ext;
+			properties->maxUpdateAfterBindDescriptorsInAllPools = UINT32_MAX;
+			properties->shaderUniformBufferArrayNonUniformIndexingNative = false;
+			properties->shaderSampledImageArrayNonUniformIndexingNative = false;
+			properties->shaderStorageBufferArrayNonUniformIndexingNative = false;
+			properties->shaderStorageImageArrayNonUniformIndexingNative = false;
+			properties->shaderInputAttachmentArrayNonUniformIndexingNative = false;
+			properties->robustBufferAccessUpdateAfterBind = false;
+			properties->quadDivergentImplicitLod = false;
+			/* TODO rest */
+			break;
+		}
 		default:
 			break;
 		}
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index a680f42dec7..3131a0ad417 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -87,6 +87,7 @@ EXTENSIONS = [
     Extension('VK_KHR_multiview',                         1, True),
     Extension('VK_EXT_debug_report',                      9, True),
     Extension('VK_EXT_depth_range_unrestricted',          1, True),
+    Extension('VK_EXT_descriptor_indexing',               2, True),
     Extension('VK_EXT_discard_rectangles',                1, True),
     Extension('VK_EXT_external_memory_dma_buf',           1, True),
     Extension('VK_EXT_external_memory_host',              1, 'device->rad_info.has_userptr'),
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index eaf24dcdee8..32d5f649e10 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -218,6 +218,8 @@ radv_shader_compile_to_nir(struct radv_device *device,
 				.gcn_shader = true,
 				.trinary_minmax = true,
 				.shader_viewport_index_layer = true,
+				.full_uniform_desciptor_indexing = true,
+				.runtime_descriptor_array = true,
 			},
 		};
 		entry_point = spirv_to_nir(spirv, module->size / 4,
-- 
2.17.0



More information about the mesa-dev mailing list