radv: enable VK_KHR_16bit_storage extension / 16bit storage features
authorDaniel Schürmann <daniel.schuermann@campus.tu-berlin.de>
Tue, 15 May 2018 15:10:12 +0000 (17:10 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 23 Jul 2018 21:16:26 +0000 (23:16 +0200)
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 7dc650833312a7f8ddfe2e97c399c7d9d0b1627d..f6cd6dd1131c005293fc687df26d8ec9a8b60ebd 100644 (file)
@@ -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: {
index a5fbffac33b22642fddfc5e81dee0b897d558a09..15d29becfd45118f483a73d99378d48204177583 100644 (file)
@@ -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),
index aac5b8a21a294d88256a299213f8ad759d22d553..634e35e1d9bdf9b18d25741d18b327f7d6300cb0 100644 (file)
@@ -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,