Commit Graph

458 Commits

Author SHA1 Message Date
572e0e9bd5 OpenGL: Refactor integration test and enable CTest framework
- Simplify OpenGL integration test structure
- Enable CTest registration for OpenGL tests
- Refactor test fixtures and device enumeration
- Minor code cleanup and improvements
2026-03-20 19:05:50 +08:00
45fd25dce3 D3D12: Add triangle integration test with rainbow gradient
- Add triangle test with vertex buffer and custom pipeline state
- Add triangle.hlsl shader with position and color per vertex
- Fix cull mode (NONE) and disable depth test for correct rendering
- Register D3D12_Triangle_Integration CTest
- Add GT.ppm golden image
2026-03-20 19:05:22 +08:00
26fe3cd835 D3D12: Add bounds check to GetBackBuffer and update unit tests
- Add assert() bounds check to GetBackBuffer() to catch invalid indices
- Include <cassert> in D3D12SwapChain.cpp
- Update test_swap_chain.cpp to use reference return type
- Mark InvalidIndex test as DISABLED (assert aborts on invalid index)
- Update get-back-buffer.md documentation
2026-03-20 18:35:00 +08:00
460a2477c3 OpenGL: Add minimal integration test and enable integration test framework
- Add OpenGL_Minimal integration test using Win32 native API + glad
- Copy run_integration_test.py and compare_ppm.py from D3D12
- Create minimal/main.cpp with red clear color (matching D3D12)
- Generate GT.ppm golden template for 1280x720 red window
- Add VertexArray_Bind_MultipleAttributes unit test
- Update integration/CMakeLists.txt to build OpenGL_Minimal target
2026-03-20 18:30:38 +08:00
34c04af6cb D3D12: Fix texture ownership semantics and remove GetSwapChain() exposure
This commit fixes the D3D12 texture architecture issues:

1. D3D12Texture ownership semantics:
   - Add m_ownsResource member to track resource ownership
   - InitializeFromExisting() now takes ownsResource parameter (default false)
   - Shutdown() only releases resource if ownsResource is true
   - Initialize() sets m_ownsResource = true for created resources

2. D3D12SwapChain changes:
   - Remove GetSwapChain() method (was exposing native D3D12 API)
   - Change GetBackBuffer() to return reference instead of pointer
   - Back buffers initialized with ownsResource = false

3. minimal/main.cpp updates:
   - Remove gColorRTs[2] array (was duplicating back buffer wrapping)
   - Direct use of gSwapChain.GetBackBuffer(i) instead
   - All references updated to use encapsulated API

4. Documentation:
   - Update TEST_SPEC.md v1.3
   - Remove known limitation 7.2 (minimal GetBuffer issue fixed)
   - Add D3D12_Texture_Architecture_Fix_Plan.md design document
