zink: detect presence of VK_KHR_maintenance1
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 24 Oct 2018 07:46:05 +0000 (09:46 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:43 +0000 (08:51 +0000)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/zink_screen.c
src/gallium/drivers/zink/zink_screen.h

index 68b593c8d375021d5ebcaa788939ebf19757be16..66cc6ef4490602532d9577ac435050b382e6a969 100644 (file)
@@ -705,6 +705,24 @@ zink_create_screen(struct sw_winsys *winsys)
    vkGetPhysicalDeviceFeatures(screen->pdev, &screen->feats);
    vkGetPhysicalDeviceMemoryProperties(screen->pdev, &screen->mem_props);
 
+   uint32_t num_extensions = 0;
+   if (vkEnumerateDeviceExtensionProperties(screen->pdev, NULL,
+       &num_extensions, NULL) == VK_SUCCESS && num_extensions > 0) {
+      VkExtensionProperties *extensions = MALLOC(sizeof(VkExtensionProperties) *
+                                                num_extensions);
+      if (extensions) {
+         vkEnumerateDeviceExtensionProperties(screen->pdev, NULL,
+                                              &num_extensions, extensions);
+
+         for (uint32_t  i = 0; i < num_extensions; ++i) {
+            if (!strcmp(extensions[i].extensionName,
+                VK_KHR_MAINTENANCE1_EXTENSION_NAME))
+               screen->have_VK_KHR_maintenance1 = true;
+         }
+         FREE(extensions);
+      }
+   }
+
    VkDeviceQueueCreateInfo qci = {};
    float dummy = 0.0f;
    qci.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
index c79ddc18e4b1181a29ddc9c9f03c5ad72fb9f1d9..ab20a683f88f842085bcbf3510efb39674cfd02a 100644 (file)
@@ -44,9 +44,11 @@ struct zink_screen {
 
    VkInstance instance;
    VkPhysicalDevice pdev;
+
    VkPhysicalDeviceProperties props;
    VkPhysicalDeviceFeatures feats;
    VkPhysicalDeviceMemoryProperties mem_props;
+   bool have_VK_KHR_maintenance1;
 
    uint32_t gfx_queue;
    VkDevice dev;