add RenderDocCapture to OpenGL quad, sphere, triangle integration tests
This commit is contained in:
@@ -15,6 +15,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")
|
||||
@@ -81,12 +82,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
return -1;
|
||||
}
|
||||
|
||||
RenderDocCapture::Get().Initialize(nullptr, hwnd);
|
||||
RenderDocCapture::Get().SetCaptureFilePath(".\\triangle_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);
|
||||
|
||||
@@ -179,8 +185,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
vertexArray.Bind();
|
||||
commandList.Draw(PrimitiveType::Triangles, 3, 0);
|
||||
|
||||
if (frameCount >= targetFrameCount - 1) {
|
||||
if (RenderDocCapture::Get().BeginCapture("OpenGL_Triangle_Test")) {
|
||||
Log("[INFO] RenderDoc capture started");
|
||||
}
|
||||
}
|
||||
|
||||
swapChain.Present(0, 0);
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
if (RenderDocCapture::Get().EndCapture()) {
|
||||
Log("[INFO] RenderDoc capture ended");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,6 +212,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
|
||||
swapChain.Shutdown();
|
||||
device.Shutdown();
|
||||
|
||||
RenderDocCapture::Get().Shutdown();
|
||||
Logger::Get().Shutdown();
|
||||
|
||||
Log("[INFO] OpenGL Triangle Test Finished");
|
||||
|
||||
Reference in New Issue
Block a user