anv: Enable SPV_KHR_16bit_storage and VK_KHR_16bit_storage for SSBO/UBO
authorAlejandro Piñeiro <apinheiro@igalia.com>
Sat, 1 Jul 2017 06:32:17 +0000 (08:32 +0200)
committerJose Maria Casanova Crespo <jmcasanova@igalia.com>
Wed, 6 Dec 2017 07:57:18 +0000 (08:57 +0100)
Enables SPV_KHR_16bit_storage on gen 8+.

VK_KHR_16bit_storage is enabled for SSBO/UBO using the
VK_KHR_get_physical_device_properties2 functionality to expose
if the extension is supported or not.

v2: update due rebase against master (Alejandro)
v3: (Jason Ekstrand)
    - Move this patch up in VK_KHR_16bit_storage series enabling only
      storageBuffer16BitAccess and uniformAndStorageBuffer16BitAccess.
    - Only expose VK_KHR_16bit_storage on Gen8+
v4: (Jason Ekstrand)
    - Squash enable SPV_KHR_16bit_storage into VK_KHR_16bit_storage
      enablement for SSBO/UBO.

Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_extensions.py
src/intel/vulkan/anv_pipeline.c

index 2e85189e88b9c035192f488d47f1704ad0ea0259..67f0d4a055da68e5f2f054e0b4da33222bfb66be 100644 (file)
@@ -739,6 +739,19 @@ void anv_GetPhysicalDeviceFeatures2KHR(
          break;
       }
 
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR: {
+         ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice);
+
+         VkPhysicalDevice16BitStorageFeaturesKHR *features =
+            (VkPhysicalDevice16BitStorageFeaturesKHR *)ext;
+
+         features->storageBuffer16BitAccess = pdevice->info.gen >= 8;
+         features->uniformAndStorageBuffer16BitAccess = pdevice->info.gen >= 8;
+         features->storagePushConstant16 = false;
+         features->storageInputOutput16 = false;
+         break;
+      }
+
       default:
          anv_debug_ignored_stype(ext->sType);
          break;
index 093c89fef01d35da73c51e7dfa1ef23e379efdc6..3cdf6c173a861354ee0447da5bdbaa5e9f41c2ac 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'),
+    Extension('VK_KHR_16bit_storage',                     1, 'device->info.gen >= 8'),
     Extension('VK_KHR_bind_memory2',                      1, True),
     Extension('VK_KHR_dedicated_allocation',              1, True),
     Extension('VK_KHR_descriptor_update_template',        1, True),
index bd9c5526563a271b71c172c3c4e9e14f41a54faa..cf2079db4e2d3f5c6218096f2fd07d10dbc1a40a 100644 (file)
@@ -142,6 +142,7 @@ anv_shader_compile_to_nir(struct anv_pipeline *pipeline,
          .image_write_without_format = true,
          .multiview = true,
          .variable_pointers = true,
+         .storage_16bit = device->instance->physicalDevice.info.gen >= 8,
       },
    };