2026-03-20 17:58:27 +08:00
0017388498 Rename GT_minimal.ppm to GT.ppm for D3D12 minimal integration test
- Rename golden image file to match simpler convention
- Update CMakeLists.txt reference
- Update TEST_SPEC.md documentation
- Update run_tests.py reference
2026-03-20 17:41:07 +08:00
0a19fdfb0f OpenGL: Restructure tests similar to D3D12 layout
- Move old test files to new unit/integration structure
- Add OpenGL Test Fixture
- Update CMakeLists.txt for new layout
- Add OpenGL_Test_Restructuring_Plan.md
2026-03-20 17:37:09 +08:00
3cd3b04c7e D3D12: Add Screenshot wrapper overload and document known limitations
- Add D3D12Screenshot::Capture(D3D12Device&, D3D12CommandQueue&, D3D12Texture&, const char*) wrapper overload
- Update minimal integration test to use encapsulated APIs
- Add DescriptorHeap wrapper unit tests
- Document minimal GetBuffer native call as known limitation in TEST_SPEC.md
2026-03-20 17:36:51 +08:00
a40544344b 重构ui_editor:向引擎核心类型对齐
- 删除UI::Event,使用XCEngine::Core::Event替代
- GameObject.h重构,Component添加friend class Entity
- LogEntry使用XCEngine::Debug::LogLevel
- SceneManager/SelectionManager使用XCEngine::Core::Event
- LogSystem使用XCEngine::Debug::LogLevel
- CMakeLists.txt添加engine/include路径
2026-03-20 17:28:06 +08:00
376fa08e56 添加ui_editor编辑器模块初始代码 2026-03-20 17:08:06 +08:00
c52b4ef35c 修复D3D12SwapChain初始化bug并添加单元测试
- 修复Initialize(IDXGIFactory4*, ...)重载缺少m_backBuffers初始化的问题
- 新增test_swap_chain.cpp单元测试文件,包含6个SwapChain测试用例
- 更新unit CMakeLists.txt添加test_swap_chain.cpp和Res路径
2026-03-20 17:07:24 +08:00
dba3dc23f2 重构D3D12集成测试目录结构,每个测试独立子文件夹隔离资源 2026-03-20 16:33:35 +08:00
33e9958751 删除nul测试文件 2026-03-20 16:12:33 +08:00
31273fdac4 docs: restructure test specification into two-level system
- tests/TEST_SPEC.md: General test spec for all modules
- tests/RHI/D3D12/TEST_SPEC.md: D3D12-specific spec with CI integration
2026-03-20 03:33:40 +08:00
983d6d61cd ci: add unified test runner scripts/run_tests.py 2026-03-20 03:27:30 +08:00
9ad699cd6f test: rename unit tests to Component_Category_SubBehavior format, remove Placeholder tests 2026-03-20 03:18:30 +08:00
9c5bd3c33f docs: add TEST_SPEC.md for D3D12 test规范 2026-03-20 03:14:55 +08:00
b2228db3ee test: add test improvement plan, update CMakeLists with correct GT_minimal reference 2026-03-20 03:13:24 +08:00
e242b0f5a7 test: register integration tests in CTest with Python wrapper 2026-03-20 03:08:08 +08:00
fae520854e refactor: reorganize unit tests into separate folder
- Move test_*.cpp and fixtures/ to tests/RHI/D3D12/unit/
- Create unit/CMakeLists.txt with proper test configuration
- Simplify parent CMakeLists.txt to use add_subdirectory
- Integration tests remain in integration/ folder
2026-03-20 02:58:33 +08:00
4c6e7af02e refactor: encapsulate frame fence synchronization in CommandQueue
- Add WaitForPreviousFrame() and GetCurrentFrame() to RHICommandQueue interface
- D3D12CommandQueue now manages frame fence internally
- ExecuteCommandLists automatically signals fence after command execution
- OpenGLCommandQueue provides stub implementations for interface compliance
- Minimal test now uses CommandQueue::WaitForPreviousFrame() instead of manual fence
2026-03-20 02:51:34 +08:00
b7d66a09de fix: replace Sleep with proper fence synchronization in minimal test 2026-03-20 02:49:19 +08:00
e01dcfe6ed chore: remove obsolete skill files 2026-03-20 02:38:13 +08:00
ad0c265c4c docs: add blueprint documentation 2026-03-20 02:36:29 +08:00
77ef74bec6 fix: D3D12 screenshot implementation and tests 2026-03-20 02:35:59 +08:00
070b444f8f docs: update RHI API docs 2026-03-20 02:35:45 +08:00
ea756c0177 docs: update resources API docs 2026-03-20 02:35:35 +08:00
fd792b7df1 docs: update memory and threading API docs 2026-03-20 02:35:24 +08:00
c5b17239ca docs: update math API docs 2026-03-20 02:35:15 +08:00
e165dbea1c docs: update core and debug API docs 2026-03-20 02:35:07 +08:00
0c073db4e8 docs: update containers API docs 2026-03-20 02:35:01 +08:00
a647f5e8ec 修复 D3D12 截图功能:修复 GPU 过载导致的设备移除问题
问题根因:
1. 渲染循环帧率过高导致 GPU 过载(TDR)
2. D3D12CommandList::Reset() 未正确调用底层 Reset()

修复内容:
1. 在 Present 后添加 Sleep(10) 延迟防止 GPU 过载
2. 修复 D3D12CommandList::Reset() 正确调用底层 m_commandList->Reset()
3. 在 D3D12CommandList 中存储 CommandAllocator 引用
4. 在 main_minimal.cpp 中添加截图调用逻辑(30帧后截图保存为 minimal.ppm)

