#pragma once #ifndef NOMINMAX #define NOMINMAX #endif #include "D3D12HostDevice.h" #include "D3D12WindowSwapChainPresenter.h" #include #include #include #include #include #include namespace XCEngine::UI::Editor::Host { class D3D12WindowRenderer { public: static constexpr std::uint32_t kSwapChainBufferCount = D3D12WindowSwapChainPresenter::kSwapChainBufferCount; bool Initialize(HWND hwnd, int width, int height); void Shutdown(); bool Resize(int width, int height); bool BeginFrame(); bool PreparePresentSurface(); bool SubmitFrame(bool presentSwapChain); bool SignalFrameCompletion(); bool PresentFrame(); ID3D12Device* GetDevice() const; ID3D12CommandQueue* GetCommandQueue() const; const std::string& GetLastError() const; ::XCEngine::RHI::RHIDevice* GetRHIDevice() const; ::XCEngine::RHI::RHISwapChain* GetSwapChain() const; const ::XCEngine::Rendering::RenderSurface* GetCurrentRenderSurface() const; const ::XCEngine::RHI::D3D12Texture* GetCurrentBackBufferTexture() const; const ::XCEngine::RHI::D3D12Texture* GetBackBufferTexture(std::uint32_t index) const; std::uint32_t GetBackBufferCount() const; ::XCEngine::Rendering::RenderContext GetRenderContext() const; private: D3D12HostDevice m_hostDevice = {}; D3D12WindowSwapChainPresenter m_presenter = {}; std::uint32_t m_activeBackBufferIndex = 0u; std::string m_lastError = {}; }; } // namespace XCEngine::UI::Editor::Host