summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/VKMain.cpp
diff options
context:
space:
mode:
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");