From 67e10246cb575860a9a3108ceeb805c7ff4cfcb8 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 7 Nov 2018 19:39:38 +0100 Subject: [PATCH] [dxvk] Request Vulkan 1.1 instance Falls back to a regular 1.0 instance on old drivers. We need to do this in order to legally use SPIR-V 1.3. --- src/dxvk/dxvk_instance.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/dxvk/dxvk_instance.cpp b/src/dxvk/dxvk_instance.cpp index 8a057457a..de8561a56 100644 --- a/src/dxvk/dxvk_instance.cpp +++ b/src/dxvk/dxvk_instance.cpp @@ -73,7 +73,7 @@ namespace dxvk { appInfo.applicationVersion = 0; appInfo.pEngineName = "DXVK"; appInfo.engineVersion = VK_MAKE_VERSION(0, 9, 2); - appInfo.apiVersion = 0; + appInfo.apiVersion = VK_MAKE_VERSION(1, 1, 0); VkInstanceCreateInfo info; info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; @@ -86,8 +86,17 @@ namespace dxvk { info.ppEnabledExtensionNames = extensionNameList.names(); VkInstance result = VK_NULL_HANDLE; - if (m_vkl->vkCreateInstance(&info, nullptr, &result) != VK_SUCCESS) + VkResult status = m_vkl->vkCreateInstance(&info, nullptr, &result); + + if (status == VK_ERROR_INCOMPATIBLE_DRIVER) { + Logger::warn("Failed to create Vulkan 1.1 instance, falling back to 1.0"); + appInfo.apiVersion = 0; /* some very old drivers may not accept 1.0 */ + status = m_vkl->vkCreateInstance(&info, nullptr, &result); + } + + if (status != VK_SUCCESS) throw DxvkError("DxvkInstance::createInstance: Failed to create Vulkan instance"); + return result; }