Decouple editor windowing from D3D12 runtime

This commit is contained in:
2026-04-26 18:54:43 +08:00
parent 244bdd78c2
commit 60b2949de2
14 changed files with 456 additions and 117 deletions

View File

@@ -242,8 +242,18 @@ bool EditorWindow::InitializeRuntime(
LogRuntimeTrace("window", dpiTrace.str());
MarkInitializing();
UINT clientWidth = 0u;
UINT clientHeight = 0u;
if (!QueryCurrentClientPixelSize(clientWidth, clientHeight)) {
clientWidth = 1u;
clientHeight = 1u;
}
const bool initialized = m_runtime->Initialize(
m_session->GetHwnd(),
Rendering::Host::EditorWindowRenderRuntimeSurface{
.nativeWindowHandle = m_session->GetHwnd(),
.widthPixels = clientWidth,
.heightPixels = clientHeight,
},
params.repoRoot,
params.captureRoot,
params.autoCaptureOnStartup);
@@ -641,7 +651,7 @@ EditorWindowFrameTransferRequests EditorWindow::RenderHostFrame(
UIDrawList& windowChromeDrawList = drawData.EmplaceDrawList("XCEditorWindow.Chrome");
m_chromeController->AppendChrome(*this, windowChromeDrawList, width);
const Host::D3D12WindowRenderLoopPresentResult presentResult = m_runtime->Present(drawData);
const auto presentResult = m_runtime->Present(drawData);
if (!presentResult.warning.empty()) {
LogRuntimeTrace("present", presentResult.warning);
}
@@ -699,7 +709,7 @@ EditorWindowFrameTransferRequests EditorWindow::RenderRuntimeFrame(
const bool useDetachedTitleBarTabStrip =
m_chromeController->ShouldUseDetachedTitleBarTabStrip(*this);
m_runtime->PrepareEditorContext();
const Host::D3D12WindowRenderLoopFrameContext frameContext = m_runtime->BeginFrame();
const auto frameContext = m_runtime->BeginFrame();
if (!frameContext.warning.empty()) {
LogRuntimeTrace("viewport", frameContext.warning);
}