From 60c8461be35262ce54ed46ac618a4701e064c8a0 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Wed, 18 Mar 2026 02:32:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(RHI):=20=E5=B0=86=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3=E4=BB=8E=20RHIDevice=20?= =?UTF-8?q?=E7=A7=BB=E8=87=B3=20RHISwapChain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 从 RHIDevice 抽象基类中移除 PollEvents/SwapBuffers/ShouldClose/SetShouldClose 接口 - 这些功能现在应该通过 RHISwapChain 访问 - 符合设计文档中定义的分层架构 --- engine/include/XCEngine/RHI/D3D12/D3D12Device.h | 5 ----- engine/include/XCEngine/RHI/OpenGL/OpenGLDevice.h | 8 ++++---- engine/include/XCEngine/RHI/RHIDevice.h | 5 ----- engine/src/RHI/D3D12/D3D12Device.cpp | 14 -------------- 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/engine/include/XCEngine/RHI/D3D12/D3D12Device.h b/engine/include/XCEngine/RHI/D3D12/D3D12Device.h index bc2f457f..4e9b3862 100644 --- a/engine/include/XCEngine/RHI/D3D12/D3D12Device.h +++ b/engine/include/XCEngine/RHI/D3D12/D3D12Device.h @@ -82,11 +82,6 @@ public: void* GetNativeDevice() override; void* GetNativeHandle() const; - bool PollEvents() override; - void SwapBuffers() override; - bool ShouldClose() const override; - void SetShouldClose(bool shouldClose) override; - D3D12CommandQueue* CreateCommandQueueImpl(const CommandQueueDesc& desc); D3D12CommandList* CreateCommandListImpl(const CommandListDesc& desc); D3D12CommandAllocator* CreateCommandAllocator(const CommandAllocatorDesc& desc); diff --git a/engine/include/XCEngine/RHI/OpenGL/OpenGLDevice.h b/engine/include/XCEngine/RHI/OpenGL/OpenGLDevice.h index af2645b8..17195659 100644 --- a/engine/include/XCEngine/RHI/OpenGL/OpenGLDevice.h +++ b/engine/include/XCEngine/RHI/OpenGL/OpenGLDevice.h @@ -23,10 +23,10 @@ public: GLFWwindow* GetWindow() const { return m_window; } const RHIDeviceInfo& GetDeviceInfoImpl() const { return m_deviceInfo; } - void SwapBuffers() override; - bool PollEvents() override; - void SetShouldClose(bool shouldClose) override; - bool ShouldClose() const override; + void SwapBuffers(); + bool PollEvents(); + void SetShouldClose(bool shouldClose); + bool ShouldClose() const; RHIBuffer* CreateBuffer(const BufferDesc& desc) override; RHITexture* CreateTexture(const TextureDesc& desc) override; diff --git a/engine/include/XCEngine/RHI/RHIDevice.h b/engine/include/XCEngine/RHI/RHIDevice.h index 27d0b408..6de2c681 100644 --- a/engine/include/XCEngine/RHI/RHIDevice.h +++ b/engine/include/XCEngine/RHI/RHIDevice.h @@ -38,11 +38,6 @@ public: virtual const RHIDeviceInfo& GetDeviceInfo() const = 0; virtual void* GetNativeDevice() = 0; - - virtual bool PollEvents() = 0; - virtual void SwapBuffers() = 0; - virtual bool ShouldClose() const = 0; - virtual void SetShouldClose(bool shouldClose) = 0; }; } // namespace RHI diff --git a/engine/src/RHI/D3D12/D3D12Device.cpp b/engine/src/RHI/D3D12/D3D12Device.cpp index 8a836407..1e2d25ee 100644 --- a/engine/src/RHI/D3D12/D3D12Device.cpp +++ b/engine/src/RHI/D3D12/D3D12Device.cpp @@ -293,20 +293,6 @@ RHIPipelineState* D3D12Device::CreatePipelineState(const PipelineStateDesc& desc return nullptr; } -bool D3D12Device::PollEvents() { - return false; -} - -void D3D12Device::SwapBuffers() { -} - -bool D3D12Device::ShouldClose() const { - return false; -} - -void D3D12Device::SetShouldClose(bool shouldClose) { -} - D3D12CommandQueue* D3D12Device::CreateCommandQueueImpl(const CommandQueueDesc& desc) { return nullptr; }