feat: add RHI abstraction layer unit tests

- Add RHITestFixture with RHI_BACKEND env var support for backend selection
- Add unit tests for: Device, Buffer, Texture, SwapChain, CommandList, CommandQueue, Shader, Fence, Sampler
- Tests can run against D3D12 or OpenGL backends via RHI_BACKEND env var
- Add integration folder placeholder for future integration tests
This commit is contained in:
2026-03-22 16:18:51 +08:00
parent a980f2bd66
commit 8d4447915d
15 changed files with 1260 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# RHI Integration Tests
This folder will contain integration tests for the RHI abstraction layer.
Integration tests verify the interaction between multiple RHI components working together.
## Planned Tests
- Full render pipeline test (device -> swap chain -> command list -> present)
- Multi-threaded command recording
- Resource state transitions across multiple objects
- Frame synchronization with fences
## Running Tests
```bash
# Build once, run against different backends
cmake --build build --config Debug
# Test D3D12 backend
RHI_BACKEND=D3D12 ./build/tests/RHI/unit/rhi_unit_tests.exe
# Test OpenGL backend
RHI_BACKEND=OpenGL ./build/tests/RHI/unit/rhi_unit_tests.exe
```