Commit Graph

382 Commits

Author SHA1 Message Date
66f013a4fc docs: 简化README,移除冗余内容
- 移除RHI单元测试详细说明章节
- 移除测试覆盖表中的重复项
- 添加tests/RHI/unit/目录到项目结构
2026-03-23 18:57:09 +08:00
140c8b8bcc docs: 更新README,添加RHI抽象层测试说明
- 添加 RHI 抽象层测试 (rhi_tests) 到测试覆盖表
- 添加 RHI 单元测试构建和运行说明
- 添加测试目标说明 (rhi_tests, rhi_opengl_tests, rhi_d3d12_tests)
2026-03-23 18:54:20 +08:00
6935a91a1f fix: RHI抽象层单元测试修复
- 实现 D3D12Device::CreateCommandQueue/CreateCommandList/CreateSwapChain
- 修复 Buffer::Map 对 DEFAULT heap 的问题 (Vertex/Index 使用 UPLOAD heap)
- 修复 Fence::IsSignaled() 初始值问题
- 修复 Sampler::GetNativeHandle() 返回值
- 修复 RHICapabilities 和 RHIDeviceInfo 初始化
- 修复 Shader 测试 (空 ShaderCompileDesc 预期)
- 修复 RHITestFixture 创建窗口句柄
- 重命名 opengl_engine_tests -> rhi_opengl_tests
- 添加 tests/RHI/unit/ 到构建系统

测试结果: 22 passed -> 59 passed
2026-03-23 18:53:29 +08:00
66df465661 docs: add renderdoc_parser to project README 2026-03-23 18:53:04 +08:00
aa9b91342e Revert README RenderDocCapture API detail - keep it simple 2026-03-23 18:50:48 +08:00
84e7213e86 docs: update README with accurate function signatures 2026-03-23 18:50:16 +08:00
1f84b3bc3b Update README with RenderDocCapture API documentation
- Add detailed RenderDocCapture API reference in Debug section
- Note OpenGL requires HGLRC (not HDC) as device pointer
- Update RenderDoc example description to mention both D3D12 and OpenGL support
- Add note about renderdoc.dll location
2026-03-23 18:47:25 +08:00
fb01beb959 Add renderdoc_parser: direct-call Python interface for RenderDoc capture analysis
- Convert from MCP protocol layer to direct Python function calls
- 42 functions across 9 modules: session, event, pipeline, resource, data, shader, advanced, performance, diagnostic
- Requires Python 3.6 (renderdoc.pyd is compiled for Python 3.6)
- Fix renderdoc API calls: GetColorBlends, GetStencilFaces, GetViewport(i), GetScissor(i)
- Remove Python 3.10+ type annotations for Python 3.6 compatibility
- Add README.md with full API documentation
- Includes test.py for basic smoke testing
2026-03-23 18:46:20 +08:00
effc969ad3 Update minimal tests to use improved RenderDocCapture API
- OpenGL test: Use BeginCapture/EndCapture with bool return values
- D3D12 test: Use BeginCapture/EndCapture with bool return values
- Both tests: Use GetCapture() to log capture file info
- Added capture file path and size logging after capture
2026-03-23 18:44:12 +08:00
1acea6bf69 Improve RenderDocCapture API
- Add SetWindow() method for separate window configuration
- BeginCapture/EndCapture now return bool for error feedback
- Add GetCapture() method to retrieve capture file info
- Add LaunchReplayUI() method
- Add SetCaptureOptionU32() for user-configurable capture options
- Add null pointer checks in BeginCapture with Logger warnings
- Add RenderDocCaptureInfo struct for capture file metadata
2026-03-23 18:37:22 +08:00
36683b4bb3 Fix RenderDoc OpenGL capture - pass HGLRC instead of HDC
Critical fix: For OpenGL, RenderDoc requires HGLRC (OpenGL context) as
the device pointer, not HDC. Previously OpenGL test incorrectly passed
HDC which caused capture to silently fail (NumCaptures=0).

Changes:
- OpenGLDevice: Add wglCreateContextAttribsARB support for debug context
- OpenGLDevice: Create OpenGL 4.6 core profile with debug flag
- RenderDocCapture: Pass correct window to SetActiveWindow/StartFrameCapture
- OpenGL test: Pass HGLRC via SetDevice(), use BeginCapture/EndCapture

