From 48f1f20a9dc6bbb888f6c2b37f519e400232fbc9 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 24 Oct 2018 09:46:05 +0200 Subject: [PATCH] zink: detect presence of VK_KHR_maintenance1 Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_screen.c | 18 ++++++++++++++++++ src/gallium/drivers/zink/zink_screen.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 68b593c8d37..66cc6ef4490 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h index c79ddc18e4b..ab20a683f88 100644 --- a/src/gallium/drivers/zink/zink_screen.h +++ b/src/gallium/drivers/zink/zink_screen.h @@ -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; -- 2.30.2