Commit Graph

494 Commits

Author SHA1 Message Date
d34d040563 Fix broken links in Threading API docs
Fix 14 broken cross-references in docs/api/threading/:
- lambda-task path: lambdatask -> lambda-task (5 occurrences)
- task-system-config path: tasksystemconfig -> task-system-config (6 occurrences)
- read-write-lock self-ref: readwritelock -> read-write-lock (6 occurrences)
- task-system cross-method: createtaskgroup/destroytaskgroup -> create-task-group/destroy-task-group
- thread cross-method: getcurrentid/getid -> get-current-id/get-id

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 01:30:37 +08:00
1cf744b755 refactor(docs): RHI模块文档重构 - 修复18处链接错误并新增RHIFramebuffer/RHIRenderPass文档
- 修复opengl/下13个文件对overview.md的错误引用,改为opengl.md
- 修复opengl/shader/下2处get-native-handle.md的错误路径引用
- 修复rhi.md中rhifactory路径错误
- 修复opengl.md中对d3d12.md的错误引用
- 修复opengl/README.md中的overview.md引用
- 新增RHIFramebuffer完整文档(7个文件)
- 新增RHIRenderPass完整文档(7个文件)
- 更新rhi.md总览页,添加RHIFramebuffer和RHIRenderPass分类
2026-03-26 01:29:00 +08:00
0651666d8c Fix editor scene persistence and XC scene workflow 2026-03-26 01:26:26 +08:00
39edb0b497 Fix RHI constant binding and add sphere test 2026-03-26 01:23:29 +08:00
c5605c2a32 Align OpenGL textured integration baselines 2026-03-26 01:07:36 +08:00
9adac63b4c Fix RHI texture binding and add pure quad test 2026-03-26 00:47:12 +08:00
76c4c2ace2 Add RHI texture upload and descriptor set fixes 2026-03-26 00:04:51 +08:00
605ef56e16 Add pipeline layout support for graphics PSOs 2026-03-25 23:49:48 +08:00
83cd2fa591 Refresh test spec and align minimal shared GT 2026-03-25 23:41:45 +08:00
8f9a2d17a5 Use indexed drawing in RHI triangle test 2026-03-25 23:34:12 +08:00
8fabdc603c Add pure RHI triangle integration test 2026-03-25 23:29:58 +08:00
2470451d96 Honor input layouts in OpenGL vertex bindings 2026-03-25 23:24:06 +08:00
1597181458 Add graphics shader support to RHI pipeline states 2026-03-25 23:19:18 +08:00
aaf9cce418 Add RHI vertex and index buffer views 2026-03-25 23:07:22 +08:00
268daf7bc9 Move design notes into docs/used 2026-03-25 21:55:28 +08:00
30b5f93157 Fix RHI swap chain queue binding and restore minimal GT checks 2026-03-25 21:50:57 +08:00
8f76564ded test: Add new RHI unit tests for capabilities, views, screenshot, descriptor set and pipeline layout 2026-03-25 20:50:56 +08:00
a9b9a6ebfc test: Add RHI integration tests and update unit tests
- Add CommandQueue unit tests for WaitForIdle and synchronization
- Add SwapChain unit tests for Present and buffer operations
- Add Texture unit tests for various texture types and mipmaps
- Fix RHIIntegrationFixture with proper logging and debug output
- Update minimal integration test with RHI abstraction layer
- Add GT reference image for minimal test
- Update TEST_SPEC.md documentation
2026-03-25 20:50:49 +08:00
04a80d10e7 refactor: Clean up RHI interface and implement descriptor set pooling
- Remove unnecessary inline keywords from RHICommandList
- Add TextureType enum for proper texture type classification
- Update DescriptorSet API to support binding with pipeline layout
- Simplify D3D12CommandList implementation
- Implement descriptor set binding with pipeline layout for both D3D12 and OpenGL
2026-03-25 20:50:40 +08:00
6bbd35873b test: Update RHI unit tests to use CreateShader API
Rename CompileShader to CreateShader in all RHI unit tests:
- test_command_list.cpp
- test_compute.cpp
- test_shader.cpp
2026-03-25 19:01:59 +08:00
81532983f0 refactor: Rename CompileShader to CreateShader in RHIDevice interface
- Update RHIDevice::CompileShader to CreateShader in base interface
- Add RHIScreenshot.h/cpp to CMakeLists.txt
2026-03-25 19:01:55 +08:00
5ade399df2 refactor: Clean up D3D12 debug logging and rename CompileShader
- Remove debug OutputDebugStringA and file logging from D3D12Device
- Rename CompileShader to CreateShader for API consistency
2026-03-25 19:01:47 +08:00
712e975610 refactor: Refactor OpenGL backend to use OpenGLEnums
Use centralized OpenGLEnums.h for enum conversion:
- Remove local ToGL* functions from OpenGLCommandList
- Replace with ToOpenGL() and ToOpenGLClearBuffer() from OpenGLEnums
- Simplify OpenGLTexture, OpenGLBuffer, OpenGLSampler, etc.
2026-03-25 19:01:36 +08:00
773d1aa38a chore: Add .trae/ to .gitignore 2026-03-25 19:01:27 +08:00
e323b45595 feat: Add OpenGLEnums.h for unified enum conversion
Add OpenGLEnums.h providing centralized OpenGL enum conversion functions:
- ToOpenGL() for primitive types
- ToOpenGLClearBuffer() for clear buffer flags
- Simplifies OpenGL backend code by removing local enum mapping functions
2026-03-25 19:01:16 +08:00
238ebb50f4 test: Add RHI integration test framework
Add integration tests for RHI module:
- Add tests/RHI/integration/ directory with CMakeLists.txt
- Add RHIIntegrationFixture for shared test utilities
- Add minimal integration test (window creation, basic rendering)
- Add compare_ppm.py for image comparison
- Add run_integration_test.py test runner script