Fix root cause identified via RenderDoc docs analysis:
  'For OpenGL it must be the HGLRC, GLXContext, or EGLContext'
2026-03-23 18:35:49 +08:00
e9f4f2dc49 Integrate RenderDoc frame capture into D3D12 minimal test
- Add SetDevice() and GetNumCaptures() methods to RenderDocCapture
- Fix initialization order: RenderDoc before D3D12, then SetDevice after
- Use nullptr for window param in StartFrameCapture/EndFrameCapture
- Add BeginCapture at frame 29, EndCapture at frame 30
- Set capture file path template to .\minimal_frame30
- Copy renderdoc.dll (26MB redistributable) to test output
- Engine/third_party/renderdoc/ now contains working renderdoc.dll
2026-03-23 17:47:43 +08:00
1cc545a91f docs: update README with RenderDoc integration info 2026-03-23 17:12:02 +08:00
81dc337262 feat: add RenderDocCapture to Debug module for frame capture debugging
- Add RenderDocCapture class for dynamic loading of renderdoc.dll
- Support BeginCapture/EndCapture/TriggerCapture APIs
- Add RenderDoc log category
- Add unit tests for RenderDocCapture in tests/debug
2026-03-23 17:11:01 +08:00
d58d98cb68 feat: add RenderDoc integration for D3D12 frame capture
- Add mvs/RenderDoc project with sphere rendering + RenderDoc capture
- Dynamic loading of renderdoc.dll without header dependencies
- Auto-capture frames 5-6 to .rdc file
- Copy sphere test resources (shaders, textures) via CMake
2026-03-23 03:28:49 +08:00
537808c64d fix: OpenGL sphere test - correct perspective matrix, depth test, texture flip, and screenshot path 2026-03-23 01:42:48 +08:00
f427699ac6 refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
  instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
  test discovery (math, core, containers, memory, threading, debug,
  components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
  from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
  build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
0f0ab8922a docs: fix naming conventions across threading, math, memory, core, and debug modules
threading/:
- Rename 19 camelCase method files to hyphenated names
- task-system: createtaskgroup→create-task-group, etc.
- tasksystemconfig: enabletaskprofiling→enable-task-profiling, etc.
- thread: getcurrentid→get-current-id, etc.
- task: addref→add-ref, getid→get-id, etc.

math/:
- Rename underscore operator files to hyphenated
- vector3: operator_add→operator-add, etc.
- matrix4: gettranslation→get-translation, etc.
- vector4: tovector3→to-vector3, constructor_vector3→constructor-vector3
- sphere: sphere_constructor→sphere-constructor, etc.

memory/:
- Remove duplicate memorymanager/ folder (kept manager/ which was correct)

core/:
- filewriter: Consolidate ctor-default.md and ctor-file.md into constructor.md
- Rename dtor.md→destructor.md

debug/:
- filelogsink: Rename construct.md→constructor.md, ~filelogsink.md→destructor.md

All overview pages updated with new file references.
2026-03-22 23:09:29 +08:00
a4e7785751 fix: use gtest_discover_tests for granular CTest test discovery
Replace add_test() with gtest_discover_tests() to enable CTest to
discover all 55 individual Google Test cases instead of treating them
as a single test. This improves test reporting granularity from 1/1
to 55/55 tests.
2026-03-22 21:53:42 +08:00
fa50892150 refactor: simplify D3D12 test infrastructure
- Delete run_tests.py and run_tests.bat (use cmake/ctest directly)
- Fix integration test CMakeLists: output_ppm name, threshold=0, GT.ppm copy
- Rewrite TEST_SPEC.md to be concise
- Update integration test CTest registration
2026-03-22 21:41:56 +08:00
50b50d06a0 refactor: move run_tests.py to tests/ and fix integration test GT.ppm paths 2026-03-22 20:37:13 +08:00
74adeb74a0 cleanup: remove unused shader/model/image folders from RHI integration tests 2026-03-22 20:15:17 +08:00
0eadc7cfd1 refactor: use XCEngine::Math module in sphere test, update matrix to left-handed coordinate system
- Use Matrix4x4 type directly instead of float[16]
- Remove wrapper functions (IdentityMatrix, TranslationMatrix, PerspectiveMatrix, LookAtMatrix, MultiplyMatrix, TransposeMatrix)
- Direct use of Matrix4x4::Identity(), Matrix4x4::Translation(), Matrix4x4::Perspective()
- Transpose matrices before uploading to GPU to match HLSL column-major
- Update Math module Perspective and Orthographic to left-handed coordinate system
- Update math unit tests for new matrix values
2026-03-22 20:08:36 +08:00
70cc86793f docs: update TEST_SPEC.md with quad and sphere integration tests
- Add quad and sphere to integration test directory structure
- Update current integration tests table with both tests
- Update file structure section
- Bump version to 1.4
2026-03-22 18:48:56 +08:00
7d1362a41e fix: D3D12 sphere - enable depth write, fix texture UV seam tearing and orientation
- Enable depth write mask (D3D12_DEPTH_WRITE_MASK_ALL) to fix rendering artifacts
- Change texture address mode from Wrap to Clamp to fix UV seam tearing
- Remove V coordinate flip in shader to fix upside-down texture
- Add ground truth screenshot (GT.ppm) for testing
2026-03-22 18:41:11 +08:00
6c92164a03 fix: D3D12 sphere rendering - correct matrix math, enable depth test, add texture sampling
- Fix TranslationMatrix to use correct indices (m12/m13/m14 for translation)
- Fix PerspectiveMatrix projection formula
- Enable depth testing (was disabled)
- Add texture sampling in pixel shader
- Adjust sphere radius to 1.0 and position to z=5
- Fix D3D12Buffer copy size calculation
2026-03-22 17:58:30 +08:00
fa2d2713d7 feat: 实现 Window 与 InputModule 消息集成 2026-03-22 17:14:11 +08:00
cf9229fc21 test: 添加 Input 模块单元测试
- 创建 tests/Input 目录和 CMakeLists.txt
- 添加 28 个测试用例覆盖:
  - InputManager: Singleton, Initialize/Shutdown, 按键状态, 鼠标, 轴, 按钮
  - InputAxis: 默认构造, 正负键, SetValue
  - InputEvent: KeyEvent, MouseButtonEvent, MouseMoveEvent, MouseWheelEvent, TextInputEvent
2026-03-22 16:22:13 +08:00
8d4447915d feat: add RHI abstraction layer unit tests
- Add RHITestFixture with RHI_BACKEND env var support for backend selection
- Add unit tests for: Device, Buffer, Texture, SwapChain, CommandList, CommandQueue, Shader, Fence, Sampler
- Tests can run against D3D12 or OpenGL backends via RHI_BACKEND env var
- Add integration folder placeholder for future integration tests
2026-03-22 16:18:51 +08:00
a980f2bd66 fix: 修复InputManager中文注释警告和完善Update逻辑
- InputManager.h: 移除中文注释修复C4819警告
- InputManager.h: 添加缺失的vector和unordered_map头文件
- InputManager.cpp: Update()现正确清除m_keyDownThisFrame状态
- InputManager.cpp: ProcessKeyDown/Up添加修饰键参数
- WindowsInputModule: 传递alt/ctrl/shift修饰键状态
2026-03-22 15:25:53 +08:00
36d3decef6 feat: 添加独立的输入系统和平台抽象层
- 新增 Platform 模块:PlatformTypes.h, Window.h, WindowsWindow
- 新增 Input 模块:InputTypes, InputEvent, InputAxis, InputModule, InputManager
- 新增 WindowsInputModule 处理 Win32 消息转换
- 将 RHI 集成测试从 render_model 迁移到 sphere
- 更新 CMakeLists.txt 添加 Platform 和 Input 模块
2026-03-22 15:21:52 +08:00
6af872e9eb docs: fix Resources module API docs naming conventions and broken links
- Rename constructor/destructor files to follow template spec:
  - ctor.md → constructor.md, dtor.md → destructor.md (audioclip)
  - texture_constructor.md → constructor.md, texture_destructor.md → destructor.md (texture)
  - material-loader-constructor.md → constructor.md, material-loader-destructor.md → destructor.md

- Create missing constructor/destructor docs:
  - audio-loader: constructor.md, destructor.md
  - texture-loader: constructor.md, destructor.md

- Fix broken links to ResourceManager:
  - shader-loader/index.md
  - material-loader/index.md

- Remove duplicate folders (keep hyphenated versions):
  - Delete shaderloader/ (keep shader-loader/)
  - Delete resourcepackage/ (keep resource-package/)
  - Merge textureimportsettings/ into texture-import-settings/

- Rename audio-loader method files:
  - canload.md → can-load.md
  - getdefaultsettings.md → get-default-settings.md
  - getsupportedextensions.md → get-supported-extensions.md

- Update overview pages with proper method links and constructor/destructor entries
2026-03-22 14:42:27 +08:00
1797e7fe17 fix: encapsulate OpenGL types in VertexAttribute to eliminate raw GL API usage in tests
- Add VertexAttributeType and VertexAttributeNormalized enums in OpenGLVertexArray.h
- Add ToGLAttributeType() converter in OpenGLVertexArray.cpp
- Remove glActiveTexture() call from quad test (already handled by texture.Bind())
- Remove #include <glad/glad.h> from triangle test
- Update unit tests to use encapsulated enums

All three OpenGL integration tests (minimal, triangle, quad) pass with 0% pixel difference.
2026-03-22 14:33:57 +08:00
1f129ed20f docs: fix README.md project structure to match actual codebase
Engine modules:
- Audio: remove AudioSource/Listener components (they belong in Components/), add IAudioEffect.h
- Components: add AudioSourceComponent.h and AudioListenerComponent.h
- Math: remove non-existent OBB.h
- Resources: fix DependencyGraph.h -> ResourceDependencyGraph.h
- Threading: add TaskSystemConfig.h
- RHI: remove incorrect RHIDescriptor.h (already covered by RHIDescriptorPool.h)

Backend fixes:
- OpenGL: add OpenGLScreenshot.h
- D3D12: fix file order (D3D12Enum.h before D3D12Types.h)
2026-03-22 14:18:48 +08:00
7028027adc Fix Equalizer::ComputeCoefficients pointer arithmetic bug
The band index was incorrectly calculated using pointer arithmetic on a
local parameter address, which is meaningless. Now uses the band index
passed as a parameter instead.
2026-03-22 13:36:10 +08:00
750ac95951 docs: update README.md and fix components module docs
- Update README.md project structure docs/api section
  - Add missing audio/, components/, scene/ directories
  - Reorder alphabetically
- Update Components test count from 2+ to 3
- Expand documentation section with module listings
- Remove incomplete audio-source and audio-listener component docs
  from components.md (referenced 30+ and 16+ non-existent method docs)
2026-03-22 13:28:14 +08:00
a399eeec26 Fix OpenGL quad texture coordinate handling
- Remove shader flip (1.0 - texcoord.y was incorrect)
- Set flipVertical = false (stb_image loads texture correctly as-is)
- Update GT.ppm with correct rendering output
- OpenGL quad now matches D3D12 GT exactly (0% diff)
2026-03-22 13:00:10 +08:00
70571d11df 添加 Components 和 Scene 序列化支持
- Component: 添加 Serialize/Deserialize 虚函数
- TransformComponent: 实现 Transform 数据的序列化/反序列化
- GameObject: 实现对象序列化/反序列化
- Scene: 实现 Save/Load 方法,支持场景文件保存和加载
- 测试: 添加 Save_And_Load 和 Save_ContainsGameObjectData 测试
2026-03-22 03:42:40 +08:00
a9d5a68dd6 docs: Add Component, GameObject, TransformComponent and Scene API documentation
- Add Component class documentation with lifecycle methods
- Add GameObject class documentation with component system
- Add TransformComponent documentation with transform methods
- Add Scene class documentation with GameObject management
- Add SceneManager singleton documentation with scene loading
- Update components.md overview with all component classes
- Update main.md navigation with Scene module
2026-03-22 03:33:55 +08:00
d83ed56177 fix(rhi): Fix RHI abstraction layer API docs per api-skill.md template
- Rename texture/dtor.md to destructor.md per template spec
- Remove duplicate non-hyphenated fence docs (getnativehandle.md, issignaled.md, getcompletedvalue.md)
- Fix template field issues:
  - swap-chain, command-queue: 类型 now uses 'class (abstract)'
  - sampler: 头文件 now uses full path 'XCEngine/RHI/RHISampler.h'
  - types: 类型 fixed from 'structs' to 'struct'
  - enums: 类型 fixed from 'enums' to 'enum class'
- Fix include paths in command-queue and pipeline-layout code examples
- Create missing constructor/destructor docs for 11 classes:
  buffer, texture, shader, device, command-list, command-queue,
  fence, sampler, swap-chain, pipeline-state, pipeline-layout
- Update class overview pages to include constructor/destructor entries
2026-03-22 03:07:41 +08:00
11919aad2f Add OpenGL quad integration test with texture mapping
- Add tests/RHI/OpenGL/integration/quad/ with main.cpp, CMakeLists.txt
- Add GLSL shaders (quad.vert, quad.frag) for textured quad rendering
- Use OpenGLVertexArray, OpenGLBuffer, OpenGLShader, OpenGLPipelineState
- Add OpenGLTexture::LoadFromFile for texture loading (earth.png)
- Add OpenGLSampler for texture sampling configuration
- Disable depth test for 2D quad rendering
- GT.ppm generated from OpenGL rendering output (0% diff on re-run)
2026-03-22 03:03:14 +08:00
f8e7edd2c1 Add OpenGL triangle integration test with GLSL shaders
- Add tests/RHI/OpenGL/integration/triangle/ with main.cpp, CMakeLists.txt
- Add GLSL shaders (triangle.vert, triangle.frag) for vertex/fragment shading
- Use OpenGLVertexArray, OpenGLBuffer, OpenGLShader, OpenGLPipelineState
- Disable depth test to allow 2D triangle rendering
- GT.ppm reused from D3D12 triangle test (0% diff)
2026-03-22 02:30:52 +08:00
3357de85c9 修复 Components 和 Scene 模块测试问题
1. GameObject 析构函数:从全局注册表移除自己,防止悬挂指针
2. SceneManager 测试:事件订阅后正确 Unsubscribe,防止 lambda 销毁后悬挂调用
3. SceneManager 测试:使用唯一场景名称避免覆盖问题
2026-03-22 02:10:32 +08:00
1358bb0a5a docs: 修复 D3D12 后端 API 文档问题
- 修复 texture/dtor.md 和 enums/enums.md 的错误链接
- 重命名 texture/ctor.md → constructor.md, texture/dtor.md → destructor.md
- 创建 command-list, fence, device, query-heap, sampler 的 constructor/destructor 文档
- 创建 D3D12Texture 缺失的 16 个方法文档
- 创建 D3D12CommandList 缺失的 12 个 internal 方法文档
- 补充 shader-resource-view 缺少的头文件和类型字段
2026-03-22 02:08:51 +08:00
2432a646ce Fix audio module: implement WAV parsing and audio playback
- Implement ParseWAVData and ParseWAVHeader in AudioLoader to properly
  parse WAV file headers (sample rate, channels, bits per sample, duration)
- Modify Load() to call ParseWAVData for WAV files during loading
- Add DecodeAudioData() to AudioSourceComponent to decode PCM bytes to float
- Update SetClip() to trigger audio decoding
- Fix ProcessAudio() to read from decoded data instead of empty output buffer
- Add WAV parsing unit tests (ParseWAV_Mono44100_16bit, ParseWAV_Stereo48000_16bit)

Fixes issues:
- AudioLoader::ParseWAVData was a stub returning true without parsing
- AudioLoader::Load didn't extract audio metadata from WAV headers
- AudioSourceComponent::ProcessAudio read from empty m_outputBuffer

All 167 tests pass.
2026-03-22 02:03:51 +08:00
161a0896d5 docs: 添加 Audio 模块和 Components 模块 API 文档
- 新增 Audio 模块文档 (54 个文件)
  - AudioSystem 单例类及 20 个方法页
  - AudioMixer 混音器类及 11 个方法页
  - IAudioBackend、IAudioEffect 接口
  - FFTFilter、Reverbation、Equalizer、HRTF 效果类
  - WASAPIBackend Windows 后端
  - AudioConfig、Audio3DParams 等结构体
  - 9 个枚举类型文档
- 新增 Components 模块文档 (3 个文件)
  - AudioSourceComponent 音频源组件
  - AudioListenerComponent 音频监听器组件
- 更新 docs/api/main.md 添加模块导航
2026-03-22 01:56:16 +08:00
6e5ed41fbf docs: 全面更新 README.md 项目结构描述 2026-03-22 01:28:21 +08:00
a172d75e36 Add Music fluctuations project and Chinese plan docs 2026-03-21 15:55:54 +08:00
629455df07 Update API documentation and remove obsolete plan files 2026-03-21 15:55:04 +08:00
7a6cd412c8 Remove kissfft third party library and update OpenGL screenshot 2026-03-21 15:54:42 +08:00