From fa4fcbe95b5b3ea83f064e2667cc663068018d5e Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Sun, 26 Apr 2026 19:21:38 +0800 Subject: [PATCH] Decouple editor render runtime factory --- editor/AGENTS.md | 66 +++++++++++-------- editor/app/Bootstrap/Application.cpp | 5 ++ editor/app/Bootstrap/Application.h | 5 ++ .../Windowing/EditorWindowHostRuntime.cpp | 6 -- .../Win32/Windowing/EditorWindowHostRuntime.h | 2 - .../D3D12/D3D12EditorWindowRenderRuntime.cpp | 6 ++ .../D3D12/D3D12EditorWindowRenderRuntime.h | 20 ++++++ .../Host/EditorWindowRenderRuntime.h | 8 +++ .../EditorUtilityWindowCoordinator.cpp | 6 +- .../EditorUtilityWindowCoordinator.h | 6 ++ .../EditorWindowWorkspaceCoordinator.cpp | 6 +- .../EditorWindowWorkspaceCoordinator.h | 6 ++ editor/app/Windowing/EditorWindowManager.cpp | 10 ++- editor/app/Windowing/EditorWindowManager.h | 6 ++ .../Host/EditorWindowHostInterfaces.h | 8 --- 15 files changed, 120 insertions(+), 46 deletions(-) diff --git a/editor/AGENTS.md b/editor/AGENTS.md index 249e080a..5fdf3739 100644 --- a/editor/AGENTS.md +++ b/editor/AGENTS.md @@ -54,9 +54,10 @@ Use these ownership boundaries when changing code: - `editor/app/Platform/Win32`: native window, message dispatch, input, lifecycle, chrome, HWND ownership, and native host adapter behavior. - `editor/app/Rendering/Host`: app rendering contracts consumed by app - windowing and app content. + windowing and app content, including the render-runtime factory interface. - `editor/app/Rendering/D3D12`: concrete D3D12 window renderer, UI renderer, - texture host, text system, render loop, and render-runtime adapter. + texture host, text system, render loop, render-runtime adapter, and + render-runtime factory. The semantic dependency direction should remain: @@ -64,7 +65,7 @@ The semantic dependency direction should remain: XCEditor framework <- editor app semantics <- app windowing runtime / rendering host contracts - <- Win32 host / concrete rendering adapters + <- application composition root / concrete Win32 and rendering adapters ``` ## Startup Flow @@ -85,7 +86,7 @@ EditorContext::BuildWorkspaceController() -> EditorWindowSystem::BootstrapPrimaryWindow(...) -> EditorWindowManager::CreateWorkspaceWindow(...) -> EditorWindowContentFactory::CreateWorkspaceContentController(...) - -> EditorWindowHostRuntime::CreateWindowRenderRuntime() + -> EditorWindowRenderRuntimeFactory::CreateWindowRenderRuntime() -> EditorWindowRuntimeController(EditorContext, contentController, renderRuntime) -> EditorWindowHostRuntime::CreateHostWindow(runtimeController, ...) ``` @@ -107,18 +108,21 @@ passes it to the native host. The Win32 host stores and calls the runtime controller, but it does not create content controllers and it does not receive `EditorContext`. -Concrete renderer ownership lives below the app windowing boundary. The Win32 -host supplies the current D3D12 implementation through -`EditorWindowHost::CreateWindowRenderRuntime()`. `EditorWindowRuntimeController` -may call `Rendering::Host::EditorWindowRenderRuntime`, `UiTextureHost`, and -`ViewportRenderHost`, but it must not include `Rendering/D3D12` headers, -`windows.h`, or HWND types. +Concrete renderer selection is composed above both app windowing and the native +host. `Application` creates the current +`D3D12EditorWindowRenderRuntimeFactory` and passes it into +`EditorWindowManager`; app windowing asks the factory for backend-neutral +`Rendering::Host::EditorWindowRenderRuntime` instances. The Win32 host receives +runtime controllers that already contain their render runtime; it must not +create concrete render backends. `EditorWindowRuntimeController` may call +`EditorWindowRenderRuntime`, `UiTextureHost`, and `ViewportRenderHost`, but it +must not include `Rendering/D3D12` headers, `windows.h`, or HWND types. The host contract direction is: ```text EditorWindowManager / coordinators - -> ask host for EditorWindowRenderRuntime + -> ask EditorWindowRenderRuntimeFactory for EditorWindowRenderRuntime -> create EditorWindowRuntimeController -> EditorWindowHostRuntime::CreateHostWindow(runtimeController, ...) -> Win32 EditorWindow owns HWND and delegates frame work to the runtime @@ -215,18 +219,22 @@ logic. content, frame transfer, host contracts, runtime controllers, and coordinators. - Use `editor/app/Rendering/Host` for renderer-facing contracts that app - windowing or app content may consume. + windowing or app content may consume, including + `EditorWindowRenderRuntimeFactory`. - Use `editor/app/Rendering/D3D12` for concrete D3D12 renderer ownership, swap-chain/present/capture details, UI texture/text/render systems, and the - D3D12 `EditorWindowRenderRuntime` implementation. + D3D12 `EditorWindowRenderRuntime` implementation and factory. - Use `editor/app/Platform/Win32` only for native host behavior and message integration. Win32 code may request frames through the host coordinator; it - must not own the editor frame loop or expose `EditorContext`. + must not own the editor frame loop, expose `EditorContext`, or create + concrete render backends. - Do not let `editor/app/Windowing` include `Platform/Win32` headers. - Do not let `editor/app/Windowing` include `Rendering/D3D12` headers, `windows.h`, or HWND types. It should consume concrete rendering only through - `Rendering::Host::EditorWindowRenderRuntime` and the host interfaces in - `editor/app/Rendering/Host`. + `Rendering::Host::EditorWindowRenderRuntime` and + `Rendering::Host::EditorWindowRenderRuntimeFactory`. +- Do not let `editor/app/Platform/Win32` include `Rendering/D3D12` headers or + implement render-runtime factory methods on the native host interfaces. - Do not spread D3D12 host types into app windowing content, coordinator, frame-transfer, runtime-controller, or public host-contract headers. - Do not let Win32 host code create workspace or utility content directly. @@ -262,8 +270,9 @@ does not expose `GetEditorContext()`, and the native host receives an The renderer ownership cut has also been made: `XCUIEditorAppWindowing` no longer owns the concrete D3D12 window render loop or Win32 surface setup. `EditorWindowRuntimeController` consumes a backend-neutral -`Rendering::Host::EditorWindowRenderRuntime`, and the Win32 host supplies the -current `D3D12EditorWindowRenderRuntime`. +`Rendering::Host::EditorWindowRenderRuntime`, and `EditorWindowManager` receives +a backend-neutral `Rendering::Host::EditorWindowRenderRuntimeFactory`. The +current D3D12 factory is composed in `Application`, not in the Win32 host. The remaining promotion debt is the app runtime surface itself. `XCUIEditorAppWindowing` is still app-internal and may depend on app semantics @@ -271,15 +280,17 @@ such as `EditorContext`, `EditorShellRuntime`, utility window descriptors, and product-specific content. Do not promote host interfaces, frame transfer, runtime controllers, content controllers, or render-runtime contracts to `XCEditor` until they are generic enough to expose. Do not move frame ownership -back into `editor/app/Platform/Win32`, and do not move concrete renderer -ownership back into `editor/app/Windowing`. +back into `editor/app/Platform/Win32`, do not move concrete renderer ownership +back into `editor/app/Windowing`, and do not move renderer factory ownership +back into the Win32 host. Do not take another architecture cut just to keep carving this area. After the render-runtime boundary, the next default improvement should be boundary guardrails, such as checks that keep `editor/app/Windowing` free of -`Rendering/D3D12`, `windows.h`, and HWND types. Consider a second structural cut -only when there is concrete pressure, such as another native host, another render -backend, or headless editor/window tests. +`Rendering/D3D12`, `windows.h`, and HWND types, and keep +`editor/app/Platform/Win32` free of `Rendering/D3D12`. Consider a second +structural cut only when there is concrete pressure, such as another native host, +another render backend, or headless editor/window tests. ## Validation @@ -353,8 +364,11 @@ Start with these files for editor/windowing work: contracts, and `EditorWindowManager` are under `editor/app/Windowing`; Win32 remains the native adapter and no longer exposes `EditorContext`. - The concrete renderer cut is sealed: app windowing consumes - `Rendering::Host::EditorWindowRenderRuntime`, while the current D3D12 - implementation lives under `editor/app/Rendering/D3D12`; `editor/app/Windowing` - should stay free of `Rendering/D3D12`, `windows.h`, and HWND types. + `Rendering::Host::EditorWindowRenderRuntime` and + `Rendering::Host::EditorWindowRenderRuntimeFactory`, while the current D3D12 + implementation and factory live under `editor/app/Rendering/D3D12`. The + factory is composed in `Application`; `editor/app/Windowing` should stay free + of `Rendering/D3D12`, `windows.h`, and HWND types, and + `editor/app/Platform/Win32` should stay free of `Rendering/D3D12`. - Default validation remains the editor app build plus the 12-second smoke run; run broader windowing/unit targets only for targeted coverage. diff --git a/editor/app/Bootstrap/Application.cpp b/editor/app/Bootstrap/Application.cpp index f4888658..133ee587 100644 --- a/editor/app/Bootstrap/Application.cpp +++ b/editor/app/Bootstrap/Application.cpp @@ -8,6 +8,7 @@ #include "Platform/Win32/Windowing/EditorWindowHostConfig.h" #include "Platform/Win32/Windowing/EditorWindowHostRuntime.h" #include "Platform/Win32/Windowing/EditorWindowMessageDispatcher.h" +#include "Rendering/D3D12/D3D12EditorWindowRenderRuntime.h" #include "Support/EnvironmentFlags.h" #include "Support/ExecutablePath.h" @@ -144,9 +145,12 @@ bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) { hostConfig, m_repoRoot, m_editorContext->GetShellAsset().captureRootPath); + m_renderRuntimeFactory = + std::make_unique(); m_windowManager = std::make_unique( *m_editorContext, *m_windowSystem, + *m_renderRuntimeFactory, *m_windowHostRuntime); m_editorContext->SetExitRequestHandler([this]() { @@ -223,6 +227,7 @@ void Application::Shutdown() { m_windowManager->Shutdown(); m_windowManager.reset(); } + m_renderRuntimeFactory.reset(); m_windowHostRuntime.reset(); m_windowSystem.reset(); diff --git a/editor/app/Bootstrap/Application.h b/editor/app/Bootstrap/Application.h index 2be7b2e2..4edbfba9 100644 --- a/editor/app/Bootstrap/Application.h +++ b/editor/app/Bootstrap/Application.h @@ -19,6 +19,10 @@ class EditorWindowManager; class EditorWindowHostRuntime; } +namespace Host { +class D3D12EditorWindowRenderRuntimeFactory; +} + namespace System { class SystemInteractionService; } @@ -55,6 +59,7 @@ private: std::unique_ptr m_editorContext = {}; std::unique_ptr m_windowSystem = {}; std::unique_ptr m_windowHostRuntime = {}; + std::unique_ptr m_renderRuntimeFactory = {}; std::unique_ptr m_windowManager = {}; std::unique_ptr m_systemInteractionHost = {}; int m_smokeTestFrameLimit = 0; diff --git a/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.cpp b/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.cpp index a665f9e0..c6463ed9 100644 --- a/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.cpp +++ b/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.cpp @@ -4,7 +4,6 @@ #include "Platform/Win32/Chrome/EditorWindowChromeController.h" #include "Platform/Win32/Windowing/EditorFloatingWindowPlacement.h" #include "Platform/Win32/Windowing/EditorWindow.h" -#include "Rendering/D3D12/D3D12EditorWindowRenderRuntime.h" #include "Windowing/Host/EditorWindowHostCoordinator.h" #include "Windowing/Runtime/EditorWindowRuntimeController.h" @@ -62,11 +61,6 @@ EditorWindowHostRuntime::EditorWindowHostRuntime( EditorWindowHostRuntime::~EditorWindowHostRuntime() = default; -std::unique_ptr -EditorWindowHostRuntime::CreateWindowRenderRuntime() { - return std::make_unique(); -} - EditorWindow* EditorWindowHostRuntime::CreateHostWindow( std::unique_ptr runtimeController, const EditorWindowCreateParams& params) { diff --git a/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.h b/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.h index 8f70a473..71c8dc7c 100644 --- a/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.h +++ b/editor/app/Platform/Win32/Windowing/EditorWindowHostRuntime.h @@ -23,8 +23,6 @@ public: std::filesystem::path captureRoot); ~EditorWindowHostRuntime(); - std::unique_ptr - CreateWindowRenderRuntime() override; EditorWindow* CreateHostWindow( std::unique_ptr runtimeController, const EditorWindowCreateParams& params) override; diff --git a/editor/app/Rendering/D3D12/D3D12EditorWindowRenderRuntime.cpp b/editor/app/Rendering/D3D12/D3D12EditorWindowRenderRuntime.cpp index ca70157d..e8fa73a6 100644 --- a/editor/app/Rendering/D3D12/D3D12EditorWindowRenderRuntime.cpp +++ b/editor/app/Rendering/D3D12/D3D12EditorWindowRenderRuntime.cpp @@ -1,6 +1,7 @@ #include "Rendering/D3D12/D3D12EditorWindowRenderRuntime.h" #include +#include #include @@ -18,6 +19,11 @@ using Rendering::Host::EditorWindowRenderRuntimeSurface; D3D12EditorWindowRenderRuntime::~D3D12EditorWindowRenderRuntime() = default; +std::unique_ptr +D3D12EditorWindowRenderRuntimeFactory::CreateWindowRenderRuntime() { + return std::make_unique(); +} + bool D3D12EditorWindowRenderRuntime::IsReady() const { return m_ready; } diff --git a/editor/app/Rendering/D3D12/D3D12EditorWindowRenderRuntime.h b/editor/app/Rendering/D3D12/D3D12EditorWindowRenderRuntime.h index 216f9cf8..d55e9768 100644 --- a/editor/app/Rendering/D3D12/D3D12EditorWindowRenderRuntime.h +++ b/editor/app/Rendering/D3D12/D3D12EditorWindowRenderRuntime.h @@ -11,6 +11,8 @@ #include "Rendering/D3D12/D3D12WindowRenderer.h" #include "Rendering/Host/EditorWindowRenderRuntime.h" +#include + namespace XCEngine::UI::Editor::Host { class D3D12EditorWindowRenderRuntime final @@ -53,4 +55,22 @@ private: bool m_ready = false; }; +class D3D12EditorWindowRenderRuntimeFactory final + : public ::XCEngine::UI::Editor::Rendering::Host::EditorWindowRenderRuntimeFactory { +public: + D3D12EditorWindowRenderRuntimeFactory() = default; + ~D3D12EditorWindowRenderRuntimeFactory() override = default; + + D3D12EditorWindowRenderRuntimeFactory( + const D3D12EditorWindowRenderRuntimeFactory&) = delete; + D3D12EditorWindowRenderRuntimeFactory& operator=( + const D3D12EditorWindowRenderRuntimeFactory&) = delete; + D3D12EditorWindowRenderRuntimeFactory(D3D12EditorWindowRenderRuntimeFactory&&) = delete; + D3D12EditorWindowRenderRuntimeFactory& operator=( + D3D12EditorWindowRenderRuntimeFactory&&) = delete; + + std::unique_ptr + CreateWindowRenderRuntime() override; +}; + } // namespace XCEngine::UI::Editor::Host diff --git a/editor/app/Rendering/Host/EditorWindowRenderRuntime.h b/editor/app/Rendering/Host/EditorWindowRenderRuntime.h index 91ae9e9b..3ebf1461 100644 --- a/editor/app/Rendering/Host/EditorWindowRenderRuntime.h +++ b/editor/app/Rendering/Host/EditorWindowRenderRuntime.h @@ -9,6 +9,7 @@ #include #include +#include #include namespace XCEngine::UI::Editor::Rendering::Host { @@ -68,4 +69,11 @@ public: const std::filesystem::path* captureOutputPath) = 0; }; +class EditorWindowRenderRuntimeFactory { +public: + virtual ~EditorWindowRenderRuntimeFactory() = default; + + virtual std::unique_ptr CreateWindowRenderRuntime() = 0; +}; + } // namespace XCEngine::UI::Editor::Rendering::Host diff --git a/editor/app/Windowing/Coordinator/EditorUtilityWindowCoordinator.cpp b/editor/app/Windowing/Coordinator/EditorUtilityWindowCoordinator.cpp index adb28c96..72bf0539 100644 --- a/editor/app/Windowing/Coordinator/EditorUtilityWindowCoordinator.cpp +++ b/editor/app/Windowing/Coordinator/EditorUtilityWindowCoordinator.cpp @@ -6,6 +6,8 @@ #include "Windowing/Coordinator/EditorWindowLifecycleCoordinator.h" #include "Windowing/Runtime/EditorWindowRuntimeController.h" +#include + #include #include @@ -30,9 +32,11 @@ int ResolveOuterDimension(float value, int fallback) { EditorUtilityWindowCoordinator::EditorUtilityWindowCoordinator( EditorContext& editorContext, EditorWindowHost& hostRuntime, + Rendering::Host::EditorWindowRenderRuntimeFactory& renderRuntimeFactory, EditorWindowContentFactory& contentFactory) : m_hostRuntime(hostRuntime), m_editorContext(editorContext), + m_renderRuntimeFactory(renderRuntimeFactory), m_contentFactory(contentFactory) {} EditorUtilityWindowCoordinator::~EditorUtilityWindowCoordinator() = default; @@ -129,7 +133,7 @@ bool EditorUtilityWindowCoordinator::TryProcessOpenUtilityWindowRequest( std::make_unique( m_editorContext, m_contentFactory.CreateUtilityContentController(*descriptor), - m_hostRuntime.CreateWindowRenderRuntime()), + m_renderRuntimeFactory.CreateWindowRenderRuntime()), createParams); if (utilityWindow == nullptr) { LogRuntimeTrace("utility", "failed to create utility window"); diff --git a/editor/app/Windowing/Coordinator/EditorUtilityWindowCoordinator.h b/editor/app/Windowing/Coordinator/EditorUtilityWindowCoordinator.h index 9a8112f3..4dd80817 100644 --- a/editor/app/Windowing/Coordinator/EditorUtilityWindowCoordinator.h +++ b/editor/app/Windowing/Coordinator/EditorUtilityWindowCoordinator.h @@ -5,6 +5,10 @@ #include +namespace XCEngine::UI::Editor::Rendering::Host { +class EditorWindowRenderRuntimeFactory; +} + namespace XCEngine::UI::Editor::App { class EditorContext; @@ -16,6 +20,7 @@ public: EditorUtilityWindowCoordinator( EditorContext& editorContext, EditorWindowHost& hostRuntime, + Rendering::Host::EditorWindowRenderRuntimeFactory& renderRuntimeFactory, EditorWindowContentFactory& contentFactory); ~EditorUtilityWindowCoordinator(); @@ -32,6 +37,7 @@ private: EditorWindowHost& m_hostRuntime; EditorContext& m_editorContext; + Rendering::Host::EditorWindowRenderRuntimeFactory& m_renderRuntimeFactory; EditorWindowContentFactory& m_contentFactory; EditorWindowLifecycleCoordinator* m_lifecycleCoordinator = nullptr; }; diff --git a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp index df04d4d2..03496136 100644 --- a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp +++ b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.cpp @@ -5,6 +5,8 @@ #include "Windowing/Coordinator/EditorWindowLifecycleCoordinator.h" #include "Windowing/Runtime/EditorWindowRuntimeController.h" +#include + #include #include #include @@ -93,10 +95,12 @@ EditorWindowWorkspaceCoordinator::EditorWindowWorkspaceCoordinator( EditorContext& editorContext, EditorWindowHost& hostRuntime, EditorWindowSystem& windowSystem, + Rendering::Host::EditorWindowRenderRuntimeFactory& renderRuntimeFactory, EditorWindowContentFactory& contentFactory) : m_hostRuntime(hostRuntime), m_editorContext(editorContext), m_windowSystem(windowSystem), + m_renderRuntimeFactory(renderRuntimeFactory), m_contentFactory(contentFactory) {} EditorWindowWorkspaceCoordinator::~EditorWindowWorkspaceCoordinator() = default; @@ -372,7 +376,7 @@ bool EditorWindowWorkspaceCoordinator::ApplySynchronizationPlan( std::make_unique( m_editorContext, m_contentFactory.CreateWorkspaceContentController(action.create.windowState), - m_hostRuntime.CreateWindowRenderRuntime()), + m_renderRuntimeFactory.CreateWindowRenderRuntime()), createParams); if (createdWindow == nullptr) { for (const ExistingWindowSnapshot& snapshot : existingWindowSnapshots) { diff --git a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h index b8a7f885..14e7b723 100644 --- a/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h +++ b/editor/app/Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h @@ -18,6 +18,10 @@ namespace XCEngine::UI::Editor { class EditorWindowSystem; + +namespace Rendering::Host { +class EditorWindowRenderRuntimeFactory; +} } namespace XCEngine::UI::Editor::App { @@ -32,6 +36,7 @@ public: EditorContext& editorContext, EditorWindowHost& hostRuntime, EditorWindowSystem& windowSystem, + Rendering::Host::EditorWindowRenderRuntimeFactory& renderRuntimeFactory, EditorWindowContentFactory& contentFactory); ~EditorWindowWorkspaceCoordinator(); @@ -118,6 +123,7 @@ private: EditorWindowHost& m_hostRuntime; EditorContext& m_editorContext; EditorWindowSystem& m_windowSystem; + Rendering::Host::EditorWindowRenderRuntimeFactory& m_renderRuntimeFactory; EditorWindowContentFactory& m_contentFactory; EditorWindowLifecycleCoordinator* m_lifecycleCoordinator = nullptr; GlobalTabDragSession m_globalTabDragSession = {}; diff --git a/editor/app/Windowing/EditorWindowManager.cpp b/editor/app/Windowing/EditorWindowManager.cpp index 478173e8..725a7222 100644 --- a/editor/app/Windowing/EditorWindowManager.cpp +++ b/editor/app/Windowing/EditorWindowManager.cpp @@ -7,6 +7,8 @@ #include "Windowing/Coordinator/EditorWindowWorkspaceCoordinator.h" #include "Windowing/Runtime/EditorWindowRuntimeController.h" +#include + #include #include @@ -18,8 +20,10 @@ namespace XCEngine::UI::Editor::App { EditorWindowManager::EditorWindowManager( EditorContext& editorContext, EditorWindowSystem& windowSystem, + Rendering::Host::EditorWindowRenderRuntimeFactory& renderRuntimeFactory, EditorWindowHostRuntimeServices& hostRuntime) : m_editorContext(editorContext) + , m_renderRuntimeFactory(renderRuntimeFactory) , m_hostRuntime(hostRuntime) { m_contentFactory = CreateDefaultEditorWindowContentFactory(windowSystem); m_workspaceCoordinator = @@ -27,11 +31,13 @@ EditorWindowManager::EditorWindowManager( m_editorContext, m_hostRuntime, windowSystem, + m_renderRuntimeFactory, *m_contentFactory); m_utilityCoordinator = std::make_unique( m_editorContext, m_hostRuntime, + m_renderRuntimeFactory, *m_contentFactory); m_lifecycleCoordinator = std::make_unique( m_hostRuntime, @@ -60,7 +66,7 @@ EditorHostWindow* EditorWindowManager::CreateWorkspaceWindow( std::make_unique( m_editorContext, m_contentFactory->CreateWorkspaceContentController(windowState), - m_hostRuntime.CreateWindowRenderRuntime()), + m_renderRuntimeFactory.CreateWindowRenderRuntime()), params); if (window != nullptr) { m_workspaceCoordinator->RegisterExistingWindow(*window); @@ -79,7 +85,7 @@ EditorHostWindow* EditorWindowManager::CreateUtilityWindow( std::make_unique( m_editorContext, m_contentFactory->CreateUtilityContentController(descriptor), - m_hostRuntime.CreateWindowRenderRuntime()), + m_renderRuntimeFactory.CreateWindowRenderRuntime()), params); if (window != nullptr) { m_workspaceCoordinator->RegisterExistingWindow(*window); diff --git a/editor/app/Windowing/EditorWindowManager.h b/editor/app/Windowing/EditorWindowManager.h index f81ce152..33a5dd62 100644 --- a/editor/app/Windowing/EditorWindowManager.h +++ b/editor/app/Windowing/EditorWindowManager.h @@ -15,6 +15,10 @@ namespace XCEngine::UI::Editor { class EditorWindowSystem; struct UIEditorWindowWorkspaceState; +namespace Rendering::Host { +class EditorWindowRenderRuntimeFactory; +} + } // namespace XCEngine::UI::Editor namespace XCEngine::UI::Editor::App { @@ -33,6 +37,7 @@ public: EditorWindowManager( EditorContext& editorContext, EditorWindowSystem& windowSystem, + Rendering::Host::EditorWindowRenderRuntimeFactory& renderRuntimeFactory, EditorWindowHostRuntimeServices& hostRuntime); ~EditorWindowManager(); @@ -80,6 +85,7 @@ private: bool requestSkipNextSteadyStateFrame); EditorContext& m_editorContext; + Rendering::Host::EditorWindowRenderRuntimeFactory& m_renderRuntimeFactory; EditorWindowHostRuntimeServices& m_hostRuntime; std::unique_ptr m_contentFactory = {}; std::unique_ptr m_lifecycleCoordinator = {}; diff --git a/editor/app/Windowing/Host/EditorWindowHostInterfaces.h b/editor/app/Windowing/Host/EditorWindowHostInterfaces.h index 9bb33ce2..6f618b06 100644 --- a/editor/app/Windowing/Host/EditorWindowHostInterfaces.h +++ b/editor/app/Windowing/Host/EditorWindowHostInterfaces.h @@ -26,12 +26,6 @@ struct UIEditorDockHostTabDropTarget; } // namespace XCEngine::UI::Editor -namespace XCEngine::UI::Editor::Rendering::Host { - -class EditorWindowRenderRuntime; - -} // namespace XCEngine::UI::Editor::Rendering::Host - namespace XCEngine::UI::Editor::App { class EditorWindowHostCoordinator; @@ -100,8 +94,6 @@ class EditorWindowHost { public: virtual ~EditorWindowHost() = default; - virtual std::unique_ptr - CreateWindowRenderRuntime() = 0; virtual EditorHostWindow* CreateHostWindow( std::unique_ptr runtimeController, const EditorWindowCreateParams& params) = 0;