From 4c10e82cf815734d1f10cc8d220590b6a3248bb2 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 23 Nov 2021 23:50:37 +0000 Subject: [PATCH] Vulkan: discover Vulkan instance versions higher than 1.2 Previously we would only discover 1.0 or 1.1, meaning that extensions promoted to core in 1.2 wouldn't be properly discovered. Bug: chromium:1269882 Change-Id: I38bc211a3358158ba5eccd6b361e4b1173e047fd Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70640 Reviewed-by: Kai Ninomiya Reviewed-by: Austin Eng Commit-Queue: Austin Eng Auto-Submit: Corentin Wallez --- src/dawn_native/vulkan/BackendVk.cpp | 2 +- src/dawn_native/vulkan/VulkanInfo.cpp | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/dawn_native/vulkan/BackendVk.cpp b/src/dawn_native/vulkan/BackendVk.cpp index c9bcdcc494..484c246904 100644 --- a/src/dawn_native/vulkan/BackendVk.cpp +++ b/src/dawn_native/vulkan/BackendVk.cpp @@ -264,7 +264,7 @@ namespace dawn_native { namespace vulkan { // if the instance only supports Vulkan 1.0. Otherwise we set apiVersion to Vulkan 1.2, // treat 1.2 as the highest API version dawn targets. if (mGlobalInfo.apiVersion == VK_MAKE_VERSION(1, 0, 0)) { - appInfo.apiVersion = mGlobalInfo.apiVersion; + appInfo.apiVersion = VK_MAKE_VERSION(1, 0, 0); } else { appInfo.apiVersion = VK_MAKE_VERSION(1, 2, 0); } diff --git a/src/dawn_native/vulkan/VulkanInfo.cpp b/src/dawn_native/vulkan/VulkanInfo.cpp index 9ca7634c51..f5cbb4a1a9 100644 --- a/src/dawn_native/vulkan/VulkanInfo.cpp +++ b/src/dawn_native/vulkan/VulkanInfo.cpp @@ -67,15 +67,11 @@ namespace dawn_native { namespace vulkan { // Gather info on available API version { - uint32_t supportedAPIVersion = VK_MAKE_VERSION(1, 0, 0); - if (vkFunctions.EnumerateInstanceVersion) { - vkFunctions.EnumerateInstanceVersion(&supportedAPIVersion); + info.apiVersion = VK_MAKE_VERSION(1, 0, 0); + if (vkFunctions.EnumerateInstanceVersion != nullptr) { + DAWN_TRY(CheckVkSuccess(vkFunctions.EnumerateInstanceVersion(&info.apiVersion), + "vkEnumerateInstanceVersion")); } - - // Use Vulkan 1.1 if it's available. - info.apiVersion = (supportedAPIVersion >= VK_MAKE_VERSION(1, 1, 0)) - ? VK_MAKE_VERSION(1, 1, 0) - : VK_MAKE_VERSION(1, 0, 0); } // Gather the info about the instance layers