test: add vulkan renderer scene coverage

This commit is contained in:
2026-04-02 04:00:58 +08:00
parent 4c167bec0e
commit 7404108a4b
21 changed files with 258 additions and 14 deletions

View File

@@ -42,6 +42,7 @@ namespace {
constexpr const char* kD3D12Screenshot = "backpack_scene_d3d12.ppm";
constexpr const char* kOpenGLScreenshot = "backpack_scene_opengl.ppm";
constexpr const char* kVulkanScreenshot = "backpack_scene_vulkan.ppm";
constexpr uint32_t kFrameWidth = 1280;
constexpr uint32_t kFrameHeight = 720;
@@ -60,11 +61,19 @@ std::filesystem::path ResolveRuntimePath(const char* relativePath) {
}
const char* GetScreenshotFilename(RHIType backendType) {
return backendType == RHIType::D3D12 ? kD3D12Screenshot : kOpenGLScreenshot;
switch (backendType) {
case RHIType::D3D12:
return kD3D12Screenshot;
case RHIType::Vulkan:
return kVulkanScreenshot;
case RHIType::OpenGL:
default:
return kOpenGLScreenshot;
}
}
int GetComparisonThreshold(RHIType backendType) {
return backendType == RHIType::OpenGL ? 8 : 8;
return backendType == RHIType::D3D12 ? 8 : 8;
}
class BackpackSceneTest : public RHIIntegrationFixture {
@@ -302,6 +311,9 @@ TEST_P(BackpackSceneTest, RenderBackpackScene) {
INSTANTIATE_TEST_SUITE_P(D3D12, BackpackSceneTest, ::testing::Values(RHIType::D3D12));
INSTANTIATE_TEST_SUITE_P(OpenGL, BackpackSceneTest, ::testing::Values(RHIType::OpenGL));
#if defined(XCENGINE_SUPPORT_VULKAN)
INSTANTIATE_TEST_SUITE_P(Vulkan, BackpackSceneTest, ::testing::Values(RHIType::Vulkan));
#endif
GTEST_API_ int main(int argc, char** argv) {
Logger::Get().Initialize();