summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/VKMain.cpp
diff options
context:
space:
mode:
authorMartino Fontana <tinozzo123@gmail.com>2025-07-14 15:52:55 +0200
committerMartino Fontana <tinozzo123@gmail.com>2025-07-21 16:02:53 +0200
commitb80e178403d895409b481132fb8d62b46bfd8391 (patch)
treeb0f71d7b899412b9cac739b55f500817e9b5ce73 /Source/Core/VideoBackends/Vulkan/VKMain.cpp
parent5cc0a5a3be68c77a7119fab15178f4fd2ab54c54 (diff)
Vulkan: Fix present semaphores reuse
Fixes validation errors. See https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/VKMain.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/VKMain.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/VKMain.cpp b/Source/Core/VideoBackends/Vulkan/VKMain.cpp
index e5ecd5a4de..6338e52e3d 100644
--- a/Source/Core/VideoBackends/Vulkan/VKMain.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VKMain.cpp
@@ -187,15 +187,6 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
UpdateActiveConfig();
- // Create command buffers. We do this separately because the other classes depend on it.
- g_command_buffer_mgr = std::make_unique<CommandBufferManager>(g_Config.bBackendMultithreading);
- if (!g_command_buffer_mgr->Initialize())
- {
- PanicAlertFmt("Failed to create Vulkan command buffers");
- Shutdown();
- return false;
- }
-
// Remaining classes are also dependent on object cache.
g_object_cache = std::make_unique<ObjectCache>();
if (!g_object_cache->Initialize())
@@ -218,6 +209,17 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
}
}
+ // Create command buffers. We do this separately because the other classes depend on it.
+ g_command_buffer_mgr = std::make_unique<CommandBufferManager>(g_Config.bBackendMultithreading);
+ size_t swapchain_image_count =
+ surface != VK_NULL_HANDLE ? swap_chain->GetSwapChainImageCount() : 0;
+ if (!g_command_buffer_mgr->Initialize(swapchain_image_count))
+ {
+ PanicAlertFmt("Failed to create Vulkan command buffers");
+ Shutdown();
+ return false;
+ }
+
if (!StateTracker::CreateInstance())
{
PanicAlertFmt("Failed to create state tracker");