Fix RHI swap chain queue binding and restore minimal GT checks
This commit is contained in:
@@ -46,14 +46,11 @@ add_custom_command(TARGET rhi_integration_minimal POST_BUILD
|
||||
$<TARGET_FILE_DIR:rhi_integration_minimal>/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/minimal/GT.ppm
|
||||
$<TARGET_FILE_DIR:rhi_integration_minimal>/GT_D3D12.ppm
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_SOURCE_DIR}/tests/RHI/OpenGL/integration/minimal/GT.ppm
|
||||
$<TARGET_FILE_DIR:rhi_integration_minimal>/GT_OpenGL.ppm
|
||||
$<TARGET_FILE_DIR:rhi_integration_minimal>/GT.ppm
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${ENGINE_ROOT_DIR}/third_party/renderdoc/renderdoc.dll
|
||||
$<TARGET_FILE_DIR:rhi_integration_minimal>/
|
||||
)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(rhi_integration_minimal)
|
||||
gtest_discover_tests(rhi_integration_minimal)
|
||||
|
||||
@@ -19,6 +19,14 @@ protected:
|
||||
void RenderFrame() override;
|
||||
};
|
||||
|
||||
const char* GetScreenshotFilename(RHIType type) {
|
||||
return type == RHIType::D3D12 ? "minimal_d3d12.ppm" : "minimal_opengl.ppm";
|
||||
}
|
||||
|
||||
int GetComparisonThreshold(RHIType type) {
|
||||
return type == RHIType::OpenGL ? 5 : 0;
|
||||
}
|
||||
|
||||
void MinimalTest::RenderFrame() {
|
||||
RHICommandList* cmdList = GetCommandList();
|
||||
RHICommandQueue* cmdQueue = GetCommandQueue();
|
||||
@@ -55,6 +63,8 @@ TEST_P(MinimalTest, RenderClear) {
|
||||
RHICommandQueue* cmdQueue = GetCommandQueue();
|
||||
RHISwapChain* swapChain = GetSwapChain();
|
||||
const int targetFrameCount = 30;
|
||||
const char* screenshotFilename = GetScreenshotFilename(GetBackendType());
|
||||
const int comparisonThreshold = GetComparisonThreshold(GetBackendType());
|
||||
|
||||
for (int frameCount = 0; frameCount <= targetFrameCount; ++frameCount) {
|
||||
if (frameCount > 0) {
|
||||
@@ -67,8 +77,10 @@ TEST_P(MinimalTest, RenderClear) {
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
cmdQueue->WaitForIdle();
|
||||
Log("[TEST] MainLoop: frame %d reached, test complete", frameCount);
|
||||
// Screenshot temporarily disabled due to device state issue
|
||||
Log("[TEST] MainLoop: frame %d reached, capturing %s", frameCount, screenshotFilename);
|
||||
ASSERT_TRUE(TakeScreenshot(screenshotFilename));
|
||||
ASSERT_TRUE(CompareWithGoldenTemplate(screenshotFilename, "GT.ppm", static_cast<float>(comparisonThreshold)));
|
||||
Log("[TEST] MainLoop: frame %d compare passed", frameCount);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user