From b7d66a09de3a4eb4aaae746d2563b351f25a4ffb Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Fri, 20 Mar 2026 02:49:19 +0800 Subject: [PATCH] fix: replace Sleep with proper fence synchronization in minimal test --- tests/RHI/D3D12/integration/main_minimal.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/RHI/D3D12/integration/main_minimal.cpp b/tests/RHI/D3D12/integration/main_minimal.cpp index a81f893e..c69b1d16 100644 --- a/tests/RHI/D3D12/integration/main_minimal.cpp +++ b/tests/RHI/D3D12/integration/main_minimal.cpp @@ -180,6 +180,7 @@ void ExecuteCommandList() { void* commandLists[] = { gCommandList.GetCommandList() }; gCommandQueue.ExecuteCommandLists(1, commandLists); gFenceValue += 1; + gCommandQueue.Signal(gFence.GetFence(), gFenceValue); } // Begin rendering @@ -274,6 +275,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine TranslateMessage(&msg); DispatchMessage(&msg); } else { + // Wait for previous frame to complete before resetting + if (frameCount > 0) { + gFence.Wait(gFenceValue); + } + // Reset command list for this frame gCommandAllocator.Reset(); gCommandList.Reset(); @@ -312,9 +318,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // Present gSwapChain.Present(0, 0); - - // Add small delay to prevent GPU overload - Sleep(10); } }