From effc969ad329a92fc91373f0d9e259f3a212429d Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Mon, 23 Mar 2026 18:44:12 +0800 Subject: [PATCH] Update minimal tests to use improved RenderDocCapture API - OpenGL test: Use BeginCapture/EndCapture with bool return values - D3D12 test: Use BeginCapture/EndCapture with bool return values - Both tests: Use GetCapture() to log capture file info - Added capture file path and size logging after capture --- tests/RHI/D3D12/integration/minimal/main.cpp | 19 +++++++++++++--- tests/RHI/OpenGL/integration/minimal/main.cpp | 22 ++++++++++++++----- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/tests/RHI/D3D12/integration/minimal/main.cpp b/tests/RHI/D3D12/integration/minimal/main.cpp index cf2c1743..4e7c8aa7 100644 --- a/tests/RHI/D3D12/integration/minimal/main.cpp +++ b/tests/RHI/D3D12/integration/minimal/main.cpp @@ -278,8 +278,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine frameCount++; if (frameCount >= targetFrameCount) { - Log("[INFO] Reached target frame count %d - ending capture and taking screenshot!", targetFrameCount); - RenderDocCapture::Get().EndCapture(); + if (RenderDocCapture::Get().EndCapture()) { + Log("[INFO] RenderDoc capture ended, NumCaptures: %u", RenderDocCapture::Get().GetNumCaptures()); + if (RenderDocCapture::Get().GetNumCaptures() > 0) { + RenderDocCaptureInfo info; + if (RenderDocCapture::Get().GetCapture(0, &info)) { + Log("[INFO] Capture file: %s (%u bytes)", info.filename, info.length); + } + } + } else { + Log("[ERROR] Failed to end RenderDoc capture"); + } ExecuteCommandList(); WaitForGPU(); Log("[INFO] GPU idle, taking screenshot..."); @@ -299,7 +308,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine } if (frameCount == targetFrameCount - 1) { - RenderDocCapture::Get().BeginCapture("Minimal_Test_Frame30"); + if (RenderDocCapture::Get().BeginCapture("D3D12_Minimal_Test")) { + Log("[INFO] RenderDoc capture started at frame %d", frameCount + 1); + } else { + Log("[ERROR] Failed to start RenderDoc capture"); + } } EndRender(); diff --git a/tests/RHI/OpenGL/integration/minimal/main.cpp b/tests/RHI/OpenGL/integration/minimal/main.cpp index f73d6347..bf61cae3 100644 --- a/tests/RHI/OpenGL/integration/minimal/main.cpp +++ b/tests/RHI/OpenGL/integration/minimal/main.cpp @@ -133,10 +133,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine DispatchMessageW(&msg); } else { if (frameCount == targetFrameCount - 1) { - Log("[INFO] Starting RenderDoc capture at frame %d", frameCount + 1); wglMakeCurrent(device.GetDC(), device.GetContext()); - RenderDocCapture::Get().BeginCapture("OpenGL_Minimal_Test"); - Log("[INFO] IsCapturing after BeginCapture: %s", RenderDocCapture::Get().IsCapturing() ? "true" : "false"); + if (RenderDocCapture::Get().BeginCapture("OpenGL_Minimal_Test")) { + Log("[INFO] RenderDoc capture started at frame %d", frameCount + 1); + } else { + Log("[ERROR] Failed to start RenderDoc capture"); + } } // Set viewport and clear color using encapsulated command list @@ -148,9 +150,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine frameCount++; if (frameCount >= targetFrameCount) { - Log("[INFO] Ending RenderDoc capture at frame %d", frameCount); - RenderDocCapture::Get().EndCapture(); - Log("[INFO] NumCaptures: %u", RenderDocCapture::Get().GetNumCaptures()); + if (RenderDocCapture::Get().EndCapture()) { + Log("[INFO] RenderDoc capture ended, NumCaptures: %u", RenderDocCapture::Get().GetNumCaptures()); + if (RenderDocCapture::Get().GetNumCaptures() > 0) { + RenderDocCaptureInfo info; + if (RenderDocCapture::Get().GetCapture(0, &info)) { + Log("[INFO] Capture file: %s (%u bytes)", info.filename, info.length); + } + } + } else { + Log("[ERROR] Failed to end RenderDoc capture"); + } } } }