[Mesa-dev] [PATCH 8/8] radv: enable VK_KHR_16bit_storage extension / 16bit storage features

Daniel Schürmann daniel.schuermann at campus.tu-berlin.de
Thu Jul 19 12:48:22 UTC 2018


Signed-off-by: Daniel Schürmann <daniel.schuermann at campus.tu-berlin.de>
---
 src/amd/vulkan/radv_device.c      | 10 ++++++----
 src/amd/vulkan/radv_extensions.py |  1 +
 src/amd/vulkan/radv_shader.c      |  1 +
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 80ddb65480..34159bcc5b 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -740,6 +740,7 @@ void radv_GetPhysicalDeviceFeatures2(
 	VkPhysicalDevice                            physicalDevice,
 	VkPhysicalDeviceFeatures2KHR               *pFeatures)
 {
+	RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
 	vk_foreach_struct(ext, pFeatures->pNext) {
 		switch (ext->sType) {
 		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR: {
@@ -770,10 +771,11 @@ void radv_GetPhysicalDeviceFeatures2(
 		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: {
 			VkPhysicalDevice16BitStorageFeatures *features =
 			    (VkPhysicalDevice16BitStorageFeatures*)ext;
-			features->storageBuffer16BitAccess = false;
-			features->uniformAndStorageBuffer16BitAccess = false;
-			features->storagePushConstant16 = false;
-			features->storageInputOutput16 = false;
+			bool enabled = HAVE_LLVM >= 0x0700 && pdevice->rad_info.chip_class >= VI;
+			features->storageBuffer16BitAccess = enabled;
+			features->uniformAndStorageBuffer16BitAccess = enabled;
+			features->storagePushConstant16 = enabled;
+			features->storageInputOutput16 = enabled;
 			break;
 		}
 		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: {
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index a5fbffac33..15d29becfd 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -51,6 +51,7 @@ class Extension:
 # and dEQP-VK.api.info.device fail due to the duplicated strings.
 EXTENSIONS = [
     Extension('VK_ANDROID_native_buffer',                 5, 'ANDROID && device->rad_info.has_syncobj_wait_for_submit'),
+    Extension('VK_KHR_16bit_storage',                     1, 'HAVE_LLVM >= 0x0700'),
     Extension('VK_KHR_bind_memory2',                      1, True),
     Extension('VK_KHR_create_renderpass2',                1, True),
     Extension('VK_KHR_dedicated_allocation',              1, True),
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index aac5b8a21a..634e35e1d9 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -224,6 +224,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
 				.descriptor_array_dynamic_indexing = true,
 				.runtime_descriptor_array = true,
 				.stencil_export = true,
+				.storage_16bit = true,
 			},
 		};
 		entry_point = spirv_to_nir(spirv, module->size / 4,
-- 
2.17.1



More information about the mesa-dev mailing list