Commit Graph

199 Commits

Author SHA1 Message Date
c9e459c179 Editor: UI panels and GameObject updates 2026-03-25 01:23:08 +08:00
dc970d215b RHI: Internalize OpenGL-specific methods in OpenGLDevice
- Remove GetTextureUnitAllocator/GetUniformBufferManager from public interface
- Remove SwapBuffers from public interface (friend OpenGLSwapChain can still access)
- Add MakeContextCurrent() and GetNativeContext() public methods
- Update integration tests to use MakeContextCurrent() instead of wglMakeCurrent
- Update RenderDoc calls to use GetNativeContext() instead of GetGLContext()
- Remove Device_SwapBuffers_NoErrors test (SwapBuffers no longer public)
- Mark Priority 7 as completed in RHI_Design_Issues.md
2026-03-25 01:20:38 +08:00
6328ac8d37 RHI: Add Compute Pipeline abstraction with D3D12 and OpenGL support
- Add SetComputeShader/GetComputeShader/HasComputeShader to RHIPipelineState
- Add m_computePipelineState for D3D12 compute PSO
- Add m_computeProgram/m_computeShader for OpenGL
- Fix OpenGLCommandList::DispatchCompute bug (was ignoring x,y,z params)
- Fix OpenGLShader::GetID usage in OpenGLPipelineState
- Mark Priority 8 as completed in RHI_Design_Issues.md
2026-03-25 01:05:03 +08:00
da48b808cd RHI: Remove无效的SetGlobal*方法 - 死代码清理
问题:SetGlobal*方法(SetGlobalInt/SetGlobalFloat/SetGlobalVec3/SetGlobalVec4/SetGlobalMat4/SetGlobalTexture)在D3D12和OpenGL中都只是缓存值,从不提交到GPU。

移除内容:
- RHICommandList.h: 移除6个SetGlobal*纯虚方法声明
- D3D12CommandList.h/cpp: 移除6个override声明+6个缓存变量+6个方法实现+Shutdown()中的缓存清理
- OpenGLCommandList.h/cpp: 同上

原因:
- SetGlobal*从未被代码库调用(死代码)
- SetUniform*已正常工作,使用shader reflection+实际GPU绑定
- 移除后无功能损失

测试状态:150个RHI单元测试全部通过,8个集成测试全部通过
2026-03-25 00:52:36 +08:00
a2fc8eca02 RHI: Remove无效的动态状态方法 - SetDepthStencilState/SetBlendState
重构原因:
- D3D12 PSO是不可变的,SetDepthStencilState/SetBlendState调用原本就是空实现(TODO)
- 这些方法在D3D12中完全无效,是死代码

移除的方法:
- SetDepthStencilState(const DepthStencilState&) - D3D12空实现,OpenGL直接调用GL函数
- SetBlendState(const BlendState&) - D3D12只设置BlendFactor其他忽略,OpenGL直接调用GL函数

保留的真正动态状态:
- SetViewport/SetViewports
- SetScissorRect/SetScissorRects
- SetStencilRef (D3D12动态状态)
- SetBlendFactor (D3D12动态状态)

注:PrimitiveTopology保留在CommandList,因为D3D12允许动态改变topology type

测试状态:150个RHI单元测试全部通过,8个集成测试全部通过
2026-03-25 00:37:18 +08:00
c6fe9547aa RHI: Add DescriptorSet abstraction for D3D12 and OpenGL backends
- Add RHIDescriptorSet base class with Update/UpdateSampler/GetNativeHandle
- Add RHIDescriptorPool with AllocateSet/FreeSet methods
- Add SetGraphicsDescriptorSets/SetComputeDescriptorSets to RHICommandList
- Implement D3D12DescriptorSet using descriptor heap allocation
- Implement OpenGLDescriptorSet using TextureUnitAllocator
- Add CreateDescriptorPool/CreateDescriptorSet factory methods to RHIDevice
- Fix unit test SetVertexBuffer -> SetVertexBuffers API
- Add SetVertexBuffer convenience method for D3D12 backward compatibility
- Update CMakeLists.txt with new source files
2026-03-25 00:26:16 +08:00
5eb731bc2d RHI: Add explicit RenderPass abstraction (BeginRenderPass/EndRenderPass)
New abstractions:
- RHIFramebuffer: Framebuffer interface with Initialize/Bind/GetHandle
- RHIRenderPass: RenderPass interface with AttachmentDesc for load/store actions
- D3D12Framebuffer/D3D12RenderPass: D3D12 implementation
- OpenGLFramebuffer/OpenGLRenderPass: OpenGL implementation (adapted from existing)

