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

@@ -9,6 +9,8 @@ set(PACKAGE_DIR ${CMAKE_SOURCE_DIR}/mvs/OpenGL/package)
get_filename_component(PROJECT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../.. ABSOLUTE)
find_package(Vulkan QUIET)
add_executable(rendering_integration_backpack_scene
main.cpp
${CMAKE_SOURCE_DIR}/tests/RHI/integration/fixtures/RHIIntegrationFixture.cpp
@@ -33,6 +35,11 @@ target_link_libraries(rendering_integration_backpack_scene PRIVATE
GTest::gtest
)
if(TARGET Vulkan::Vulkan)
target_link_libraries(rendering_integration_backpack_scene PRIVATE Vulkan::Vulkan)
target_compile_definitions(rendering_integration_backpack_scene PRIVATE XCENGINE_SUPPORT_VULKAN)
endif()
target_compile_definitions(rendering_integration_backpack_scene PRIVATE
UNICODE
_UNICODE

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();