diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp index 11fe6fa89a..27798af94b 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp @@ -514,6 +514,8 @@ std::unique_ptr VulkanContext::Create(VkInstance instance, VkPhys { std::unique_ptr context = std::make_unique(instance, gpu); + context->m_instance_api_version = vk_api_version; + // Initialize DriverDetails so that we can check for bugs to disable features if needed. context->InitDriverDetails(); context->PopulateShaderSubgroupSupport(); @@ -523,8 +525,7 @@ std::unique_ptr VulkanContext::Create(VkInstance instance, VkPhys context->EnableDebugUtils(); // Attempt to create the device. - if (!context->CreateDevice(surface, enable_validation_layer) || - !context->CreateAllocator(vk_api_version)) + if (!context->CreateDevice(surface, enable_validation_layer) || !context->CreateAllocator()) { // Since we are destroying the instance, we're also responsible for destroying the surface. if (surface != VK_NULL_HANDLE) @@ -776,7 +777,7 @@ bool VulkanContext::CreateDevice(VkSurfaceKHR surface, bool enable_validation_la return true; } -bool VulkanContext::CreateAllocator(u32 vk_api_version) +bool VulkanContext::CreateAllocator() { VmaAllocatorCreateInfo allocator_info = {}; allocator_info.flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT; @@ -788,7 +789,7 @@ bool VulkanContext::CreateAllocator(u32 vk_api_version) allocator_info.pHeapSizeLimit = nullptr; allocator_info.pVulkanFunctions = nullptr; allocator_info.instance = m_instance; - allocator_info.vulkanApiVersion = vk_api_version; + allocator_info.vulkanApiVersion = m_instance_api_version; allocator_info.pTypeExternalMemoryHandleTypes = nullptr; if (SupportsDeviceExtension(VK_EXT_MEMORY_BUDGET_EXTENSION_NAME)) diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.h b/Source/Core/VideoBackends/Vulkan/VulkanContext.h index 17b1459aa6..2ea37e2131 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.h +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.h @@ -122,9 +122,10 @@ private: bool CreateDevice(VkSurfaceKHR surface, bool enable_validation_layer); void InitDriverDetails(); void PopulateShaderSubgroupSupport(); - bool CreateAllocator(u32 vk_api_version); + bool CreateAllocator(); VkInstance m_instance = VK_NULL_HANDLE; + u32 m_instance_api_version = 0; VkPhysicalDevice m_physical_device = VK_NULL_HANDLE; VkDevice m_device = VK_NULL_HANDLE; VmaAllocator m_allocator = VK_NULL_HANDLE;