add RenderDocCapture to OpenGL quad, sphere, triangle integration tests

This commit is contained in:
2026-03-23 20:25:53 +08:00
parent 3af24bb1bc
commit df7764e972
3 changed files with 60 additions and 0 deletions

View File

@@ -20,6 +20,7 @@
#include "XCEngine/RHI/OpenGL/OpenGLScreenshot.h"
#include "XCEngine/Debug/Logger.h"
#include "XCEngine/Debug/ConsoleLogSink.h"
#include "XCEngine/Debug/RenderDocCapture.h"
#include "XCEngine/Containers/String.h"
#pragma comment(lib, "opengl32.lib")
@@ -164,12 +165,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
return -1;
}
RenderDocCapture::Get().Initialize(nullptr, hwnd);
RenderDocCapture::Get().SetCaptureFilePath(".\\sphere_frame30");
OpenGLDevice device;
if (!device.InitializeWithExistingWindow(hwnd)) {
Log("[ERROR] Failed to initialize OpenGL device");
return -1;
}
RenderDocCapture::Get().SetDevice(device.GetContext());
ShowWindow(hwnd, nShowCmd);
UpdateWindow(hwnd);
@@ -330,8 +336,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
commandList.DrawIndexed(PrimitiveType::Triangles, (uint32_t)indices.size(), 0, 0);
if (frameCount >= targetFrameCount - 1) {
if (RenderDocCapture::Get().BeginCapture("OpenGL_Sphere_Test")) {
Log("[INFO] RenderDoc capture started");
}
}
swapChain.Present(0, 0);
frameCount++;
if (frameCount >= targetFrameCount) {
if (RenderDocCapture::Get().EndCapture()) {
Log("[INFO] RenderDoc capture ended");
}
}
}
}
@@ -355,6 +373,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
swapChain.Shutdown();
device.Shutdown();
RenderDocCapture::Get().Shutdown();
Logger::Get().Shutdown();
Log("[INFO] OpenGL Sphere Test Finished");