add RenderDocCapture to D3D12 quad, sphere, triangle integration tests

- Add RenderDocCapture include
- Initialize RenderDocCapture before D3D12 device creation
- SetDevice after D3D12 device initialization
- TriggerCapture on frame 29 before Present
- Add RenderDocCapture::Get().Shutdown() on exit
This commit is contained in:
2026-03-23 20:14:28 +08:00
parent 79422cfddd
commit 6f6bb13da4
3 changed files with 39 additions and 6 deletions

View File

@@ -28,6 +28,7 @@
#include "XCEngine/Debug/Logger.h"
#include "XCEngine/Debug/ConsoleLogSink.h"
#include "XCEngine/Debug/FileLogSink.h"
#include "XCEngine/Debug/RenderDocCapture.h"
#include "XCEngine/Containers/String.h"
#include "third_party/stb/stb_image.h"
@@ -352,11 +353,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
return -1;
}
RenderDocCapture::Get().Initialize(nullptr, gHWND);
RenderDocCapture::Get().SetCaptureFilePath(".\\quad_frame30");
if (!InitD3D12()) {
Log("[ERROR] Failed to initialize D3D12");
return -1;
}
RenderDocCapture::Get().SetDevice(gDevice.GetDevice());
ShowWindow(gHWND, nShowCmd);
UpdateWindow(gHWND);
@@ -394,9 +400,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
frameCount++;
if (frameCount >= targetFrameCount) {
ExecuteCommandList();
Log("[INFO] Reached target frame count %d - taking screenshot!", targetFrameCount);
WaitForGPU();
bool screenshotResult = D3D12Screenshot::Capture(
gDevice,
gCommandQueue,
@@ -411,6 +416,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
break;
}
if (frameCount == targetFrameCount - 1) {
RenderDocCapture::Get().TriggerCapture();
Log("[INFO] RenderDoc capture triggered");
}
EndRender();
ExecuteCommandList();
gSwapChain.Present(0, 0);
@@ -422,6 +432,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
gSwapChain.Shutdown();
gDevice.Shutdown();
RenderDocCapture::Get().Shutdown();
Logger::Get().Shutdown();
Log("[INFO] D3D12 Quad Test Finished");