add RenderDocCapture to OpenGL quad, sphere, triangle integration tests
This commit is contained in:
@@ -19,6 +19,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")
|
||||
@@ -85,12 +86,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
return -1;
|
||||
}
|
||||
|
||||
RenderDocCapture::Get().Initialize(nullptr, hwnd);
|
||||
RenderDocCapture::Get().SetCaptureFilePath(".\\quad_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);
|
||||
|
||||
@@ -205,8 +211,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
|
||||
commandList.Draw(PrimitiveType::TriangleStrip, 4, 0);
|
||||
|
||||
if (frameCount >= targetFrameCount - 1) {
|
||||
if (RenderDocCapture::Get().BeginCapture("OpenGL_Quad_Test")) {
|
||||
Log("[INFO] RenderDoc capture started");
|
||||
}
|
||||
}
|
||||
|
||||
swapChain.Present(0, 0);
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
if (RenderDocCapture::Get().EndCapture()) {
|
||||
Log("[INFO] RenderDoc capture ended");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,6 +240,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
|
||||
swapChain.Shutdown();
|
||||
device.Shutdown();
|
||||
|
||||
RenderDocCapture::Get().Shutdown();
|
||||
Logger::Get().Shutdown();
|
||||
|
||||
Log("[INFO] OpenGL Quad Test Finished");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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