RHICommandList changes:
- Added BeginRenderPass(RHIRenderPass*, RHIFramebuffer*, Rect, clearValues...)
- Added EndRenderPass()

Implementation notes:
- D3D12: Uses OMSetRenderTargets + ClearRenderTargetView (fallback from native RenderPass API)
- OpenGL: Uses glBindFramebuffer + glClearBufferfv for LoadOp handling
- Old SetRenderTargets/ClearRenderTarget retained for backward compatibility

All 845 tests pass.
2026-03-24 23:59:44 +08:00
1e88beacb8 RHI: Fix view type signatures in CommandList abstraction
- Unified RHICommandList interface to use RHIResourceView* for all view types
- Fixed OpenGLCommandList override signatures (SetVertexBuffers, SetIndexBuffer, etc.)
- Fixed D3D12CommandList by removing duplicate SetVertexBuffer methods
- Updated OpenGLCommandList.cpp to match new signatures
- Build and all 845 tests pass
2026-03-24 23:41:57 +08:00
7a66913f2b refactor(RHI): 将窗口职责从RHI移到Platform层
- RHIDeviceDesc 删除 windowHandle/width/height/appName
- SwapChainDesc 添加 windowHandle 字段
- RHISwapChain 删除 PollEvents/ShouldClose/SetFullscreen 等窗口相关接口
- OpenGLDevice 删除 CreateRenderWindow,改用 InitializeWithExistingWindow
- 更新所有集成测试使用新API
- 273个单元测试 + 8个集成测试全部通过
2026-03-24 23:00:49 +08:00
cab290b17d RHI: 增强RHIResourceView抽象接口,添加GetViewType/GetDimension/GetFormat虚函数
- 在RHIResourceView基类添加3个纯虚函数:GetViewType()、GetDimension()、GetFormat()
- D3D12ResourceView和OpenGLResourceView子类实现这些虚函数
- 在各InitializeAs*方法中正确存储format和dimension信息
- 消除调用者必须向下转型才能获取视图类型的需求
2026-03-24 20:01:54 +08:00
0f5d018c1a refactor(RHI): 完成 Shader uniform 设置迁移到 CommandList
- 删除 RHIShader 的 OpenGL 风格 SetMat4/SetVec3/SetInt 等方法
- 添加 UniformInfo 结构体和 GetUniformInfos/GetUniformInfo 接口
- D3D12Shader 和 OpenGLShader 实现 CacheUniformInfos
- RHICommandList 添加 SetUniform*/SetGlobal* 统一接口
- D3D12 实现 D3D12PipelineLayout 管理 root signature 映射
- 修复 D3D12CommandList::SetPipelineStateInternal 在 Reset 后未重新应用 root signature 的问题
- 更新 OpenGL 集成测试使用新的 SetUniform* API
- 所有单元测试和集成测试通过 (8/8 integration tests)
2026-03-24 19:47:22 +08:00
135fe9145b refactor(editor): 重构 Editor 使用 Engine 的 Component/Scene 系统
- Editor CMakeLists.txt 链接 XCEngine 库
- 删除 editor/src/Core/GameObject.h (简化版)
- SelectionManager 使用 Engine::Components::GameObject*
- SceneManager 使用 Engine::Scene
- HierarchyPanel 使用 Engine GameObject API
- InspectorPanel 使用 Engine TransformComponent

注意: Engine RHI Shader 接口有编译错误需要修复
2026-03-24 18:38:01 +08:00
c66ba2feb3 refactor(RHI): complete PipelineState Unity SRP style refactoring
- Fix Chinese character encoding issues causing MSVC C4819 warnings
- Add m_rootSignature member to D3D12PipelineState for PSO creation
- All integration tests pass: OpenGL 4/4, D3D12 4/4
- All RHI unit tests pass: 158/158
2026-03-24 18:33:16 +08:00
0dde7234b7 refactor(RHI): remove void* from CommandList interfaces and fix OpenGL MRT bug
- Remove void* parameters from RHICommandList abstract interface
- TransitionBarrier, SetVertexBuffer, SetIndexBuffer, SetRenderTargets,
  ClearRenderTarget, ClearDepthStencil, CopyResource now use RHIResourceView*
- SetPipelineState now uses RHIPipelineState* instead of void*
- Simplified SetVertexBuffer to 3 params, SetIndexBuffer to 2 params
- Add internal D3D12 APIs for native type support (low-level escape hatch)
- Fix OpenGL SetRenderTargets to call glDrawBuffers for MRT support
- Update tests to match new interface signatures

