#pragma once #include #include #include #include #include namespace XCEngine::UI::Editor::Host { struct D3D12WindowRenderLoopAttachResult { bool hasViewportSurfacePresentation = false; std::string warning = {}; }; struct D3D12WindowRenderLoopFrameContext { bool canRenderViewports = false; ::XCEngine::Rendering::RenderContext renderContext = {}; std::string warning = {}; }; struct D3D12WindowRenderLoopResizeResult { bool hasViewportSurfacePresentation = false; std::string windowRendererWarning = {}; }; struct D3D12WindowRenderLoopPresentResult { bool framePresented = false; bool captureSucceeded = false; std::string captureError = {}; std::string warning = {}; }; class D3D12WindowRenderLoop { public: D3D12WindowRenderLoopAttachResult Attach( D3D12UiRenderer& uiRenderer, D3D12WindowRenderer& windowRenderer); void Detach(); D3D12WindowRenderLoopFrameContext BeginFrame() const; D3D12WindowRenderLoopResizeResult ApplyResize(UINT width, UINT height); D3D12WindowRenderLoopPresentResult Present( const ::XCEngine::UI::UIDrawData& drawData, const std::filesystem::path* captureOutputPath = nullptr); bool HasViewportSurfacePresentation() const; private: D3D12UiRenderer* m_uiRenderer = nullptr; D3D12WindowRenderer* m_windowRenderer = nullptr; }; } // namespace XCEngine::UI::Editor::Host