修改文件:
- engine/include/XCEngine/RHI/D3D12/D3D12CommandList.h
- engine/src/RHI/D3D12/D3D12CommandList.cpp
- tests/RHI/D3D12/integration/main_minimal.cpp (新增)
2026-03-20 02:25:15 +08:00
7e1782e203 docs: 重写 api-skill.md,完善文档规范与生成流程 2026-03-19 12:41:53 +08:00
5257f3d75c docs: Fix SKILL.md规范 violations - Remove ## 方法列表 and flatten ### sub-headers in ## 公共方法 2026-03-19 02:01:18 +08:00
8e85fd98b8 docs: Remove sub-headers from 公共方法 sections to follow SKILL.md规范 2026-03-19 01:59:38 +08:00
b46d450429 Fix RHI documentation discrepancies
Fixed the following issues:
- command-list.md: Shutdown linked to threading/task-system instead of local shutdown.md
- fence.md: Wait linked to threading/task-group instead of local wait.md
- factory/create-rhi-device-string.md: Claimed Vulkan/Metal support but source doesn't support them
- opengl/buffer/buffer.md: GetType linked to command-queue/get-type (wrong type)
- d3d12/device/device.md: Initialize/Shutdown linked to threading/task-system
- d3d12/command-list/command-list.md: Initialize/Shutdown/Reset/Close/Clear linked to wrong docs
- d3d12/texture/texture.md: Initialize/Shutdown linked to threading/task-system
- opengl/command-list/command-list.md: Shutdown linked to threading/task-system
- opengl/device/device.md: GetNativeHandle incorrectly linked to get-window.md

All links validated with fix_links.py - no broken references remaining.
2026-03-19 01:23:10 +08:00
2076a484d4 Fix debug module documentation structure
- Create overview page for FileLogSink (filelogsink/filelogsink.md)
- Create constructor page for FileLogSink (filelogsink/construct.md)
- Create overview page for ConsoleLogSink (consolelogsink/overview.md)
- Fix self-referencing links in FileLogSink and ConsoleLogSink constructor pages

The constructor pages were incorrectly linking to themselves as 'overview' pages.
Created proper overview pages that list all public methods and link to their
individual documentation pages.
2026-03-19 01:22:11 +08:00
7e4c48d4f9 docs: Document stub/not-implemented methods in resources module
Fixed discrepancies between source code and documentation:
- AsyncLoader: Document Initialize() ignores workerThreadCount, Submit() doesn't do actual async loading, Update() is stub
- ResourceManager: Document UnloadUnused() and ReloadResource() are stubs
- ResourceCache: Document OnZeroRefCount() and Flush() are stubs
- ResourceDependencyGraph: Document TopologicalSort() returns empty (stub)
- ResourceFileSystem: Document GetResourceInfo() doesn't fill modifiedTime, EnumerateResources() is stub
- FileArchive: Document Enumerate() is stub
- ResourcePackageBuilder: Document AddDirectory() is stub
- ImportSettings: Document LoadFromJSON/SaveToJSON are stubs
- TextureImportSettings/MeshImportSettings: Document JSON methods are stubs
- TextureLoader/MeshLoader/MaterialLoader/ShaderLoader/AudioLoader: Document GetDefaultSettings() returns nullptr
- AudioLoader: Document ParseWAVData() is stub, Load() doesn't parse WAV headers
- ShaderLoader: Document DetectShaderType/ParseShaderSource are stubs
- MaterialLoader: Document ParseMaterialData() is stub
- Texture: Document Create() mipLevels=0 behavior, GenerateMipmaps() returns false
- Mesh: Document MeshLoader::Load() is example only
- IResourceLoader: Document GetDefaultSettings() returns nullptr for all loaders
2026-03-19 01:16:12 +08:00
8c719418d0 Add missing destructor documentation for PoolAllocator and ProxyAllocator
- Created docs/api/memory/pool-allocator/~pool-allocator.md documenting the destructor
- Created docs/api/memory/proxy-allocator/~proxy-allocator.md documenting the destructor
- Added ~ProxyAllocator entry to proxy-allocator.md overview table
- Verified link validation passes (no broken references)
2026-03-19 01:15:45 +08:00
94beec946b Fix documentation links and add missing destructor docs
- Add missing ~ProxyAllocator destructor entry to proxy-allocator.md
- Fix relative link paths in resources documentation
2026-03-19 01:14:36 +08:00
7332a2a592 Fix broken link in FileWriter documentation
- Removed broken [FileWriter](FileWriter.md) link from 方法列表 section since the constructor is already documented on the main page and FileWriter.md doesn't exist (file is named filewriter.md)

Also includes link fixes from fix_links.py:
- Fixed relative paths in containers documentation
2026-03-19 01:14:22 +08:00
12ae6f561a docs: Fix containers module documentation discrepancies
- Array::SetAllocator: Remove reference to non-existent PoolAllocator class
- HashMap::SetAllocator: Remove reference to non-existent GetDefaultAllocator()
- HashMap::Copy/Move: Fix move constructor complexity (O(m_bucketCount), not O(1))
- HashMap::iterator: Remove C++20 structured bindings example
- String: Add missing links for operator+ and operator==/!=
2026-03-19 01:14:20 +08:00
2141534995 docs: Fix RHI module documentation discrepancies
Fixed incorrect links in RHI documentation:
- Fixed OpenGL swap-chain docs with wrong references to threading/containers
- Fixed OpenGL texture docs with incorrect buffer/ texture links
- Fixed OpenGL vertex-array docs with wrong threading links
- Fixed OpenGL sampler docs with wrong threading links
- Fixed OpenGL device docs with incorrect swap-chain links
- Fixed fence docs with incorrect command-queue links
- Fixed command-list docs with missing shutdown link
- Fixed get-framebuffer-size.md title mismatch

