refactor(RHI): 将窗口职责从RHI移到Platform层

- RHIDeviceDesc 删除 windowHandle/width/height/appName
- SwapChainDesc 添加 windowHandle 字段
- RHISwapChain 删除 PollEvents/ShouldClose/SetFullscreen 等窗口相关接口
- OpenGLDevice 删除 CreateRenderWindow,改用 InitializeWithExistingWindow
- 更新所有集成测试使用新API
- 273个单元测试 + 8个集成测试全部通过
This commit is contained in:
2026-03-24 23:00:49 +08:00
parent 9fae910854
commit 7a66913f2b
22 changed files with 66 additions and 379 deletions

View File

@@ -1,4 +1,5 @@
#include "fixtures/RHITestFixture.h"
#include "XCEngine/RHI/OpenGL/OpenGLDevice.h"
using namespace XCEngine::RHI;
@@ -10,9 +11,15 @@ TEST_P(RHITestFixture, Device_Initialize_Shutdown) {
RHIDevice* device = RHIFactory::CreateRHIDevice(GetBackendType());
ASSERT_NE(device, nullptr);
RHIDeviceDesc desc = {};
desc.enableDebugLayer = true;
bool initResult = device->Initialize(desc);
bool initResult = false;
if (GetBackendType() == RHIType::D3D12) {
RHIDeviceDesc desc = {};
desc.enableDebugLayer = true;
initResult = device->Initialize(desc);
} else if (GetBackendType() == RHIType::OpenGL) {
auto* oglDevice = static_cast<OpenGLDevice*>(device);
initResult = oglDevice->InitializeWithExistingWindow(GetWindowHandle());
}
ASSERT_TRUE(initResult);
device->Shutdown();