checkpoint(new_editor): native d3d12 ui path

Key node 1: move main-window UI presentation onto the D3D12 render loop with native UI renderer, text system, and texture host.

Key node 2: wire frame timing/FPS display, window runtime, swapchain presentation, and native screenshot capture around the new path.

Key node 3: carry editor shell/workspace/viewport/panel interaction updates needed by the new renderer and detached window flow.

Key node 4: pump async resource loads and scene bridge follow-up needed for scene content visibility in new_editor.
This commit is contained in:
2026-04-21 20:49:18 +08:00
parent a779b04dba
commit 6e9265e92e
53 changed files with 5330 additions and 858 deletions

View File

@@ -240,15 +240,15 @@ bool D3D12WindowSwapChainPresenter::RecreateBackBufferViews() {
return true;
}
bool D3D12WindowSwapChainPresenter::PreparePresentSurface(
bool D3D12WindowSwapChainPresenter::PrepareCurrentBackBufferForRender(
const ::XCEngine::Rendering::RenderContext& renderContext) {
if (!renderContext.IsValid() || renderContext.commandList == nullptr) {
m_lastError = "PreparePresentSurface requires a valid render context.";
m_lastError = "PrepareCurrentBackBufferForRender requires a valid render context.";
return false;
}
if (m_swapChain == nullptr) {
m_lastError = "PreparePresentSurface requires an initialized swap chain.";
m_lastError = "PrepareCurrentBackBufferForRender requires an initialized swap chain.";
return false;
}
@@ -256,7 +256,7 @@ bool D3D12WindowSwapChainPresenter::PreparePresentSurface(
if (backBufferIndex >= m_backBufferViews.size() ||
m_backBufferViews[backBufferIndex] == nullptr) {
std::ostringstream error = {};
error << "PreparePresentSurface could not find the current swap chain RTV. index="
error << "PrepareCurrentBackBufferForRender could not find the current swap chain RTV. index="
<< backBufferIndex
<< " rtvCount="
<< m_backBufferViews.size();
@@ -272,6 +272,38 @@ bool D3D12WindowSwapChainPresenter::PreparePresentSurface(
return true;
}
bool D3D12WindowSwapChainPresenter::FinalizeCurrentBackBufferForPresent(
const ::XCEngine::Rendering::RenderContext& renderContext) {
if (!renderContext.IsValid() || renderContext.commandList == nullptr) {
m_lastError = "FinalizeCurrentBackBufferForPresent requires a valid render context.";
return false;
}
if (m_swapChain == nullptr) {
m_lastError = "FinalizeCurrentBackBufferForPresent requires an initialized swap chain.";
return false;
}
const std::uint32_t backBufferIndex = m_swapChain->GetCurrentBackBufferIndex();
if (backBufferIndex >= m_backBufferViews.size() ||
m_backBufferViews[backBufferIndex] == nullptr) {
std::ostringstream error = {};
error << "FinalizeCurrentBackBufferForPresent could not find the current swap chain RTV. index="
<< backBufferIndex
<< " rtvCount="
<< m_backBufferViews.size();
m_lastError = error.str();
return false;
}
renderContext.commandList->TransitionBarrier(
m_backBufferViews[backBufferIndex],
::XCEngine::RHI::ResourceStates::RenderTarget,
::XCEngine::RHI::ResourceStates::Present);
m_lastError.clear();
return true;
}
bool D3D12WindowSwapChainPresenter::PresentFrame() {
if (m_swapChain == nullptr) {
m_lastError = "PresentFrame requires an initialized swap chain.";