From 5c3d98a4e3c183742e32f5d024a19af523bb4b54 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Tue, 24 Dec 2024 19:33:04 +0300 Subject: [PATCH] Fix Vulkan validation errors. --- UnleashedRecomp/gpu/video.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index 17f80e8d..32b5bc5a 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -2211,6 +2211,20 @@ void Video::Present() g_swapChainValid = g_swapChain->present(g_backBufferIndex, signalSemaphores, std::size(signalSemaphores)); } + g_frame = g_nextFrame; + g_nextFrame = (g_frame + 1) % NUM_FRAMES; + + if (g_commandListStates[g_frame]) + { + g_queue->waitForCommandFence(g_commandFences[g_frame].get()); + g_commandListStates[g_frame] = false; + } + + g_dirtyStates = DirtyStates(true); + g_uploadAllocators[g_frame].reset(); + g_triangleFanIndexData.reset(); + g_quadIndexData.reset(); + CheckSwapChain(); cmd.type = RenderCommandType::BeginCommandList; @@ -2348,26 +2362,12 @@ static void ProcExecuteCommandList(const RenderCommand& cmd) g_commandListStates[g_frame] = true; - g_frame = g_nextFrame; - g_nextFrame = (g_frame + 1) % NUM_FRAMES; - - g_dirtyStates = DirtyStates(true); - g_uploadAllocators[g_frame].reset(); - g_triangleFanIndexData.reset(); - g_quadIndexData.reset(); - g_executedCommandList = true; g_executedCommandList.notify_one(); } static void ProcBeginCommandList(const RenderCommand& cmd) { - if (g_commandListStates[g_frame]) - { - g_queue->waitForCommandFence(g_commandFences[g_frame].get()); - g_commandListStates[g_frame] = false; - } - DestructTempResources(); BeginCommandList(); }