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:
2026-03-25 20:50:49 +08:00
parent 04a80d10e7
commit a9b9a6ebfc
12 changed files with 731 additions and 129 deletions

View File

@@ -12,11 +12,23 @@
#include "XCEngine/RHI/RHIScreenshot.h"
#include "XCEngine/RHI/RHIEnums.h"
#include "XCEngine/RHI/OpenGL/OpenGLDevice.h"
#include "XCEngine/Debug/Logger.h"
#include "XCEngine/Debug/ConsoleLogSink.h"
#if defined(XCENGINE_SUPPORT_D3D12)
#include "XCEngine/RHI/D3D12/D3D12Device.h"
#include "XCEngine/RHI/D3D12/D3D12CommandList.h"
#include "XCEngine/RHI/D3D12/D3D12SwapChain.h"
#include "XCEngine/RHI/D3D12/D3D12Texture.h"
#include "XCEngine/RHI/D3D12/D3D12DescriptorHeap.h"
#endif
namespace XCEngine {
namespace RHI {
namespace Integration {
void Log(const char* format, ...);
class RHIIntegrationFixture : public ::testing::TestWithParam<RHIType> {
protected:
void SetUp() override;
@@ -34,6 +46,8 @@ protected:
RHIType GetBackendType() const { return GetParam(); }
HWND GetWindowHandle() const { return mWindow; }
int GetCurrentBackBufferIndex() const { return mCurrentBackBufferIndex; }
RHITexture* GetCurrentBackBuffer() { return mSwapChain ? mSwapChain->GetCurrentBackBuffer() : nullptr; }
void SetRenderTargetForClear();
virtual void RenderFrame() {}
@@ -48,6 +62,13 @@ private:
RHIScreenshot* mScreenshot = nullptr;
HWND mWindow = nullptr;
int mCurrentBackBufferIndex = 0;
#if defined(XCENGINE_SUPPORT_D3D12)
D3D12DescriptorHeap* mRTVHeap = nullptr;
D3D12DescriptorHeap* mDSVHeap = nullptr;
std::vector<RHIResourceView*> mRTVs;
RHIResourceView* mDSV = nullptr;
#endif
};
} // namespace Integration