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:
@@ -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");
|
||||
|
||||
@@ -30,6 +30,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 "XCEngine/Math/Matrix4.h"
|
||||
#include "XCEngine/Math/Vector3.h"
|
||||
@@ -440,11 +441,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
return -1;
|
||||
}
|
||||
|
||||
RenderDocCapture::Get().Initialize(nullptr, gHWND);
|
||||
RenderDocCapture::Get().SetCaptureFilePath(".\\sphere_frame30");
|
||||
|
||||
if (!InitD3D12()) {
|
||||
Log("[ERROR] Failed to initialize D3D12");
|
||||
return -1;
|
||||
}
|
||||
|
||||
RenderDocCapture::Get().SetDevice(gDevice.GetDevice());
|
||||
|
||||
ShowWindow(gHWND, nShowCmd);
|
||||
UpdateWindow(gHWND);
|
||||
|
||||
@@ -486,9 +492,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,
|
||||
@@ -503,6 +508,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);
|
||||
@@ -514,6 +524,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
gSwapChain.Shutdown();
|
||||
gDevice.Shutdown();
|
||||
|
||||
RenderDocCapture::Get().Shutdown();
|
||||
Logger::Get().Shutdown();
|
||||
|
||||
Log("[INFO] D3D12 Sphere Test Finished");
|
||||
|
||||
@@ -27,6 +27,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"
|
||||
|
||||
using namespace XCEngine::RHI;
|
||||
@@ -286,11 +287,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
return -1;
|
||||
}
|
||||
|
||||
RenderDocCapture::Get().Initialize(nullptr, gHWND);
|
||||
RenderDocCapture::Get().SetCaptureFilePath(".\\triangle_frame30");
|
||||
|
||||
if (!InitD3D12()) {
|
||||
MessageBox(NULL, L"Failed to initialize D3D12", L"Error", MB_OK);
|
||||
return -1;
|
||||
}
|
||||
|
||||
RenderDocCapture::Get().SetDevice(gDevice.GetDevice());
|
||||
|
||||
ShowWindow(gHWND, nShowCmd);
|
||||
UpdateWindow(gHWND);
|
||||
|
||||
@@ -324,8 +330,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
Log("[INFO] Reached target frame count %d - taking screenshot before present!", targetFrameCount);
|
||||
ExecuteCommandList();
|
||||
Log("[INFO] Reached target frame count %d - taking screenshot!", targetFrameCount);
|
||||
WaitForGPU();
|
||||
Log("[INFO] GPU idle, taking screenshot...");
|
||||
bool screenshotResult = D3D12Screenshot::Capture(
|
||||
@@ -342,6 +347,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);
|
||||
@@ -353,6 +363,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
gSwapChain.Shutdown();
|
||||
gDevice.Shutdown();
|
||||
|
||||
RenderDocCapture::Get().Shutdown();
|
||||
Logger::Get().Shutdown();
|
||||
|
||||
Log("[INFO] D3D12 Triangle Test Finished");
|
||||
|
||||
Reference in New Issue
Block a user