cleanup: remove unused test scenes and update minimal RHI integration

This commit is contained in:
2026-03-23 19:07:44 +08:00
parent 257706eddd
commit 6a7be5c6fe
7 changed files with 28 additions and 60 deletions

View File

@@ -52,7 +52,7 @@ HMODULE gRenderDocModule = nullptr;
typedef int (RENDERDOC_CC* PFN_RENDERDOC_GetAPI)(int version, void** apiOut);
struct RENDERDOC_API_1_1_2
struct RENDERDOC_API_1_7_0
{
void (RENDERDOC_CC* GetAPIVersion)(int* major, int* minor, int* patch);
void (RENDERDOC_CC* SetCaptureOptionU32)(uint32_t opt, uint32_t val);
@@ -76,9 +76,16 @@ struct RENDERDOC_API_1_1_2
void (RENDERDOC_CC* StartFrameCapture)(void* device, void* window);
uint32_t (RENDERDOC_CC* IsFrameCapturing)();
void (RENDERDOC_CC* EndFrameCapture)(void* device, void* window);
void (RENDERDOC_CC* TriggerMultiFrameCapture)(uint32_t numFrames);
void (RENDERDOC_CC* SetCaptureFileComments)(const char* filePath, const char* comments);
uint32_t (RENDERDOC_CC* DiscardFrameCapture)(void* device, void* window);
uint32_t (RENDERDOC_CC* ShowReplayUI)();
void (RENDERDOC_CC* SetCaptureTitle)(const char* title);
void (RENDERDOC_CC* SetObjectAnnotation)(void* device, void* object, const char* key, int valueType, uint32_t valueVectorWidth, const void* value);
void (RENDERDOC_CC* SetCommandAnnotation)(void* device, void* queueOrCommandBuffer, const char* key, int valueType, uint32_t valueVectorWidth, const void* value);
};
RENDERDOC_API_1_1_2* gRenderDocAPI = nullptr;
RENDERDOC_API_1_7_0* gRenderDocAPI = nullptr;
D3D12Device gDevice;
D3D12CommandQueue gCommandQueue;
@@ -457,7 +464,7 @@ bool InitRenderDoc()
return false;
}
int apiVersion = 10102;
int apiVersion = 10700;
void* apiPtr = nullptr;
int ret = GetAPI(apiVersion, &apiPtr);
if (ret != 1 || !apiPtr)
@@ -467,7 +474,19 @@ bool InitRenderDoc()
return false;
}
gRenderDocAPI = (RENDERDOC_API_1_1_2*)apiPtr;
gRenderDocAPI = (RENDERDOC_API_1_7_0*)apiPtr;
gRenderDocAPI->SetCaptureOptionU32(2, 1);
Log("[INFO] RenderDoc API Validation enabled");
gRenderDocAPI->SetCaptureOptionU32(8, 1);
Log("[INFO] RenderDoc RefAllResources enabled");
gRenderDocAPI->SetCaptureOptionU32(9, 1);
Log("[INFO] RenderDoc SaveAllInitials enabled");
gRenderDocAPI->SetCaptureFilePathTemplate(".\\captures");
Log("[INFO] RenderDoc initialized successfully");
return true;
}
@@ -561,6 +580,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
if (frameCount == 5) {
Log("[INFO] Starting RenderDoc capture at frame %d", frameCount);
gRenderDocAPI->SetCaptureTitle("Sphere_DrawIndexed_Test");
gRenderDocAPI->SetCaptureFileComments(NULL, "Testing DrawIndexed with texture, Frame 5-6");
gRenderDocAPI->StartFrameCapture(gDevice.GetDevice(), nullptr);
}

Binary file not shown.

View File

@@ -1 +0,0 @@
---

View File

@@ -1,5 +0,0 @@
# XCEngine Scene File
scene=TestScene;
active=1;
gameobject=name=SavedObject;active=1;id=21;transform=position=1,2,3;rotation=0,0,0,1;scale=1,1,1;;

View File

@@ -1,6 +0,0 @@
# XCEngine Scene File
scene=TestScene;
active=1;
gameobject=name=Player;active=1;id=23;transform=position=0,0,0;rotation=0,0,0,1;scale=1,1,1;;
gameobject=name=Enemy;active=1;id=24;transform=position=0,0,0;rotation=0,0,0,1;scale=1,1,1;;

View File

@@ -39,6 +39,9 @@ add_custom_command(TARGET OpenGL_Minimal POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm
$<TARGET_FILE_DIR:OpenGL_Minimal>/
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${ENGINE_ROOT_DIR}/third_party/renderdoc/renderdoc.dll
$<TARGET_FILE_DIR:OpenGL_Minimal>/
)
add_test(NAME OpenGL_Minimal_Integration

View File

@@ -1,44 +0,0 @@
#pragma once
#include <gtest/gtest.h>
#include "XCEngine/RHI/RHIFactory.h"
#include "XCEngine/RHI/D3D12/D3D12Device.h"
using namespace XCEngine::RHI;
TEST(RHIFactory, CreateD3D12Device_ReturnsValidPointer) {
RHIDevice* device = RHIFactory::CreateRHIDevice(RHIType::D3D12);
ASSERT_NE(device, nullptr);
delete device;
}
TEST(RHIFactory, CreateD3D12DeviceByName_ReturnsValidPointer) {
RHIDevice* device = RHIFactory::CreateRHIDevice("D3D12");
ASSERT_NE(device, nullptr);
delete device;
}
TEST(RHIFactory, CreateInvalidDevice_ReturnsNullptr) {
RHIDevice* device = RHIFactory::CreateRHIDevice("InvalidAPI");
ASSERT_EQ(device, nullptr);
}
TEST(RHIFactory, CreateInvalidType_ReturnsNullptr) {
RHIDevice* device = RHIFactory::CreateRHIDevice(RHIType::Vulkan);
ASSERT_EQ(device, nullptr);
}
TEST(D3D12DeviceCreation, DirectCreation_Success) {
D3D12Device* device = new D3D12Device();
ASSERT_NE(device, nullptr);
delete device;
}