revert: restore BeginCapture/EndCapture instead of TriggerCapture
TriggerCapture caused incomplete rdc files due to async file writing. BeginCapture/EndCapture ensures synchronous file write on EndCapture.
This commit is contained in:
@@ -279,11 +279,34 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
ExecuteCommandList();
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
RenderDocCapture::Get().TriggerCapture();
|
||||
Log("[INFO] RenderDoc capture triggered");
|
||||
if (RenderDocCapture::Get().EndCapture()) {
|
||||
Log("[INFO] RenderDoc capture ended");
|
||||
}
|
||||
WaitForGPU();
|
||||
Log("[INFO] GPU idle, taking screenshot...");
|
||||
bool screenshotResult = D3D12Screenshot::Capture(
|
||||
gDevice,
|
||||
gCommandQueue,
|
||||
gSwapChain.GetBackBuffer(gCurrentRTIndex),
|
||||
"minimal.ppm"
|
||||
);
|
||||
if (screenshotResult) {
|
||||
Log("[INFO] Screenshot saved to minimal.ppm");
|
||||
} else {
|
||||
Log("[ERROR] Screenshot failed");
|
||||
}
|
||||
Log("[INFO] RenderDoc capture completed");
|
||||
break;
|
||||
}
|
||||
|
||||
// Present
|
||||
if (frameCount == targetFrameCount - 1) {
|
||||
if (RenderDocCapture::Get().BeginCapture("D3D12_Minimal_Test")) {
|
||||
Log("[INFO] RenderDoc capture started");
|
||||
}
|
||||
}
|
||||
|
||||
EndRender();
|
||||
ExecuteCommandList();
|
||||
gSwapChain.Present(0, 0);
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
|
||||
@@ -400,6 +400,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
if (RenderDocCapture::Get().EndCapture()) {
|
||||
Log("[INFO] RenderDoc capture ended");
|
||||
}
|
||||
Log("[INFO] Reached target frame count %d - taking screenshot!", targetFrameCount);
|
||||
WaitForGPU();
|
||||
bool screenshotResult = D3D12Screenshot::Capture(
|
||||
@@ -417,8 +420,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
}
|
||||
|
||||
if (frameCount == targetFrameCount - 1) {
|
||||
RenderDocCapture::Get().TriggerCapture();
|
||||
Log("[INFO] RenderDoc capture triggered");
|
||||
if (RenderDocCapture::Get().BeginCapture("D3D12_Quad_Test")) {
|
||||
Log("[INFO] RenderDoc capture started");
|
||||
}
|
||||
}
|
||||
|
||||
EndRender();
|
||||
|
||||
@@ -492,6 +492,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
if (RenderDocCapture::Get().EndCapture()) {
|
||||
Log("[INFO] RenderDoc capture ended");
|
||||
}
|
||||
Log("[INFO] Reached target frame count %d - taking screenshot!", targetFrameCount);
|
||||
WaitForGPU();
|
||||
bool screenshotResult = D3D12Screenshot::Capture(
|
||||
@@ -509,8 +512,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
}
|
||||
|
||||
if (frameCount == targetFrameCount - 1) {
|
||||
RenderDocCapture::Get().TriggerCapture();
|
||||
Log("[INFO] RenderDoc capture triggered");
|
||||
if (RenderDocCapture::Get().BeginCapture("D3D12_Sphere_Test")) {
|
||||
Log("[INFO] RenderDoc capture started");
|
||||
}
|
||||
}
|
||||
|
||||
EndRender();
|
||||
|
||||
@@ -330,6 +330,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
if (RenderDocCapture::Get().EndCapture()) {
|
||||
Log("[INFO] RenderDoc capture ended");
|
||||
}
|
||||
Log("[INFO] Reached target frame count %d - taking screenshot!", targetFrameCount);
|
||||
WaitForGPU();
|
||||
Log("[INFO] GPU idle, taking screenshot...");
|
||||
@@ -348,8 +351,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
}
|
||||
|
||||
if (frameCount == targetFrameCount - 1) {
|
||||
RenderDocCapture::Get().TriggerCapture();
|
||||
Log("[INFO] RenderDoc capture triggered");
|
||||
if (RenderDocCapture::Get().BeginCapture("D3D12_Triangle_Test")) {
|
||||
Log("[INFO] RenderDoc capture started");
|
||||
}
|
||||
}
|
||||
|
||||
EndRender();
|
||||
|
||||
@@ -131,14 +131,18 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
commandList.Clear(1.0f, 0.0f, 0.0f, 1.0f, 1 | 2);
|
||||
|
||||
if (frameCount >= targetFrameCount - 1) {
|
||||
RenderDocCapture::Get().TriggerCapture();
|
||||
Log("[INFO] RenderDoc capture triggered");
|
||||
if (RenderDocCapture::Get().BeginCapture("OpenGL_Minimal_Test")) {
|
||||
Log("[INFO] RenderDoc capture started");
|
||||
}
|
||||
}
|
||||
|
||||
swapChain.Present(0, 0);
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
if (RenderDocCapture::Get().EndCapture()) {
|
||||
Log("[INFO] RenderDoc capture ended");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user