diff options
| author | 2021-01-16 20:25:51 -0300 | |
|---|---|---|
| committer | 2021-02-13 02:16:21 -0300 | |
| commit | 9735c34f5dfef58f0e673886f8f725f806178f1b (patch) | |
| tree | 5afedc0e2209210d9190b25a65290917728d37eb /src/video_core | |
| parent | vulkan_wrapper: Pull Windows symbols (diff) | |
| download | yuzu-9735c34f5dfef58f0e673886f8f725f806178f1b.tar.gz yuzu-9735c34f5dfef58f0e673886f8f725f806178f1b.tar.xz yuzu-9735c34f5dfef58f0e673886f8f725f806178f1b.zip | |
vulkan_instance: Initialize Vulkan instance in a separate thread
Workaround an issue on Nvidia where creating a Vulkan instance from an
active OpenGL thread disables threaded optimization on the driver.
This optimization is important to have good performance on Nvidia
OpenGL.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_instance.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/video_core/vulkan_common/vulkan_instance.cpp b/src/video_core/vulkan_common/vulkan_instance.cpp index 889ecda0c..bfd6e6add 100644 --- a/src/video_core/vulkan_common/vulkan_instance.cpp +++ b/src/video_core/vulkan_common/vulkan_instance.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <future> | ||
| 6 | #include <optional> | 7 | #include <optional> |
| 7 | #include <span> | 8 | #include <span> |
| 8 | #include <utility> | 9 | #include <utility> |
| @@ -140,7 +141,10 @@ vk::Instance CreateInstance(const Common::DynamicLibrary& library, vk::InstanceD | |||
| 140 | VK_VERSION_MAJOR(required_version), VK_VERSION_MINOR(required_version)); | 141 | VK_VERSION_MAJOR(required_version), VK_VERSION_MINOR(required_version)); |
| 141 | throw vk::Exception(VK_ERROR_INCOMPATIBLE_DRIVER); | 142 | throw vk::Exception(VK_ERROR_INCOMPATIBLE_DRIVER); |
| 142 | } | 143 | } |
| 143 | vk::Instance instance = vk::Instance::Create(required_version, layers, extensions, dld); | 144 | vk::Instance instance = |
| 145 | std::async([&] { | ||
| 146 | return vk::Instance::Create(required_version, layers, extensions, dld); | ||
| 147 | }).get(); | ||
| 144 | if (!vk::Load(*instance, dld)) { | 148 | if (!vk::Load(*instance, dld)) { |
| 145 | LOG_ERROR(Render_Vulkan, "Failed to load Vulkan instance function pointers"); | 149 | LOG_ERROR(Render_Vulkan, "Failed to load Vulkan instance function pointers"); |
| 146 | throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED); | 150 | throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED); |