diff options
| author | Connor McLaughlin <stenzek@gmail.com> | 2019-03-30 00:35:40 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-30 00:35:40 +1000 |
| commit | 914aa7c506507c731e3df4e841d1af31d9ba2e69 (patch) | |
| tree | 6b9bc5805aaf17c68950bcbeeaf95a7e70fdc18b /Source/Core/VideoBackends/Vulkan/VulkanContext.cpp | |
| parent | 377615b06fd61717edb39b51964e611fd2da8cdc (diff) | |
| parent | b685a66753c980f2c6e69aa277d33b20e9490d15 (diff) | |
Merge pull request #7943 from stenzek/vulkan-android-library-load
Vulkan: Fix library load failure on Android
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/VulkanContext.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/VulkanContext.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp index 52038e39dc..72f3cf79b0 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp @@ -100,6 +100,19 @@ VkInstance VulkanContext::CreateVulkanInstance(WindowSystemType wstype, bool ena app_info.engineVersion = VK_MAKE_VERSION(5, 0, 0); app_info.apiVersion = VK_MAKE_VERSION(1, 0, 0); + // Try for Vulkan 1.1 if the loader supports it. + if (vkEnumerateInstanceVersion) + { + u32 supported_api_version = 0; + VkResult res = vkEnumerateInstanceVersion(&supported_api_version); + if (res == VK_SUCCESS && (VK_VERSION_MAJOR(supported_api_version) > 1 || + VK_VERSION_MINOR(supported_api_version) >= 1)) + { + // The device itself may not support 1.1, so we check that before using any 1.1 functionality. + app_info.apiVersion = VK_MAKE_VERSION(1, 1, 0); + } + } + VkInstanceCreateInfo instance_create_info = {}; instance_create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; instance_create_info.pNext = nullptr; @@ -868,9 +881,13 @@ void VulkanContext::InitDriverDetails() void VulkanContext::PopulateShaderSubgroupSupport() { - // If this function isn't available, we don't support Vulkan 1.1. - if (!vkGetPhysicalDeviceProperties2) + // Vulkan 1.1 support is required for vkGetPhysicalDeviceProperties2(), but we can't rely on the + // function pointer alone. + if (!vkGetPhysicalDeviceProperties2 || (VK_VERSION_MAJOR(m_device_properties.apiVersion) == 1 && + VK_VERSION_MINOR(m_device_properties.apiVersion) < 1)) + { return; + } VkPhysicalDeviceProperties2 device_properties_2 = {}; device_properties_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; |