All 289 RHI tests pass (158 unit + 64 OpenGL backend + 58 D3D12 backend + 8 integration + 1 disabled)
2026-03-24 17:20:51 +08:00
d575532966 docs: update TEST_SPEC.md and README.md to reflect new directory structure
- TEST_SPEC.md: Updated test directory structure to reflect Core/Asset,
  Core/IO, and Resources/<Type> subdirectories
- TEST_SPEC.md: Updated module names and test counts (852 total)
- TEST_SPEC.md: Updated build commands for new Resources subdirectories
- README.md: Updated engine structure with Core/Asset/ and Core/IO/
- README.md: Updated Resources section with layered architecture
- README.md: Updated test coverage table with accurate counts
2026-03-24 16:14:05 +08:00
0b3423966d refactor(tests): reorganize tests directory to match engine structure
- Created tests/Core/Asset/ with tests for IResource, ResourceTypes, ResourceHandle, ResourceCache, ResourceDependencyGraph, ResourceGUID
- Created tests/Core/IO/ with tests for IResourceLoader, ResourcePath, ResourceFileSystem, FileArchive, ResourcePackage
- Reorganized tests/Resources/ into subdirectories: Texture/, Mesh/, Material/, Shader/, AudioClip/
- Added CMakeLists.txt for each new test subdirectory
- Fixed Material.h missing ResourceManager.h include (lost during engine refactor)
- tests/Core/CMakeLists.txt updated to include Asset/ and IO/ subdirectories
2026-03-24 15:44:13 +08:00
50c0ffdb9e refactor: reorganize Resources module into Core/Asset, Core/IO and Resources subdirectories
- Split core resource architecture into Core/Asset/ (IResource, ResourceManager, ResourceCache, etc.)
- Moved IO layer into Core/IO/ (IResourceLoader, ResourceFileSystem, etc.)
- Reorganized concrete resource types into Resources/{Texture,Mesh,Material,Shader,AudioClip}/
- Updated all include paths from relative to <XCEngine/...> format
- Fixed circular dependency in Material.h (removed unnecessary ResourceManager.h include)
- Fixed malformed include syntax in ResourceManager.h and AsyncLoader.h
- Fixed glad.h path issues in CMakeLists.txt
2026-03-24 14:46:17 +08:00
b1829bcfc5 【关键节点】OpenGLCommandList实现RHIResourceView*方法完成统一资源绑定
OpenGL实现:
- TransitionBarrier: 调用glMemoryBarrier(GL_ALL_BARRIER_BITS)
- SetRenderTargets: 通过framebuffer绑定渲染目标
- SetVertexBuffer: 绑定GL_ARRAY_BUFFER并设置顶点属性
- SetIndexBuffer: 绑定GL_ELEMENT_ARRAY_BUFFER
- ClearRenderTarget: 临时切换framebuffer清除颜色缓冲
- ClearDepthStencil: 临时切换framebuffer清除深度 stencil缓冲
- CopyResource: 使用glCopyImageSubData复制纹理数据

新增单元测试:
- CommandList_TransitionBarrier_WithResourceView
- CommandList_SetRenderTargets_WithResourceView
- CommandList_SetVertexBuffer_WithResourceView
- CommandList_SetIndexBuffer_WithResourceView
- CommandList_ClearRenderTarget_WithResourceView
- CommandList_ClearDepthStencil_WithResourceView
- CommandList_CopyResource_WithResourceView

验证: 158个RHI单元测试全部通过, OpenGL集成测试全部通过
2026-03-24 05:23:42 +08:00
e2050e35ec 【关键节点】RHICommandList添加RHIResourceView*方法重载实现统一资源绑定接口
- 在RHICommandList.h中添加7个RHIResourceView*方法重载:
  - TransitionBarrier(RHIResourceView*, ...)
  - SetRenderTargets(count, RHIResourceView**, RHIResourceView*)
  - SetVertexBuffer(slot, RHIResourceView*, ...)
  - SetIndexBuffer(RHIResourceView*, ...)
  - ClearRenderTarget(RHIResourceView*, ...)
  - ClearDepthStencil(RHIResourceView*, ...)
  - CopyResource(RHIResourceView*, RHIResourceView*)

- D3D12CommandList完整实现:
  - 通过D3D12ResourceView::GetResource()获取底层资源
  - 通过D3D12ResourceView::GetCPUHandle()获取RTV/DSV句柄

- OpenGLCommandList添加stub实现保持接口一致

