refactor(new_editor/app): reorganize host structure and add smoke test

This commit is contained in:
2026-04-15 08:24:06 +08:00
parent 3617b4840b
commit 9e5954cf0a
235 changed files with 11157 additions and 10028 deletions

View File

@@ -0,0 +1,50 @@
#include "D3D12WindowSwapChainPresenter.h"
#include <sstream>
namespace XCEngine::UI::Editor::Host {
bool D3D12WindowSwapChainPresenter::PreparePresentSurface(
const ::XCEngine::Rendering::RenderContext& renderContext) {
if (!renderContext.IsValid() || renderContext.commandList == nullptr) {
m_lastError = "PreparePresentSurface requires a valid render context.";
return false;
}
if (m_swapChain == nullptr) {
m_lastError = "PreparePresentSurface 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 << "PreparePresentSurface 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::Present,
::XCEngine::RHI::ResourceStates::RenderTarget);
m_lastError.clear();
return true;
}
bool D3D12WindowSwapChainPresenter::PresentFrame() {
if (m_swapChain == nullptr) {
m_lastError = "PresentFrame requires an initialized swap chain.";
return false;
}
m_swapChain->Present(0, 0);
m_lastError.clear();
return true;
}
} // namespace XCEngine::UI::Editor::Host