From 190a574e399044bf57ec5fcdab65e704dbe3d6cc Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Thu, 27 Jul 2023 13:28:52 +0800 Subject: [PATCH] Use VK_EXT_headless_surface in wsi-none --- src/wsi/none/wsi_window_none.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/wsi/none/wsi_window_none.cpp b/src/wsi/none/wsi_window_none.cpp index aa11803a858..87a14af0aab 100644 --- a/src/wsi/none/wsi_window_none.cpp +++ b/src/wsi/none/wsi_window_none.cpp @@ -76,8 +76,16 @@ namespace dxvk::wsi { PFN_vkGetInstanceProcAddr pfnVkGetInstanceProcAddr, VkInstance instance, VkSurfaceKHR* pSurface) { - // TODO: Could use VK_EXT_headless_surface here? - return VK_ERROR_FEATURE_NOT_PRESENT; + auto pfnVkCreateHeadlessSurfaceEXT = reinterpret_cast( + pfnVkGetInstanceProcAddr(instance, "vkCreateHeadlessSurfaceEXT")); + + if (!pfnVkCreateHeadlessSurfaceEXT) + return VK_ERROR_FEATURE_NOT_PRESENT; + + VkHeadlessSurfaceCreateInfoEXT info = { VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT }; + info.pNext = nullptr; + info.flags = 0; + return pfnVkCreateHeadlessSurfaceEXT(instance, &info, nullptr, pSurface); } }