Refactor new editor host orchestration
This commit is contained in:
@@ -1,20 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "D3D12WindowRenderer.h"
|
||||
#include "NativeRenderer.h"
|
||||
|
||||
#include <functional>
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace XCEngine::UI::Editor::Host {
|
||||
|
||||
using D3D12WindowRenderCallback =
|
||||
std::function<void(
|
||||
const ::XCEngine::Rendering::RenderContext&,
|
||||
const ::XCEngine::Rendering::RenderSurface&)>;
|
||||
struct D3D12WindowRenderLoopAttachResult {
|
||||
bool hasViewportSurfacePresentation = false;
|
||||
std::string interopWarning = {};
|
||||
};
|
||||
|
||||
bool RenderD3D12WindowFrame(
|
||||
D3D12WindowRenderer& windowRenderer,
|
||||
const float clearColor[4],
|
||||
const D3D12WindowRenderCallback& beforePresent = {},
|
||||
const D3D12WindowRenderCallback& afterPresent = {});
|
||||
struct D3D12WindowRenderLoopFrameContext {
|
||||
bool canRenderViewports = false;
|
||||
::XCEngine::Rendering::RenderContext renderContext = {};
|
||||
std::string warning = {};
|
||||
};
|
||||
|
||||
struct D3D12WindowRenderLoopResizeResult {
|
||||
bool hasViewportSurfacePresentation = false;
|
||||
std::string windowRendererWarning = {};
|
||||
std::string interopWarning = {};
|
||||
};
|
||||
|
||||
struct D3D12WindowRenderLoopPresentResult {
|
||||
bool framePresented = false;
|
||||
std::string warning = {};
|
||||
};
|
||||
|
||||
class D3D12WindowRenderLoop {
|
||||
public:
|
||||
D3D12WindowRenderLoopAttachResult Attach(
|
||||
NativeRenderer& uiRenderer,
|
||||
D3D12WindowRenderer& windowRenderer);
|
||||
void Detach();
|
||||
|
||||
D3D12WindowRenderLoopFrameContext BeginFrame() const;
|
||||
D3D12WindowRenderLoopResizeResult ApplyResize(UINT width, UINT height);
|
||||
D3D12WindowRenderLoopPresentResult Present(
|
||||
const ::XCEngine::UI::UIDrawData& drawData) const;
|
||||
|
||||
bool HasViewportSurfacePresentation() const;
|
||||
|
||||
private:
|
||||
NativeRenderer* m_uiRenderer = nullptr;
|
||||
D3D12WindowRenderer* m_windowRenderer = nullptr;
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Host
|
||||
|
||||
Reference in New Issue
Block a user