Added missing documentation:
- Created fence/wait.md
- Created command-list/shutdown.md
- Created swap-chain/resize.md
- Created OpenGL sampler initialize.md, bind.md, unbind.md
2026-03-19 01:07:49 +08:00
452ccd4f8f docs: Add missing resources module documentation
Added documentation for undocumented classes:
- ResourcePath: Path manipulation and GUID conversion utilities
- FileArchive: Archive file reading support
- ResourcePackage/ResourcePackageBuilder: Resource packaging system

Updated resources.md overview to include new documentation modules
and added ImportSettings and ResourceFileSystem to core components.
2026-03-19 01:06:12 +08:00
f436280aa5 Fix math documentation discrepancies
- Vector4.md: Add index mapping (0=x, 1=y, 2=z, 3=w) to operator[] description
- Transform.md: Add proper '运算符' subsection header for operator* documentation

Found and fixed missing operator documentation:
- Vector4: operator[] index mapping was undocumented
- Transform: operator* was listed without proper section header
2026-03-19 01:05:17 +08:00
de4086dbfe docs: Fix core module documentation discrepancies
Fixed the following issues in XCEngine Core module documentation:
- Added 'using namespace XCEngine::Core;' to all code examples that use
  Core types (Event, FileWriter, etc.) without full namespace qualification
- Added missing '#include <XCEngine/Containers/String.h>' to FileWriter
  examples that use Containers::String
- Added '#include <string>' to Flush.md example using std::to_string

Affected files:
- core/core.md: Added using directive and Containers include
- event/*.md: Added using namespace to all 8 event doc files
- filewriter/*.md: Added using namespace and proper includes to all 6 files
2026-03-19 01:04:30 +08:00
3ac93ba2e8 Fix containers documentation discrepancies
- Remove Size() from String docs (does not exist in source, use Length())
- Remove broken links to operator+ and operator==/!= (inline functions)
- Fix string.md to correctly reference Length/Capacity/Empty instead of Size
- Add proper documentation for inline operators in string.md
2026-03-19 01:04:10 +08:00
7dd7858ef2 docs: fix threading module documentation discrepancies
- Fix SpinLock docs: clarify lock()/unlock()/try_lock() are non-const
  (matching source implementation in SpinLock.h)
- Add missing LambdaTask::Execute() method to inherited methods table
- Update TaskGroup::Wait() docs: clarify m_pendingCount never decrements
  causing indefinite block even after all tasks complete (not just
  unexecuted tasks)
- Update TaskGroup::IsComplete() docs: document same m_pendingCount
  issue causing incorrect return values
2026-03-19 01:03:14 +08:00
71413381af docs: fix debug module documentation discrepancies
- Changed include path in debug.md from Logger.h to Debug.h (umbrella header)
- Added XE_ASSERT example in debug.md usage section
- Added documentation for Profiler private types (ProfileNode, ProfileSample)
- Added documentation for Profiler member variables (m_profileStack, m_samples, m_frameStartTime, m_initialized)
- Verified MarkEvent, SetMarker, ExportChromeTracing are correctly marked as stubs
2026-03-19 01:02:15 +08:00
a669ec819d Fix RHI documentation discrepancies and add missing doc files
Fixed incorrect links in OpenGL documentation:
- Fixed wrong links to threading/task-system docs for Initialize/Shutdown methods
- Fixed wrong links to buffer docs for GetNativeHandle methods
- Fixed wrong links to shader docs for Bind/Unbind methods
- Fixed wrong links to command-list docs for Clear/Reset/Close methods
- Fixed wrong links to buffer/get-size.md for width/height methods

Added missing documentation files:
- OpenGL buffer: bind.md, unbind.md, get-type.md, initialize.md
- OpenGL fence: initialize.md, reset.md
- OpenGL swap-chain: get-size.md, initialize.md
- OpenGL render-target-view: initialize.md, shutdown.md, bind.md, unbind.md, clear.md, get-size.md
- OpenGL depth-stencil-view: initialize.md, shutdown.md, bind.md, unbind.md, get-size.md
- OpenGL command-list: clear.md

All links validated with fix_links.py - no broken references.
2026-03-19 00:54:54 +08:00