Files
XCEngine/tests/RHI/unit/CMakeLists.txt
ssdfasd f808f8d197 RHI: Replace IsFinalized/Finalize with IsValid/EnsureValid
Unified PSO validation semantics across D3D12 and OpenGL backends:
- IsValid() returns whether PSO is ready to use
- EnsureValid() ensures PSO is valid (compiles if needed)

Behavior by backend:
- D3D12: IsValid=false after creation, true after EnsureValid() with shaders
- OpenGL: IsValid always=true (immediate model)

Also added test_pipeline_state.cpp with 10 tests for RHIPipelineState.
2026-03-25 12:28:33 +08:00

45 lines
1.0 KiB
CMake

cmake_minimum_required(VERSION 3.15)
get_filename_component(PROJECT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../.. ABSOLUTE)
find_package(GTest REQUIRED)
set(TEST_SOURCES
fixtures/RHITestFixture.cpp
test_device.cpp
test_buffer.cpp
test_texture.cpp
test_swap_chain.cpp
test_command_list.cpp
test_command_queue.cpp
test_shader.cpp
test_pipeline_state.cpp
test_fence.cpp
test_sampler.cpp
${CMAKE_SOURCE_DIR}/tests/opengl/package/src/glad.c
)
add_executable(rhi_unit_tests ${TEST_SOURCES})
target_compile_definitions(rhi_unit_tests PRIVATE XCENGINE_SUPPORT_OPENGL)
target_link_libraries(rhi_unit_tests PRIVATE
d3d12
dxgi
d3dcompiler
opengl32
XCEngine
GTest::gtest
GTest::gtest_main
)
target_include_directories(rhi_unit_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/fixtures
${PROJECT_ROOT_DIR}/engine/include
${PROJECT_ROOT_DIR}/engine/src
${CMAKE_SOURCE_DIR}/tests/opengl/package/include/
)
include(GoogleTest)
gtest_discover_tests(rhi_unit_tests)