test: Add RHI integration tests and update unit tests
- Add CommandQueue unit tests for WaitForIdle and synchronization - Add SwapChain unit tests for Present and buffer operations - Add Texture unit tests for various texture types and mipmaps - Fix RHIIntegrationFixture with proper logging and debug output - Update minimal integration test with RHI abstraction layer - Add GT reference image for minimal test - Update TEST_SPEC.md documentation
This commit is contained in:
@@ -70,3 +70,133 @@ TEST_P(RHITestFixture, SwapChain_Resize) {
|
||||
swapChain->Shutdown();
|
||||
delete swapChain;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, SwapChain_Present_Basic) {
|
||||
SwapChainDesc desc = {};
|
||||
desc.windowHandle = GetWindowHandle();
|
||||
desc.width = 800;
|
||||
desc.height = 600;
|
||||
desc.bufferCount = 2;
|
||||
desc.format = Format::R8G8B8A8_UNorm;
|
||||
|
||||
RHISwapChain* swapChain = GetDevice()->CreateSwapChain(desc);
|
||||
ASSERT_NE(swapChain, nullptr);
|
||||
|
||||
swapChain->Present(0, 0);
|
||||
|
||||
swapChain->Shutdown();
|
||||
delete swapChain;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, SwapChain_Present_WithSyncInterval) {
|
||||
SwapChainDesc desc = {};
|
||||
desc.windowHandle = GetWindowHandle();
|
||||
desc.width = 800;
|
||||
desc.height = 600;
|
||||
desc.bufferCount = 2;
|
||||
desc.format = Format::R8G8B8A8_UNorm;
|
||||
|
||||
RHISwapChain* swapChain = GetDevice()->CreateSwapChain(desc);
|
||||
ASSERT_NE(swapChain, nullptr);
|
||||
|
||||
swapChain->Present(1, 0);
|
||||
swapChain->Present(0, 0);
|
||||
|
||||
swapChain->Shutdown();
|
||||
delete swapChain;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, SwapChain_Present_Multiple) {
|
||||
SwapChainDesc desc = {};
|
||||
desc.windowHandle = GetWindowHandle();
|
||||
desc.width = 800;
|
||||
desc.height = 600;
|
||||
desc.bufferCount = 2;
|
||||
desc.format = Format::R8G8B8A8_UNorm;
|
||||
|
||||
RHISwapChain* swapChain = GetDevice()->CreateSwapChain(desc);
|
||||
ASSERT_NE(swapChain, nullptr);
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
swapChain->Present(0, 0);
|
||||
}
|
||||
|
||||
swapChain->Shutdown();
|
||||
delete swapChain;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, SwapChain_GetNativeHandle) {
|
||||
SwapChainDesc desc = {};
|
||||
desc.windowHandle = GetWindowHandle();
|
||||
desc.width = 800;
|
||||
desc.height = 600;
|
||||
desc.bufferCount = 2;
|
||||
desc.format = Format::R8G8B8A8_UNorm;
|
||||
|
||||
RHISwapChain* swapChain = GetDevice()->CreateSwapChain(desc);
|
||||
ASSERT_NE(swapChain, nullptr);
|
||||
|
||||
void* handle = swapChain->GetNativeHandle();
|
||||
EXPECT_NE(handle, nullptr);
|
||||
|
||||
swapChain->Shutdown();
|
||||
delete swapChain;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, SwapChain_Resize_WithPresent) {
|
||||
SwapChainDesc desc = {};
|
||||
desc.windowHandle = GetWindowHandle();
|
||||
desc.width = 800;
|
||||
desc.height = 600;
|
||||
desc.bufferCount = 2;
|
||||
desc.format = Format::R8G8B8A8_UNorm;
|
||||
|
||||
RHISwapChain* swapChain = GetDevice()->CreateSwapChain(desc);
|
||||
ASSERT_NE(swapChain, nullptr);
|
||||
|
||||
swapChain->Present(0, 0);
|
||||
swapChain->Resize(1024, 768);
|
||||
swapChain->Present(0, 0);
|
||||
|
||||
swapChain->Shutdown();
|
||||
delete swapChain;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, SwapChain_TripleBuffering) {
|
||||
SwapChainDesc desc = {};
|
||||
desc.windowHandle = GetWindowHandle();
|
||||
desc.width = 800;
|
||||
desc.height = 600;
|
||||
desc.bufferCount = 3;
|
||||
desc.format = Format::R8G8B8A8_UNorm;
|
||||
|
||||
RHISwapChain* swapChain = GetDevice()->CreateSwapChain(desc);
|
||||
ASSERT_NE(swapChain, nullptr);
|
||||
|
||||
uint32_t index0 = swapChain->GetCurrentBackBufferIndex();
|
||||
EXPECT_LT(index0, 3u);
|
||||
|
||||
swapChain->Present(0, 0);
|
||||
|
||||
uint32_t index1 = swapChain->GetCurrentBackBufferIndex();
|
||||
EXPECT_LT(index1, 3u);
|
||||
|
||||
swapChain->Shutdown();
|
||||
delete swapChain;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, SwapChain_DoubleShutdown) {
|
||||
SwapChainDesc desc = {};
|
||||
desc.windowHandle = GetWindowHandle();
|
||||
desc.width = 800;
|
||||
desc.height = 600;
|
||||
desc.bufferCount = 2;
|
||||
desc.format = Format::R8G8B8A8_UNorm;
|
||||
|
||||
RHISwapChain* swapChain = GetDevice()->CreateSwapChain(desc);
|
||||
ASSERT_NE(swapChain, nullptr);
|
||||
|
||||
swapChain->Shutdown();
|
||||
swapChain->Shutdown();
|
||||
delete swapChain;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user