Update editor viewport rendering integration

This commit is contained in:
2026-04-28 18:34:28 +08:00
parent d1a717091d
commit 9b6adf1806
6 changed files with 141 additions and 2 deletions

View File

@@ -20,9 +20,11 @@
#include "EnvironmentFlags.h"
#include <XCEditor/Foundation/UIEditorRuntimeTrace.h>
#include <XCEngine/Debug/Logger.h>
#include <XCEditor/Windowing/System/EditorWindowSystem.h>
#include <XCEditor/Workspace/UIEditorWindowWorkspaceModel.h>
#include <shellscalingapi.h>
#include <sstream>
#include <utility>
namespace XCEngine::UI::Editor {
@@ -34,6 +36,24 @@ constexpr const wchar_t* kWindowTitle = L"Main Scene * - Main.xx - XCEngine Edit
constexpr DWORD kBorderlessWindowStyle = WS_POPUP | WS_THICKFRAME;
constexpr int kDefaultSmokeTestDurationSeconds = 12;
class UIEditorRuntimeTraceLogSink final : public ::XCEngine::Debug::ILogSink {
public:
void Log(const ::XCEngine::Debug::LogEntry& entry) override {
if (entry.category != ::XCEngine::Debug::LogCategory::Rendering ||
entry.level < ::XCEngine::Debug::LogLevel::Warning) {
return;
}
std::ostringstream stream = {};
stream << ::XCEngine::Debug::LogLevelToString(entry.level)
<< ' '
<< entry.message.CStr();
AppendUIEditorRuntimeTrace("engine", stream.str());
}
void Flush() override {}
};
bool HasEditorWorkspaceMarkers(const std::filesystem::path& root) {
return std::filesystem::exists(root / "CMakeLists.txt") &&
std::filesystem::exists(root / "editor" / "resources") &&
@@ -160,6 +180,9 @@ bool Application::Initialize(HINSTANCE hInstance, int nCmdShow) {
const std::filesystem::path logRoot = m_resourceService->GetExecutableDirectory() / "logs";
InitializeUIEditorRuntimeTrace(logRoot);
auto runtimeTraceLogSink = std::make_unique<UIEditorRuntimeTraceLogSink>();
m_runtimeTraceLogSink = runtimeTraceLogSink.get();
::XCEngine::Debug::Logger::Get().AddSink(std::move(runtimeTraceLogSink));
SetUnhandledExceptionFilter(&Application::HandleUnhandledException);
AppendUIEditorRuntimeTrace("app", "initialize begin");
@@ -313,6 +336,10 @@ void Application::Shutdown() {
m_smokeTestCloseRequested = false;
AppendUIEditorRuntimeTrace("app", "shutdown end");
if (m_runtimeTraceLogSink != nullptr) {
::XCEngine::Debug::Logger::Get().RemoveSink(m_runtimeTraceLogSink);
m_runtimeTraceLogSink = nullptr;
}
ShutdownUIEditorRuntimeTrace();
}