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/RHI/OpenGL/OpenGLScreenshot.h"
|
||||||
#include "XCEngine/Debug/Logger.h"
|
#include "XCEngine/Debug/Logger.h"
|
||||||
#include "XCEngine/Debug/ConsoleLogSink.h"
|
#include "XCEngine/Debug/ConsoleLogSink.h"
|
||||||
|
#include "XCEngine/Debug/RenderDocCapture.h"
|
||||||
#include "XCEngine/Containers/String.h"
|
#include "XCEngine/Containers/String.h"
|
||||||
|
|
||||||
#pragma comment(lib, "opengl32.lib")
|
#pragma comment(lib, "opengl32.lib")
|
||||||
@@ -85,12 +86,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderDocCapture::Get().Initialize(nullptr, hwnd);
|
||||||
|
RenderDocCapture::Get().SetCaptureFilePath(".\\quad_frame30");
|
||||||
|
|
||||||
OpenGLDevice device;
|
OpenGLDevice device;
|
||||||
if (!device.InitializeWithExistingWindow(hwnd)) {
|
if (!device.InitializeWithExistingWindow(hwnd)) {
|
||||||
Log("[ERROR] Failed to initialize OpenGL device");
|
Log("[ERROR] Failed to initialize OpenGL device");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderDocCapture::Get().SetDevice(device.GetContext());
|
||||||
|
|
||||||
ShowWindow(hwnd, nShowCmd);
|
ShowWindow(hwnd, nShowCmd);
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
@@ -205,8 +211,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
|
|
||||||
commandList.Draw(PrimitiveType::TriangleStrip, 4, 0);
|
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);
|
swapChain.Present(0, 0);
|
||||||
frameCount++;
|
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();
|
swapChain.Shutdown();
|
||||||
device.Shutdown();
|
device.Shutdown();
|
||||||
|
|
||||||
|
RenderDocCapture::Get().Shutdown();
|
||||||
Logger::Get().Shutdown();
|
Logger::Get().Shutdown();
|
||||||
|
|
||||||
Log("[INFO] OpenGL Quad Test Finished");
|
Log("[INFO] OpenGL Quad Test Finished");
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "XCEngine/RHI/OpenGL/OpenGLScreenshot.h"
|
#include "XCEngine/RHI/OpenGL/OpenGLScreenshot.h"
|
||||||
#include "XCEngine/Debug/Logger.h"
|
#include "XCEngine/Debug/Logger.h"
|
||||||
#include "XCEngine/Debug/ConsoleLogSink.h"
|
#include "XCEngine/Debug/ConsoleLogSink.h"
|
||||||
|
#include "XCEngine/Debug/RenderDocCapture.h"
|
||||||
#include "XCEngine/Containers/String.h"
|
#include "XCEngine/Containers/String.h"
|
||||||
|
|
||||||
#pragma comment(lib, "opengl32.lib")
|
#pragma comment(lib, "opengl32.lib")
|
||||||
@@ -164,12 +165,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderDocCapture::Get().Initialize(nullptr, hwnd);
|
||||||
|
RenderDocCapture::Get().SetCaptureFilePath(".\\sphere_frame30");
|
||||||
|
|
||||||
OpenGLDevice device;
|
OpenGLDevice device;
|
||||||
if (!device.InitializeWithExistingWindow(hwnd)) {
|
if (!device.InitializeWithExistingWindow(hwnd)) {
|
||||||
Log("[ERROR] Failed to initialize OpenGL device");
|
Log("[ERROR] Failed to initialize OpenGL device");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderDocCapture::Get().SetDevice(device.GetContext());
|
||||||
|
|
||||||
ShowWindow(hwnd, nShowCmd);
|
ShowWindow(hwnd, nShowCmd);
|
||||||
UpdateWindow(hwnd);
|
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);
|
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);
|
swapChain.Present(0, 0);
|
||||||
frameCount++;
|
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();
|
swapChain.Shutdown();
|
||||||
device.Shutdown();
|
device.Shutdown();
|
||||||
|
|
||||||
|
RenderDocCapture::Get().Shutdown();
|
||||||
Logger::Get().Shutdown();
|
Logger::Get().Shutdown();
|
||||||
|
|
||||||
Log("[INFO] OpenGL Sphere Test Finished");
|
Log("[INFO] OpenGL Sphere Test Finished");
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "XCEngine/RHI/OpenGL/OpenGLScreenshot.h"
|
#include "XCEngine/RHI/OpenGL/OpenGLScreenshot.h"
|
||||||
#include "XCEngine/Debug/Logger.h"
|
#include "XCEngine/Debug/Logger.h"
|
||||||
#include "XCEngine/Debug/ConsoleLogSink.h"
|
#include "XCEngine/Debug/ConsoleLogSink.h"
|
||||||
|
#include "XCEngine/Debug/RenderDocCapture.h"
|
||||||
#include "XCEngine/Containers/String.h"
|
#include "XCEngine/Containers/String.h"
|
||||||
|
|
||||||
#pragma comment(lib, "opengl32.lib")
|
#pragma comment(lib, "opengl32.lib")
|
||||||
@@ -81,12 +82,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderDocCapture::Get().Initialize(nullptr, hwnd);
|
||||||
|
RenderDocCapture::Get().SetCaptureFilePath(".\\triangle_frame30");
|
||||||
|
|
||||||
OpenGLDevice device;
|
OpenGLDevice device;
|
||||||
if (!device.InitializeWithExistingWindow(hwnd)) {
|
if (!device.InitializeWithExistingWindow(hwnd)) {
|
||||||
Log("[ERROR] Failed to initialize OpenGL device");
|
Log("[ERROR] Failed to initialize OpenGL device");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderDocCapture::Get().SetDevice(device.GetContext());
|
||||||
|
|
||||||
ShowWindow(hwnd, nShowCmd);
|
ShowWindow(hwnd, nShowCmd);
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
@@ -179,8 +185,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||||||
vertexArray.Bind();
|
vertexArray.Bind();
|
||||||
commandList.Draw(PrimitiveType::Triangles, 3, 0);
|
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);
|
swapChain.Present(0, 0);
|
||||||
frameCount++;
|
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();
|
swapChain.Shutdown();
|
||||||
device.Shutdown();
|
device.Shutdown();
|
||||||
|
|
||||||
|
RenderDocCapture::Get().Shutdown();
|
||||||
Logger::Get().Shutdown();
|
Logger::Get().Shutdown();
|
||||||
|
|
||||||
Log("[INFO] OpenGL Triangle Test Finished");
|
Log("[INFO] OpenGL Triangle Test Finished");
|
||||||
|
|||||||
Reference in New Issue
Block a user