These integration tests verify the complete rendering pipeline
by comparing rendered output against ground truth PPM files.
2026-03-25 19:00:30 +08:00
d1b7fda816 docs: Update TEST_SPEC.md with RHI integration tests documentation
- Add integration test directory structure
- Expand test hierarchy from 3 to 4 layers (add integration tests)
- Update module naming table with integration test executables
- Add integration test execution commands
- Add integration test performance references
- Update appendix A with 4-layer architecture diagram
- Update total test count to 860
2026-03-25 18:59:40 +08:00
b11f59e144 Fix RHI D3D12 RTV creation and GetFormat bug
1. Add ALLOW_RENDER_TARGET flag for color textures in CreateTexture
   - This was the root cause of 5 failing RTV-related tests
   - Without this flag, creating RTV caused device removal

2. Add FromD3D12() reverse conversion for Format enum
   - GetFormat() was incorrectly casting DXGI_FORMAT to Format
   - DXGI_FORMAT_R8G8B8A8_UNORM=28 but Format::R8G8B8A8_UNorm=3
   - Added FromD3D12() to properly convert back

3. Update RHITestFixture to pre-create CommandQueue and Fence
   - Prevents potential timing issues with GPU synchronization

4. Update RHITestFixture tests to pass correct format in ResourceViewDesc
   - Previously passed empty desc.format=0 which caused issues

All 234 RHI unit tests now pass (117 D3D12 + 117 OpenGL)
2026-03-25 18:12:50 +08:00
b0d0576763 Fix editor selection system: SelectionManager ID types and Scene lookup
- SelectionManager now implements ISelectionManager interface with uint64_t IDs
- Remove SelectionManager/SceneManager circular dependency via EventBus
- Add Scene::FindByID() for proper ID-based entity lookup
- SceneManager::GetEntity() now uses FindByID instead of name-based Find
- Fix editor CMakeLists.txt XCEngine.lib path
- EventBus now thread-safe with shared_mutex
2026-03-25 17:51:15 +08:00
6612330347 Fix RHI format conversion and test viewDesc initialization
- Fix CreateTexture to use ToD3D12() for format conversion
- Fix CreateRenderTargetView to use ToD3D12() for format conversion
- Fix CreateDepthStencilView to use ToD3D12() for format conversion
- Fix CreateShaderResourceView to use ToD3D12() for format conversion
- Update test to pass correct format in ResourceViewDesc

These fixes resolve CommandList_ClearDepthStencil_WithRealView test.
Other RTV-related tests still fail with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
from CreateCommandAllocator - further investigation needed.
2026-03-25 17:43:59 +08:00
295459067f Fix RHI format conversion and add debug logging for D3D12 tests 2026-03-25 17:30:16 +08:00
9c082c72fa Update refactoring plan: ISceneManager and EventBus integration 2026-03-25 16:42:18 +08:00
621a135ef7 Make HierarchyPanel use EventBus for selection changes
- Subscribe to SelectionChangedEvent via EventBus in OnAttach
- Unsubscribe in destructor
- Added m_selectionHandlerId and m_needsRefresh members
- HierarchyPanel now properly receives selection change notifications
2026-03-25 16:41:21 +08:00
605d086bcc Create ISceneManager interface and fix GetSceneManager return type
- Created ISceneManager interface with Editor需要的 SceneManager 方法
- SceneManager now implements ISceneManager
- IEditorContext::GetSceneManager() now returns ISceneManager& instead of void*
- Removed SceneManager::GetSceneManagerConcrete() method
- Updated HierarchyPanel and InspectorPanel to use ISceneManager interface
2026-03-25 16:39:15 +08:00
48d9e0a7d2 Update refactoring plan: ProjectManager DI 2026-03-25 16:26:18 +08:00
d4c94907ba Migrate ProjectManager to dependency injection
- Created IProjectManager interface
- ProjectManager now implements IProjectManager
- Removed ProjectManager::Get() singleton
- Added IEditorContext::GetProjectManager()
- ProjectPanel now uses m_context->GetProjectManager() instead of singleton
- EditorContext owns ProjectManager instance
2026-03-25 16:25:55 +08:00
56116b62c3 Update refactoring plan: rename Impl classes 2026-03-25 16:21:01 +08:00
dc63808a65 Rename Impl classes to follow Unity naming convention
- SelectionManagerImpl -> SelectionManager
- EditorContextImpl -> EditorContext
- Removed unused SceneManagerImpl and ISceneManager