- 验证: 144个单元测试全部通过, 4个D3D12集成测试全部通过
2026-03-24 05:11:47 +08:00
eb4840eac4 【关键节点】修复D3D12CommandQueue::ExecuteCommandLists类型混淆bug并完善集成测试配置
1. D3D12CommandQueue::ExecuteCommandLists修复:确保正确调用GetNativeHandle()
2. 集成测试修复:传递&gCommandList而不是gCommandList.GetCommandList()
3. CMakeLists.txt修复:添加renderdoc.dll到所有D3D12/OpenGL集成测试的POST_BUILD命令

测试验证:
- 单元测试:144/144通过
- D3D12集成测试:minimal/quad/triangle/sphere全部通过
- OpenGL集成测试:minimal/quad/triangle/sphere全部通过
2026-03-24 05:00:38 +08:00
0a3fe842b9 Refactor RHI ResourceView abstraction layer for unified cross-platform interface
- Create unified RHIResourceView base interface with type-specific Initialize methods
- Implement D3D12ResourceView with RTV/DSV/SRV/UAV/CBV support
- Implement OpenGL ResourceView simulation layer using FBO, texture units, and UBO
- Add OpenGLTextureUnitAllocator for managing texture unit bindings
- Add OpenGLUniformBufferManager for UBO binding points
- Add OpenGLFramebuffer for FBO management
- Remove deprecated D3D12 view classes (RenderTargetView, DepthStencilView, etc.)
- Fix ExecuteCommandLists type confusion bug by adding GetNativeHandle to RHICommandList
- Fix test bug where Close() was called before ExecuteCommandLists
- Update all integration tests to use new D3D12ResourceView class
- All tests pass: 144 unit tests + 8 integration tests
2026-03-24 03:49:13 +08:00
92ab6f5484 Fix D3D12CommandQueue::ExecuteCommandLists type confusion bug
- Cast void* to ID3D12CommandList* directly instead of D3D12CommandList*
- Remove erroneous Reset() call - caller is responsible for resetting
- Fixes SEH exception 0xc0000005 when executing command lists
2026-03-24 02:35:59 +08:00
08c01dd143 RHI: Refactor Fence module to pure timeline semantics
- Remove IsSignaled() from RHIFence interface (semantic inconsistency)
- Remove Reset() from OpenGL implementation (no D3D12 counterpart)
- OpenGL Fence now uses single GLsync + CPU counters for timeline simulation
- OpenGL Fence Initialize() now accepts uint64_t initialValue (was bool)
- Add comprehensive timeline semantics tests for all backends:
  - Signal increment/decrement scenarios
  - Multiple signals
  - Wait smaller than completed value
  - GetCompletedValue stages verification
- Update documentation to reflect actual implementation
2026-03-24 01:53:00 +08:00
92d817e16e D3D12: Fix GetCompletedValue() returning hardcoded 0
Was returning 0 unconditionally. Now correctly returns
m_frameFence->GetCompletedValue() to report GPU progress.
2026-03-24 00:22:37 +08:00
c700e536c5 D3D12: Implement ClearRenderTarget by tracking bound RTV handles
- Add m_boundRenderTargets and m_boundDepthStencil members to D3D12CommandList
- SetRenderTargetsHandle now saves bound RTV handles for later clear operations
- ClearRenderTargetView(ID3D12Resource*, ...) clears all bound render targets
- Reset() clears bound targets list
- Follows D3D12 best practice: RTV is bound via OMSetRenderTargets, then cleared
2026-03-24 00:16:57 +08:00
36c1c8338f fix: D3D12 CommandQueue and SwapChain unit test fixes
- CommandQueue::ExecuteCommandLists: fix type conversion from void** to ID3D12CommandList**, reset command list before execution, add null checks
- SwapChain::ShouldClose: add m_shouldClose member and implement getter/setter
- SwapChain::SetFullscreen: add m_fullscreen member to track state locally
2026-03-23 23:52:27 +08:00
062984953e 【关键节点】OpenGL RenderDoc 捕获修复完成
## 修复内容

### OpenGL SwapChain 架构重构
- OpenGLSwapChain 现在从 OpenGLDevice 获取 HDC,统一管理
- OpenGLDevice 拥有 HDC/HGLRC 的完整生命周期
- OpenGLSwapChain::Present() 使用 device->GetPresentationDC()

### API 变更
- GetContext() → GetGLContext()
- GetDC() → GetPresentationDC()
- Initialize(device*, hwnd, width, height) 新签名

### 修复的测试
- minimal: rdc 34KB
- triangle: rdc 50KB
- quad: rdc 3.2MB
- sphere: rdc 3.2MB

