[PATCH 03/10] winex11: Implement vk_icdNegotiateLoaderICDInterfaceVersion

Roderick Colenbrander <[email protected]>
Newsgroups gmane.comp.emulators.wine.patches
Message-ID <[email protected]>
Signed-off-by: Roderick Colenbrander <[email protected]>
---
 dlls/winex11.drv/vulkan.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index 936e5620d2..f58bad9c5a 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -27,6 +27,14 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
 
+/* For now default to 3 as it felt like a reasonable version feature wise to support.
+ * Version 4 requires us to implement vk_icdGetPhysicalDeviceProcAddr, which I didn't
+ * want to deal with just yet. It also added some more detailed API version check
+ * requirements. Version 5 builds further on this. Something to tackle later.
+ */
+#define WINE_VULKAN_ICD_VERSION 3
+
+
 void* WINAPI X11DRV_vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName)
 {
     FIXME("stub: %p, %s\n", instance, pName ? pName : "NULL");
@@ -35,8 +43,20 @@ void* WINAPI X11DRV_vk_icdGetInstanceProcAddr(VkInstance instance, const char* p
 
 VkResult WINAPI X11DRV_vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion)
 {
-    FIXME("stub: %p\n", pSupportedVersion);
-    return VK_INCOMPLETE;
+    uint32_t req_version;
+    TRACE("%p\n", pSupportedVersion);
+
+    /* The spec is not clear how to handle this. Mesa drivers don't check, but it
+     * is probably best to not explode. VK_INCOMPLETE seems to be the closest value.
+     */
+    if (!pSupportedVersion)
+        return VK_INCOMPLETE;
+
+    req_version = *pSupportedVersion;
+    *pSupportedVersion = min(req_version, WINE_VULKAN_ICD_VERSION);
+    TRACE("Loader requested ICD version=%d, retuning %d\n", req_version, *pSupportedVersion);
+
+    return VK_SUCCESS;
 }
 
 #else /* No vulkan */
-- 
2.13.6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.