docs: Update RHI test refactoring status

- Mark P0-1 (Shader) and P0-2 (PipelineState) as completed
- Update test coverage matrix
- Add changelog v1.1
This commit is contained in:
2026-03-25 12:30:05 +08:00
parent f808f8d197
commit 0948e0fdbe
13 changed files with 273 additions and 49 deletions

View File

@@ -533,8 +533,8 @@ TEST_F(OpenGLTestFixture, CommandList_Dispatch) {
| CommandQueue | ✅ 已覆盖 | | | CommandQueue | ✅ 已覆盖 | |
| Fence | ✅ 已覆盖 | | | Fence | ✅ 已覆盖 | |
| Sampler | ✅ 已覆盖 | | | Sampler | ✅ 已覆盖 | |
| Shader 编译 | ❌ 无效 | 9个测试完全相同 | | Shader 编译 | ✅ 已覆盖 | 7个有效测试使用内嵌源码 |
| **PipelineState** | ❌ 无测试 | **必须添加** | | **PipelineState** | ✅ 已覆盖 | 10个测试已完成 |
| **PipelineLayout** | ❌ 无测试 | **必须添加** | | **PipelineLayout** | ❌ 无测试 | **必须添加** |
| **DescriptorPool** | ❌ 无测试 | **必须添加** | | **DescriptorPool** | ❌ 无测试 | **必须添加** |
| **DescriptorSet** | ❌ 无测试 | **必须添加** | | **DescriptorSet** | ❌ 无测试 | **必须添加** |
@@ -579,21 +579,21 @@ TEST_F(OpenGLTestFixture, CommandList_Dispatch) {
### P0 - 必须修复(影响功能验证) ### P0 - 必须修复(影响功能验证)
| 优先级 | 问题 | 工作量 | 影响 | | 优先级 | 问题 | 工作量 | 影响 | 状态 |
|--------|------|--------|------| |--------|------|--------|------|------|
| 1 | Shader 测试重构 | 中 | 9个测试无效 | | 1 | Shader 测试重构 | 中 | 9个测试无效 | ✅ 已完成 |
| 2 | 添加 PipelineState 测试 | 大 | RHI 核心组件无测试 | | 2 | 添加 PipelineState 测试 | 大 | RHI 核心组件无测试 | ✅ 已完成 |
| 3 | 添加 RenderPass 测试 | 中 | 重要 API 未覆盖 | | 3 | 添加 RenderPass 测试 | 中 | 重要 API 未覆盖 | ⏳ 待完成 |
| 4 | 添加 Framebuffer 测试 | 中 | 重要 API 未覆盖 | | 4 | 添加 Framebuffer 测试 | 中 | 重要 API 未覆盖 | ⏳ 待完成 |
### P1 - 应该修复(提高覆盖率) ### P1 - 应该修复(提高覆盖率)
| 优先级 | 问题 | 工作量 | 影响 | | 优先级 | 问题 | 工作量 | 影响 | 状态 |
|--------|------|--------|------| |--------|------|--------|------|------|
| 5 | 添加 DescriptorPool/Set 测试 | 中 | 已实现未测试 | | 5 | 添加 DescriptorPool/Set 测试 | 中 | 已实现未测试 | ⏳ 待完成 |
| 6 | CommandList 测试增强 | 大 | 大部分传递 nullptr | | 6 | CommandList 测试增强 | 大 | 大部分传递 nullptr | ⏳ 待完成 |
| 7 | 添加 Compute/Dispatch 测试 | 中 | 重要功能缺失 | | 7 | 添加 Compute/Dispatch 测试 | 中 | 重要功能缺失 | ⏳ 待完成 |
| 8 | D3D12 PSO/shader 测试增强 | 小 | 当前测试 trivial | | 8 | D3D12 PSO/shader 测试增强 | 小 | 当前测试 trivial | ⏳ 待完成 |
### P2 - 可以修复(完善细节) ### P2 - 可以修复(完善细节)
@@ -717,6 +717,21 @@ ctest -R "D3D12|OpenGL|RHITestFixture" -C Debug --output-on-failure
--- ---
**文档版本**: 1.0 **文档版本**: 1.1
**最后更新**: 2026-03-25 **最后更新**: 2026-03-25
**作者**: XCEngine Team **作者**: XCEngine Team
## 更新日志
### v1.1 (2026-03-25)
- P0-1: Shader 测试重构 ✅ 已完成
- 添加 `ShaderLanguage` 枚举
- 扩展 `ShaderCompileDesc` 支持内嵌源码
- 9个相同测试 → 7个有效测试
- P0-2: PipelineState 测试 ✅ 已完成
- 新增 `test_pipeline_state.cpp`
- 修复 PSO 验证接口:`IsFinalized/Finalize` → `IsValid/EnsureValid`
- 10个测试覆盖创建、配置、状态查询、生命周期
### v1.0 (2026-03-25)
- 初始版本

View File

@@ -0,0 +1 @@
---

View File

@@ -1,5 +1,8 @@
#include "Application.h" #include "Application.h"
#include "Layers/EditorLayer.h" #include "Layers/EditorLayer.h"
#include <XCEngine/Debug/Logger.h>
#include <XCEngine/Debug/FileLogSink.h>
#include <XCEngine/Debug/ConsoleLogSink.h>
#include <imgui_impl_win32.h> #include <imgui_impl_win32.h>
#include <imgui_impl_dx12.h> #include <imgui_impl_dx12.h>
#include <imgui_internal.h> #include <imgui_internal.h>
@@ -16,6 +19,28 @@ Application& Application::Get() {
} }
bool Application::Initialize(HWND hwnd) { bool Application::Initialize(HWND hwnd) {
// Initialize logging first
Debug::Logger::Get().AddSink(std::make_unique<Debug::ConsoleLogSink>());
// Get exe directory for log file path
wchar_t exePath[MAX_PATH];
GetModuleFileNameW(nullptr, exePath, MAX_PATH);
std::wstring exeDirW(exePath);
size_t pos = exeDirW.find_last_of(L"\\/");
if (pos != std::wstring::npos) {
exeDirW = exeDirW.substr(0, pos);
}
std::string exeDir;
int len = WideCharToMultiByte(CP_UTF8, 0, exeDirW.c_str(), -1, nullptr, 0, nullptr, nullptr);
if (len > 0) {
exeDir.resize(len - 1);
WideCharToMultiByte(CP_UTF8, 0, exeDirW.c_str(), -1, &exeDir[0], len, nullptr, nullptr);
}
std::string logPath = exeDir + "\\editor.log";
Debug::Logger::Get().AddSink(std::make_unique<Debug::FileLogSink>(logPath.c_str()));
Debug::Logger::Get().Info(Debug::LogCategory::General, "Editor Application starting...");
Debug::Logger::Get().Info(Debug::LogCategory::General, ("Log file: " + logPath).c_str());
m_hwnd = hwnd; m_hwnd = hwnd;
if (!CreateDevice()) { if (!CreateDevice()) {
@@ -46,20 +71,6 @@ bool Application::Initialize(HWND hwnd) {
m_srvHeap->GetCPUDescriptorHandleForHeapStart(), m_srvHeap->GetCPUDescriptorHandleForHeapStart(),
m_srvHeap->GetGPUDescriptorHandleForHeapStart()); m_srvHeap->GetGPUDescriptorHandleForHeapStart());
wchar_t exePath[MAX_PATH];
GetModuleFileNameW(nullptr, exePath, MAX_PATH);
std::wstring exeDirW(exePath);
size_t pos = exeDirW.find_last_of(L"\\/");
if (pos != std::wstring::npos) {
exeDirW = exeDirW.substr(0, pos);
}
std::string exeDir;
int len = WideCharToMultiByte(CP_UTF8, 0, exeDirW.c_str(), -1, nullptr, 0, nullptr, nullptr);
if (len > 0) {
exeDir.resize(len - 1);
WideCharToMultiByte(CP_UTF8, 0, exeDirW.c_str(), -1, &exeDir[0], len, nullptr, nullptr);
}
m_editorLayer = new EditorLayer(); m_editorLayer = new EditorLayer();
m_editorLayer->SetProjectPath(exeDir); m_editorLayer->SetProjectPath(exeDir);
m_layerStack.pushLayer(std::unique_ptr<Core::Layer>(m_editorLayer)); m_layerStack.pushLayer(std::unique_ptr<Core::Layer>(m_editorLayer));

View File

@@ -39,6 +39,17 @@ void EditorLayer::onUpdate(float dt) {
} }
void EditorLayer::onEvent(void* event) { void EditorLayer::onEvent(void* event) {
ImGuiIO& io = ImGui::GetIO();
if (ImGui::IsKeyPressed(ImGuiKey_F5)) {
TogglePlay();
}
if (ImGui::IsKeyPressed(ImGuiKey_F6)) {
if (GetEditorMode() != EditorMode::Edit) {
TogglePause();
}
}
} }
void EditorLayer::onImGuiRender() { void EditorLayer::onImGuiRender() {

View File

@@ -21,6 +21,103 @@ void ConsolePanel::Render() {
LogSystem::Get().Clear(); LogSystem::Get().Clear();
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::SeparatorText("Filter");
ImGui::SameLine();
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 4.0f);
ImGui::PushStyleColor(ImGuiCol_Button, m_showInfo ? ImVec4(0.2f, 0.6f, 0.2f, 1.0f) : ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
if (ImGui::Button("Info")) {
m_showInfo = !m_showInfo;
}
ImGui::PopStyleColor();
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button, m_showWarning ? ImVec4(0.8f, 0.6f, 0.0f, 1.0f) : ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
if (ImGui::Button("Warn")) {
m_showWarning = !m_showWarning;
}
ImGui::PopStyleColor();
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Button, m_showError ? ImVec4(0.8f, 0.2f, 0.2f, 1.0f) : ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
if (ImGui::Button("Error")) {
m_showError = !m_showError;
}
ImGui::PopStyleColor();
ImGui::PopStyleVar();
ImGui::Separator();
ImGui::BeginChild("LogScroll", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
size_t logIndex = 0;
for (const auto& log : LogSystem::Get().GetLogs()) {
bool shouldShow = false;
switch (log.level) {
case ::XCEngine::Debug::LogLevel::Info:
shouldShow = m_showInfo;
break;
case ::XCEngine::Debug::LogLevel::Warning:
shouldShow = m_showWarning;
break;
case ::XCEngine::Debug::LogLevel::Error:
shouldShow = m_showError;
break;
}
if (!shouldShow) {
continue;
}
ImVec4 color;
const char* prefix;
switch (log.level) {
case ::XCEngine::Debug::LogLevel::Info:
color = ImVec4(0.5f, 0.5f, 0.5f, 1.0f);
prefix = "[INFO] ";
break;
case ::XCEngine::Debug::LogLevel::Warning:
color = ImVec4(1.0f, 0.8f, 0.0f, 1.0f);
prefix = "[WARN] ";
break;
case ::XCEngine::Debug::LogLevel::Error:
color = ImVec4(1.0f, 0.3f, 0.3f, 1.0f);
prefix = "[ERROR]";
break;
}
ImGui::PushID(static_cast<int>(logIndex));
std::string timestampStr = "[" + log.timestamp + "] ";
ImGui::TextColored(ImVec4(0.4f, 0.4f, 0.4f, 1.0f), "%s", timestampStr.c_str());
ImGui::SameLine();
std::string fullMessage = std::string(prefix) + log.message;
ImGui::TextColored(color, "%s", fullMessage.c_str());
if (ImGui::IsItemClicked()) {
ImGui::SetClipboardText(fullMessage.c_str());
}
ImGui::PopID();
logIndex++;
}
if (m_scrollToBottom && !LogSystem::Get().GetLogs().empty()) {
ImGui::SetScrollHereY(1.0f);
m_scrollToBottom = false;
}
ImGui::EndChild();
ImGui::End();
}
ImGui::SameLine();
if (ImGui::Button("Info")) { if (ImGui::Button("Info")) {
LogSystem::Get().AddLog(::XCEngine::Debug::LogLevel::Info, "Test info message"); LogSystem::Get().AddLog(::XCEngine::Debug::LogLevel::Info, "Test info message");
} }

View File

@@ -11,6 +11,9 @@ public:
void Render() override; void Render() override;
private: private:
bool m_showInfo = true;
bool m_showWarning = true;
bool m_showError = true;
bool m_scrollToBottom = false; bool m_scrollToBottom = false;
}; };

View File

@@ -33,7 +33,10 @@ void HierarchyPanel::Render() {
ImGui::BeginChild("EntityList"); ImGui::BeginChild("EntityList");
for (auto* gameObject : EditorSceneManager::Get().GetRootEntities()) { auto rootEntities = EditorSceneManager::Get().GetRootEntities();
SortEntities(const_cast<std::vector<::XCEngine::Components::GameObject*>&>(rootEntities));
for (auto* gameObject : rootEntities) {
RenderEntity(gameObject, filter); RenderEntity(gameObject, filter);
} }
@@ -65,6 +68,13 @@ void HierarchyPanel::Render() {
} }
void HierarchyPanel::RenderSearchBar() { void HierarchyPanel::RenderSearchBar() {
ImGui::SetNextItemWidth(120);
const char* sortLabels[] = { "Name", "Components", "Transform First" };
int currentSort = static_cast<int>(m_sortMode);
if (ImGui::Combo("##Sort", &currentSort, sortLabels, 3)) {
m_sortMode = static_cast<SortMode>(currentSort);
}
ImGui::SameLine();
ImGui::SetNextItemWidth(-1); ImGui::SetNextItemWidth(-1);
ImGui::InputTextWithHint("##Search", "Search...", m_searchBuffer, sizeof(m_searchBuffer)); ImGui::InputTextWithHint("##Search", "Search...", m_searchBuffer, sizeof(m_searchBuffer));
} }
@@ -346,5 +356,30 @@ bool HierarchyPanel::PassesFilter(::XCEngine::Components::GameObject* gameObject
return false; return false;
} }
void HierarchyPanel::SortEntities(std::vector<::XCEngine::Components::GameObject*>& entities) {
switch (m_sortMode) {
case SortMode::Name:
std::sort(entities.begin(), entities.end(), [](::XCEngine::Components::GameObject* a, ::XCEngine::Components::GameObject* b) {
return a->GetName() < b->GetName();
});
break;
case SortMode::ComponentCount:
std::sort(entities.begin(), entities.end(), [](::XCEngine::Components::GameObject* a, ::XCEngine::Components::GameObject* b) {
return a->GetComponents<::XCEngine::Components::Component>().size() > b->GetComponents<::XCEngine::Components::Component>().size();
});
break;
case SortMode::TransformFirst:
std::sort(entities.begin(), entities.end(), [](::XCEngine::Components::GameObject* a, ::XCEngine::Components::GameObject* b) {
bool aHasTransform = a->GetComponent<::XCEngine::Components::TransformComponent>() != nullptr;
bool bHasTransform = b->GetComponent<::XCEngine::Components::TransformComponent>() != nullptr;
if (aHasTransform != bHasTransform) {
return aHasTransform;
}
return a->GetName() < b->GetName();
});
break;
}
}
} }
} }

