Revert "Update new_editor inspector layout and host rendering"

This reverts commit 5d81a64ef3.
This commit is contained in:
2026-04-21 13:55:30 +08:00
parent 64e778da65
commit 2c9e8dad49
62 changed files with 151 additions and 4417 deletions

View File

@@ -18,8 +18,6 @@ using namespace EditorWindowSupport;
namespace {
constexpr float kFrameTimeSmoothingFactor = 0.12f;
constexpr float kFrameTimingResetThresholdSeconds = 0.5f;
constexpr float kFrameStatsIdleLabelThresholdSeconds = 0.35f;
}
@@ -75,7 +73,6 @@ void EditorWindowRuntimeController::ClearExternalDockHostDropPreview() {
void EditorWindowRuntimeController::SetDpiScale(float dpiScale) {
m_renderer.SetDpiScale(dpiScale);
m_windowRenderLoop.SetDpiScale(dpiScale);
}
Host::NativeRenderer& EditorWindowRuntimeController::GetRenderer() {
@@ -195,16 +192,13 @@ bool EditorWindowRuntimeController::ApplyResize(UINT width, UINT height) {
return resizeResult.hasViewportSurfacePresentation;
}
Host::D3D12WindowRenderLoopFrameContext EditorWindowRuntimeController::BeginFrame(
bool updateFrameTiming) {
if (updateFrameTiming) {
UpdateFrameTiming();
}
Host::D3D12WindowRenderLoopFrameContext EditorWindowRuntimeController::BeginFrame() {
UpdateFrameTiming();
return m_windowRenderLoop.BeginFrame();
}
Host::D3D12WindowRenderLoopPresentResult EditorWindowRuntimeController::Present(
const ::XCEngine::UI::UIDrawData& drawData) {
const ::XCEngine::UI::UIDrawData& drawData) const {
return m_windowRenderLoop.Present(drawData);
}
@@ -246,36 +240,19 @@ std::string EditorWindowRuntimeController::BuildFrameRateText() const {
return {};
}
const auto now = std::chrono::steady_clock::now();
const float idleSeconds =
m_hasLastMeasuredFrameTime
? std::chrono::duration<float>(now - m_lastMeasuredFrameTime).count()
: 0.0f;
char buffer[72] = {};
if (idleSeconds >= kFrameStatsIdleLabelThresholdSeconds) {
std::snprintf(
buffer,
sizeof(buffer),
"FPS %.1f | %.2f ms | %.1fs ago",
m_displayFps,
m_displayFrameTimeMs,
idleSeconds);
} else {
std::snprintf(
buffer,
sizeof(buffer),
"FPS %.1f | %.2f ms",
m_displayFps,
m_displayFrameTimeMs);
}
char buffer[48] = {};
std::snprintf(
buffer,
sizeof(buffer),
"FPS %.1f | %.2f ms",
m_displayFps,
m_displayFrameTimeMs);
return buffer;
}
void EditorWindowRuntimeController::ResetFrameTiming() {
m_lastFrameTime = {};
m_lastMeasuredFrameTime = {};
m_hasLastFrameTime = false;
m_hasLastMeasuredFrameTime = false;
m_smoothedDeltaTimeSeconds = 0.0f;
m_displayFps = 0.0f;
m_displayFrameTimeMs = 0.0f;
@@ -294,9 +271,6 @@ void EditorWindowRuntimeController::UpdateFrameTiming() {
if (deltaTime <= 0.0f) {
return;
}
if (deltaTime > kFrameTimingResetThresholdSeconds) {
return;
}
if (m_smoothedDeltaTimeSeconds <= 0.0f) {
m_smoothedDeltaTimeSeconds = deltaTime;
@@ -309,8 +283,6 @@ void EditorWindowRuntimeController::UpdateFrameTiming() {
m_displayFps = m_smoothedDeltaTimeSeconds > 0.0f
? 1.0f / m_smoothedDeltaTimeSeconds
: 0.0f;
m_lastMeasuredFrameTime = now;
m_hasLastMeasuredFrameTime = true;
}
} // namespace XCEngine::UI::Editor::App