Fix RHI swap chain queue binding and restore minimal GT checks

This commit is contained in:
2026-03-25 21:50:57 +08:00
parent 8f76564ded
commit 30b5f93157
13 changed files with 127 additions and 74 deletions

View File

@@ -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;
}