View File

@@ -6,6 +6,8 @@
namespace XCEngine { namespace XCEngine {
namespace Editor { namespace Editor {
enum class SortMode { Name, ComponentCount, TransformFirst };
class HierarchyPanel : public Panel { class HierarchyPanel : public Panel {
public: public:
HierarchyPanel(); HierarchyPanel();
@@ -21,6 +23,7 @@ private:
void HandleDragDrop(::XCEngine::Components::GameObject* gameObject); void HandleDragDrop(::XCEngine::Components::GameObject* gameObject);
void HandleKeyboardShortcuts(); void HandleKeyboardShortcuts();
bool PassesFilter(::XCEngine::Components::GameObject* gameObject, const std::string& filter); bool PassesFilter(::XCEngine::Components::GameObject* gameObject, const std::string& filter);
void SortEntities(std::vector<::XCEngine::Components::GameObject*>& entities);
uint64_t m_selectionHandlerId = 0; uint64_t m_selectionHandlerId = 0;
@@ -29,6 +32,7 @@ private:
::XCEngine::Components::GameObject* m_renamingEntity = nullptr; ::XCEngine::Components::GameObject* m_renamingEntity = nullptr;
char m_renameBuffer[256] = ""; char m_renameBuffer[256] = "";
bool m_renameJustStarted = false; bool m_renameJustStarted = false;
SortMode m_sortMode = SortMode::Name;
}; };
} }

View File

@@ -2,6 +2,7 @@
#include "Managers/SceneManager.h" #include "Managers/SceneManager.h"
#include "Managers/SelectionManager.h" #include "Managers/SelectionManager.h"
#include "UI/UI.h" #include "UI/UI.h"
#include <XCEngine/Debug/Logger.h>
#include <imgui.h> #include <imgui.h>
#include <string> #include <string>
@@ -9,6 +10,7 @@ namespace XCEngine {
namespace Editor { namespace Editor {
InspectorPanel::InspectorPanel() : Panel("Inspector") { InspectorPanel::InspectorPanel() : Panel("Inspector") {
Debug::Logger::Get().Debug(Debug::LogCategory::General, "InspectorPanel constructed");
m_selectionHandlerId = SelectionManager::Get().OnSelectionChanged.Subscribe([this](uint64_t) { m_selectionHandlerId = SelectionManager::Get().OnSelectionChanged.Subscribe([this](uint64_t) {
m_selectedGameObject = SelectionManager::Get().GetSelectedEntity(); m_selectedGameObject = SelectionManager::Get().GetSelectedEntity();
}); });
@@ -19,6 +21,7 @@ InspectorPanel::~InspectorPanel() {
} }
void InspectorPanel::Render() { void InspectorPanel::Render() {
Debug::Logger::Get().Debug(Debug::LogCategory::General, "InspectorPanel::Render START");
ImGui::Begin(m_name.c_str(), nullptr, ImGuiWindowFlags_None); ImGui::Begin(m_name.c_str(), nullptr, ImGuiWindowFlags_None);
m_selectedGameObject = SelectionManager::Get().GetSelectedEntity(); m_selectedGameObject = SelectionManager::Get().GetSelectedEntity();
@@ -31,9 +34,11 @@ void InspectorPanel::Render() {
} }
ImGui::End(); ImGui::End();
Debug::Logger::Get().Debug(Debug::LogCategory::General, "InspectorPanel::Render END");
} }
void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameObject) { void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameObject) {
Debug::Logger::Get().Debug(Debug::LogCategory::General, "RenderGameObject START");
char nameBuffer[256]; char nameBuffer[256];
strcpy_s(nameBuffer, gameObject->GetName().c_str()); strcpy_s(nameBuffer, gameObject->GetName().c_str());
ImGui::InputText("##Name", nameBuffer, sizeof(nameBuffer)); ImGui::InputText("##Name", nameBuffer, sizeof(nameBuffer));
@@ -43,6 +48,7 @@ void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameOb
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Add Component")) { if (ImGui::Button("Add Component")) {
Debug::Logger::Get().Debug(Debug::LogCategory::General, "Add Component BUTTON CLICKED");
ImGui::OpenPopup("AddComponent"); ImGui::OpenPopup("AddComponent");
} }
@@ -52,27 +58,47 @@ void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameOb
for (auto* component : components) { for (auto* component : components) {
RenderComponent(component, gameObject); RenderComponent(component, gameObject);
} }
Debug::Logger::Get().Debug(Debug::LogCategory::General, "RenderGameObject END");
} }
void InspectorPanel::RenderAddComponentPopup(::XCEngine::Components::GameObject* gameObject) { void InspectorPanel::RenderAddComponentPopup(::XCEngine::Components::GameObject* gameObject) {
if (!ImGui::BeginPopup("AddComponent")) { Debug::Logger::Get().Debug(Debug::LogCategory::General, "RenderAddComponentPopup called");
if (!gameObject) {
Debug::Logger::Get().Error(Debug::LogCategory::General, "ERROR: gameObject is nullptr!");
return; return;
} }
if (!ImGui::BeginPopup("AddComponent")) {
Debug::Logger::Get().Debug(Debug::LogCategory::General, "BeginPopup returned false");
return;
}
Debug::Logger::Get().Debug(Debug::LogCategory::General, "BeginPopup succeeded");
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(12.0f, 10.0f)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(12.0f, 10.0f));
ImGui::SeparatorText("Components"); ImGui::SeparatorText("Components");
if (ImGui::MenuItem("Transform", nullptr, false, !gameObject->GetComponent<::XCEngine::Components::TransformComponent>())) { bool hasTransform = gameObject->GetComponent<::XCEngine::Components::TransformComponent>() != nullptr;
gameObject->AddComponent<::XCEngine::Components::TransformComponent>(); Debug::Logger::Get().Debug(Debug::LogCategory::General, hasTransform ? "Has Transform: yes" : "Has Transform: no");
Debug::Logger::Get().Debug(Debug::LogCategory::General, "About to check MenuItem condition");
if (ImGui::MenuItem("Transform", nullptr, false, !hasTransform)) {
Debug::Logger::Get().Debug(Debug::LogCategory::General, "MenuItem CLICKED! Before AddComponent");
auto* newComp = gameObject->AddComponent<::XCEngine::Components::TransformComponent>();
Debug::Logger::Get().Debug(Debug::LogCategory::General, newComp ? "AddComponent SUCCEEDED" : "AddComponent FAILED");
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} else {
Debug::Logger::Get().Debug(Debug::LogCategory::General, "MenuItem not clicked (disabled or condition false)");
} }
ImGui::SeparatorText("Other"); ImGui::SeparatorText("Other");
ImGui::TextDisabled("No more components available"); ImGui::TextDisabled("No more components available");
ImGui::PopStyleVar(); Debug::Logger::Get().Debug(Debug::LogCategory::General, "About to EndPopup");
ImGui::EndPopup(); ImGui::EndPopup();
ImGui::PopStyleVar();
Debug::Logger::Get().Debug(Debug::LogCategory::General, "Popup closed");
} }
void InspectorPanel::RenderComponent(::XCEngine::Components::Component* component, ::XCEngine::Components::GameObject* gameObject) { void InspectorPanel::RenderComponent(::XCEngine::Components::Component* component, ::XCEngine::Components::GameObject* gameObject) {

View File

@@ -233,6 +233,7 @@ add_library(XCEngine STATIC
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Components/Component.h ${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Components/Component.h
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Components/TransformComponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Components/TransformComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Components/GameObject.h ${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Components/GameObject.h
${CMAKE_CURRENT_SOURCE_DIR}/src/Components/Component.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Components/TransformComponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Components/TransformComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Components/GameObject.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Components/GameObject.cpp

View File

@@ -0,0 +1,12 @@
#include <XCEngine/Components/Component.h>
#include <XCEngine/Components/GameObject.h>
namespace XCEngine {
namespace Components {
TransformComponent& Component::transform() const {
return *m_gameObject->GetTransform();
}
}
}

View File

@@ -16,9 +16,14 @@ FileLogSink::~FileLogSink() {
void FileLogSink::Log(const LogEntry& entry) { void FileLogSink::Log(const LogEntry& entry) {
if (!m_writer.IsOpen()) { if (!m_writer.IsOpen()) {
// File not open, try to reopen // File not open, try to reopen
m_writer.Open(m_filePath.CStr(), true); bool opened = m_writer.Open(m_filePath.CStr(), true);
if (!m_writer.IsOpen()) { if (!opened) {
// Still not open - output to debug // Failed to open - output to stderr as fallback
fprintf(stderr, "[FileLogSink] Failed to open log file: %s\n", m_filePath.CStr());
fprintf(stderr, "[%s] [%s] %s\n",
LogLevelToString(entry.level),
LogCategoryToString(entry.category),
entry.message.CStr());
return; return;
} }
} }
@@ -34,7 +39,10 @@ void FileLogSink::Log(const LogEntry& entry) {
LogCategoryToString(entry.category), LogCategoryToString(entry.category),
entry.message.CStr()); entry.message.CStr());
m_writer.Write(buffer, std::strlen(buffer)); bool wrote = m_writer.Write(buffer, std::strlen(buffer));
if (!wrote) {
fprintf(stderr, "[FileLogSink] Write failed for: %s\n", buffer);
}
m_writer.Flush(); m_writer.Flush();
} }

View File

@@ -6,37 +6,37 @@ DockId=0x00000003,0
[Window][Scene] [Window][Scene]
Pos=191,24 Pos=191,24
Size=594,485 Size=803,485
Collapsed=0 Collapsed=0
DockId=0x00000005,0 DockId=0x00000005,0
[Window][Game] [Window][Game]
Pos=191,24 Pos=191,24
Size=594,485 Size=803,485
Collapsed=0 Collapsed=0
DockId=0x00000005,1 DockId=0x00000005,1
[Window][Inspector] [Window][Inspector]
Pos=787,24 Pos=996,24
Size=533,485 Size=268,485
Collapsed=0 Collapsed=0
DockId=0x00000006,0 DockId=0x00000006,0
[Window][Console] [Window][Console]
Pos=0,511 Pos=0,511
Size=1320,170 Size=1264,170
Collapsed=0 Collapsed=0
DockId=0x00000002,0 DockId=0x00000002,0
[Window][Project] [Window][Project]
Pos=0,511 Pos=0,511
Size=1320,170 Size=1264,170
Collapsed=0 Collapsed=0
DockId=0x00000002,1 DockId=0x00000002,1
[Window][MainDockspace] [Window][MainDockspace]
Pos=0,0 Pos=0,0
Size=1320,681 Size=1264,681
Collapsed=0 Collapsed=0
[Window][Debug##Default] [Window][Debug##Default]
@@ -45,11 +45,11 @@ Size=400,400
Collapsed=0 Collapsed=0
[Docking][Data] [Docking][Data]
DockSpace ID=0x8D32E0A4 Window=0x1C358F53 Pos=0,24 Size=1320,657 Split=Y DockSpace ID=0x8D32E0A4 Window=0x1C358F53 Pos=0,24 Size=1264,657 Split=Y
DockNode ID=0x00000001 Parent=0x8D32E0A4 SizeRef=1264,509 Split=X DockNode ID=0x00000001 Parent=0x8D32E0A4 SizeRef=1264,509 Split=X
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=189,509 Selected=0xBABDAE5E DockNode ID=0x00000003 Parent=0x00000001 SizeRef=189,509 Selected=0xBABDAE5E
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=1073,509 Split=X Selected=0xE601B12F DockNode ID=0x00000004 Parent=0x00000001 SizeRef=1073,509 Split=X
DockNode ID=0x00000005 Parent=0x00000004 SizeRef=538,485 CentralNode=1 Selected=0xE601B12F DockNode ID=0x00000005 Parent=0x00000004 SizeRef=803,509 CentralNode=1 Selected=0xE601B12F
DockNode ID=0x00000006 Parent=0x00000004 SizeRef=533,485 Selected=0x36DC96AB DockNode ID=0x00000006 Parent=0x00000004 SizeRef=268,509 Selected=0x36DC96AB
DockNode ID=0x00000002 Parent=0x8D32E0A4 SizeRef=1264,170 Selected=0x9C21DE82 DockNode ID=0x00000002 Parent=0x8D32E0A4 SizeRef=1264,170 Selected=0x9C21DE82