The Impl suffix was inconsistent with Unity naming conventions.
2026-03-25 16:20:21 +08:00
16e2065c6c Unified logging: Replace LogSystem with EditorConsoleSink
- Created EditorConsoleSink (implements ILogSink interface)
- EditorConsoleSink stores logs in memory buffer (max 1000 entries)
- Added to Debug::Logger in Application::Initialize()
- ConsolePanel now reads from EditorConsoleSink via static GetInstance()
- Removed separate LogSystem singleton
- Removed editor/src/Core/LogEntry.h (no longer needed)

Now Editor and Engine share the same Debug::Logger, with ConsolePanel
displaying logs via EditorConsoleSink.
2026-03-25 16:13:02 +08:00
b08f682e5c Migrate InspectorPanel to use IEditorContext and EventBus
- Replace SelectionManager::Get() singleton with m_context->GetSelectionManager()
- Use EventBus for selection change events instead of direct subscription
- Store entity ID (uint64_t) instead of GameObject* pointer
- Resolve entity ID to GameObject* via SceneManager::GetEntity()
- Remove direct includes of SelectionManager.h
2026-03-25 15:54:22 +08:00
008fb98dee refactor(editor): Complete architecture refactoring
- SceneManager: remove singleton, use dependency injection via EditorContext
- SelectionManager: already interface-based via ISelectionManager
- Panel: now receives IEditorContext for accessing managers
- HierarchyPanel: migrated to use IEditorContext instead of singletons
- Add ISceneManager interface and SceneManagerImpl
- EditorContextImpl: holds all editor subsystems

Architecture now follows dependency injection pattern:
Application -> EditorContext -> SceneManager/SelectionManager
EditorLayer -> Panels (receive context via SetContext)

All Manager singletons removed: EditorSceneManager::Get(), SelectionManager::Get()
2026-03-25 15:51:27 +08:00
56ec2e9b85 refactor(editor): Phase 1 architecture refactoring
- Decouple Panel from Core::Layer (P0 issue resolved)
- Add EventBus with type-safe event system
- Add ISelectionManager interface with SelectionManagerImpl
- Add IEditorContext for dependency injection
- Update EditorLayer to use new architecture
- Update Application to create and inject EditorContext

New files:
- editor/src/Core/EventBus.h
- editor/src/Core/EditorEvents.h
- editor/src/Core/ISelectionManager.h
- editor/src/Core/SelectionManagerImpl.h
- editor/src/Core/IEditorContext.h
- editor/src/Core/EditorContextImpl.h

This enables future improvements: Undo/Redo, serialization, component extensibility.
2026-03-25 15:35:00 +08:00
3478fb414a docs: Update RHI test coverage matrix to v1.4 (P1-7 Compute/Dispatch completed) 2026-03-25 15:10:10 +08:00
720dd422d5 RHI: Add Compute/Dispatch unit tests (P1-7) and fix shader type bugs
Bug fixes:
- D3D12Shader::Compile: Set m_type based on target string (cs_/vs_/ps_/gs_)
- OpenGLShader::Compile: Parse target parameter to determine shader type
- OpenGLShader::CompileCompute: Set m_type = ShaderType::Compute
- D3D12CommandList::SetPipelineState: Use correct PSO handle for Compute

New tests (test_compute.cpp, 8 tests):
- ComputeShader_Compile_ValidShader
- ComputeShader_GetType_ReturnsCompute
- ComputeShader_Shutdown_Invalidates
- PipelineState_SetComputeShader
- PipelineState_HasComputeShader_ReturnsTrue
- PipelineState_GetType_Compute
- PipelineState_EnsureValid_Compute
- CommandList_Dispatch_Basic

Test results: 232/232 passed (D3D12: 116, OpenGL: 116)
2026-03-25 13:52:11 +08:00
da1f8cfb58 docs: Update RHI test coverage matrix and file list 2026-03-25 13:33:49 +08:00
920d3be78b RHI: Add DescriptorPool unit tests (8 tests, P1-5) 2026-03-25 13:21:13 +08:00
fbbf5dca55 docs: Update RHI test refactoring status to v1.2 2026-03-25 13:05:01 +08:00
2ac32e1330 RHI: Add RenderPass and Framebuffer unit tests with CMake support 2026-03-25 13:03:07 +08:00
41cea4d1a2 RHI: Implement CreateRenderPass/CreateFramebuffer in D3D12 and OpenGL backends 2026-03-25 13:03:02 +08:00
2313124cc5 RHI: Add CreateRenderPass/CreateFramebuffer to RHIDevice interface 2026-03-25 13:02:57 +08:00