### 根本原因
之前传 HDC 给 RenderDoc::SetDevice(),需要传 HGLRC 才能正确 hook OpenGL 函数
2026-03-23 21:55:34 +08:00
89d13a4ae4 fix: D3D12 CreateTexture defaults and CommandList RTV support
- Add default value handling for sampleCount, mipLevels, depth in CreateTexture
- Add RTV descriptor heap to D3D12CommandList for future ClearRenderTarget implementation
- ClearRenderTarget remains stub (requires full D3D12 render pipeline state)
2026-03-23 21:46:14 +08:00
003d6ed630 Refactor OpenGL SwapChain HDC management
- OpenGLSwapChain now gets HDC from OpenGLDevice instead of creating its own
- Renamed OpenGLDevice::GetContext() to GetGLContext() for clarity
- Renamed OpenGLDevice::GetDC() to GetPresentationDC() for clarity
- OpenGLDevice now owns the HDC/HGLRC lifecycle
- OpenGLSwapChain::Initialize() now takes OpenGLDevice* parameter
- OpenGLSwapChain::Present() uses device's HDC for SwapBuffers
- Updated minimal test to use new API and capture from frame 25-35
- RenderDoc SetDevice now uses GetGLContext() for proper OpenGL hook
2026-03-23 21:43:32 +08:00
0fa4f2e3a8 Fix RHI unit test failures and OpenGL backend issues
- Fix D3D12Texture::GetTextureType() to return correct type based on D3D12 resource dimension
- Fix OpenGL CommandQueue::Signal() to properly call fence->Signal()
- Fix OpenGL CommandQueue::GetTimestampFrequency() using GL_TIMESTAMP
- Fix OpenGL Device::GetNativeDevice() to return m_hglrc
- Fix OpenGL Fence::Signal() to create GL sync object and update completedValue
- Fix OpenGL Fence::Wait() to properly wait for fence
- Fix OpenGL Fence::GetNativeHandle() to create sync on first call
- Fix OpenGL SwapChain::GetCurrentBackBuffer() to return backbuffer texture
- Fix OpenGL SwapChain::Initialize() to create backbuffer texture
- Fix OpenGL SwapChain::Shutdown() to cleanup backbuffer texture
- Fix RHI unit tests: add missing sampleCount/sampleQuality/depth/arraySize fields
- Fix RHI unit tests: add complete TextureDesc fields where needed
2026-03-23 21:09:15 +08:00
bc6b47ffcf fix: RHI单元测试修复与命名规范统一
RHI抽象层测试修复:
- OpenGL Shader: 空描述符正确返回nullptr
- OpenGL Texture: 修复TextureType映射(case 2/3)
- OpenGL Buffer: 设置stride和state支持
- OpenGL Texture: 添加Format和State支持
- OpenGL SwapChain: 修复IsFullscreen硬编码false问题

命名规范统一( snake_case + _test后缀):
- D3D12_Minimal -> d3d12_minimal_test
- D3D12_Triangle -> d3d12_triangle_test
- D3D12_Quad -> d3d12_quad_test
- D3D12_Sphere -> d3d12_sphere_test
- OpenGL_Minimal -> opengl_minimal_test
- OpenGL_Triangle -> opengl_triangle_test
- OpenGL_Quad -> opengl_quad_test
- OpenGL_Sphere -> opengl_sphere_test
- CTest名称去掉_Integration后缀

测试结果: 138个测试中从21个失败减少到16个失败
2026-03-23 20:32:33 +08:00
79422cfddd fix: simplify RenderDocCapture usage with TriggerCapture
- Remove BeginCapture/EndCapture complexity for manual frame capture
- Use TriggerCapture for single frame capture (simpler API)
- Move TriggerCapture before Present to ensure frame is captured
- Add SetForegroundWindow/SetFocus before TriggerCapture
- Remove default capture path in Initialize to allow SetCaptureFilePath to work
2026-03-23 19:40:50 +08:00
067c82c3a9 refactor: RHI抽象层测试支持参数化
- 将RHITestFixture改为TestWithParam<RHIType>,支持D3D12和OpenGL双后端
- 重构RHIFactory.cpp的include结构,修复OpenGL设备创建
- 在CMakeLists.txt中添加XCENGINE_SUPPORT_OPENGL宏定义
- 更新engine/CMakeLists.txt和tests/RHI/unit/CMakeLists.txt
- 将所有TEST_F改为TEST_P以支持参数化测试

测试结果: 138 tests (D3D12: 58 passed / OpenGL: 48 passed)
2026-03-23 19:17:32 +08:00
257706eddd renderdoc_parser: add .gitignore for binary files 2026-03-23 19:07:41 +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
84e7213e86 docs: update README with accurate function signatures 2026-03-23 18:50:16 +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
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
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
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
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
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
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
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
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
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