93139813aa
OpenGL: Use OpenGLCommandList instead of raw GL in minimal test
...
- Replace glViewport() with commandList.SetViewport()
- Replace glClearColor()+glClear() with commandList.Clear()
- Add OpenGLCommandList include and instance
2026-03-20 20:07:24 +08:00
394bec9db6
OpenGL: Add test documentation for minimal integration test
...
- Create TEST_SPEC.md with OpenGL test hierarchy and specifications
- Add section and inline comments to main.cpp explaining:
- Window size calculation with AdjustWindowRect
- glFinish before screenshot for GPU sync
- Target frame count warm-up period
- Shutdown order (reverse of initialization)
2026-03-20 19:56:48 +08:00
f8573d2715
OpenGL: Refactor integration test with separate output directory
2026-03-20 19:39:49 +08:00
28bf76cb00
OpenGL: Fix screenshot gray edge issue by correcting SetWindowPos usage
...
- OpenGLSwapChain::Initialize now uses AdjustWindowRect before SetWindowPos
- This ensures window client area matches expected size (1280x720)
- Previously SetWindowPos was given client area size instead of full window size
- Removed debug fprintf statements from OpenGLDevice
- Updated minimal integration test to use cleaner code
2026-03-20 19:33:58 +08:00
d6ff7b6d1b
D3D12: Refactor integration tests with separate output directories
2026-03-20 19:17:20 +08:00
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
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
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
77ef74bec6
fix: D3D12 screenshot implementation and tests
2026-03-20 02:35:59 +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
3196261e9b
fix(RHI): 添加 OpenGL 源文件到 CMakeLists 并修复编译错误
...
- 添加 OpenGL RHI 所有源文件到 engine/CMakeLists.txt
- 修复 OpenGLPipelineState 结构体重定义问题
- 修复 BufferDesc/TextureDesc/ShaderCompileDesc API 不匹配
- 添加 OpenGLShader 缺少的基类纯虚函数实现
- 修复 HashMap 迭代器支持和 ResourceManager API 调用
2026-03-18 03:37:34 +08:00
70571316da
feat(RHI): 添加 RHIFactory 工厂类
...
- 新增 RHIFactory 头文件和实现,支持通过 RHIType 或字符串创建设备
- 修复 D3D12Buffer 缺失的 Map/Unmap/SetData 实现
- 添加 RHI 工厂测试用例
- 更新 CMakeLists.txt 添加新文件
2026-03-18 01:33:15 +08:00
b7feca59c4
fix(test): zero-initialize state structs to avoid stack corruption
2026-03-17 23:29:31 +08:00
6fe21710e8
test(RHI): add rendering state tests for CommandList
...
- Add tests for SetPrimitiveTopology
- Add tests for SetDepthStencilState
- Add tests for SetBlendState
- Add tests for SetBlendFactor
- OpenGL tests now have 45 test cases
2026-03-17 23:25:40 +08:00
0a2f8050e5
fix(RHI): 修复 OpenGL 测试接口不匹配问题
...
- 修复 RHIDeviceInfo 缺少 majorVersion/minorVersion
- 修复 OpenGLTexture 使用 GetTextureType 替代 GetType
- 修复 OpenGLSampler 使用 OpenGLSamplerDesc
- 修复 BlendFactor::OneMinusSrcAlpha -> InvSrcAlpha
- 修复 OpenGLRenderTargetViewDesc/OpenGLDepthStencilViewDesc 重定义问题
- 恢复 OpenGL 测试文件到 CMakeLists
2026-03-17 19:43:20 +08:00
e138fb2075
fix(RHI): 修复 OpenGL/D3D12 后端编译问题
...
- 修复 OpenGLCommandList 方法签名匹配 RHI 抽象接口
- 修复 OpenGLSwapChain Present/Resize 方法签名
- 添加 OpenGL 特有方法重载支持后端测试(底层逃逸)
- 暂时禁用不兼容的 Resources 模块
- 更新 OpenGL 测试 CMakeLists
2026-03-17 19:35:51 +08:00
f2ae95e0a7
Complete OpenGL test suite - 56 tests
...
Added missing tests to reach planned 56:
- CommandList: EnableDisable_DepthTest, EnableDisable_Blending
- RTV: GetTexture, GetMipLevel
- DSV: Initialize_Texture, GetTexture, GetMipLevel
Final count: 56 tests across all 12 components
2026-03-17 12:48:17 +08:00
7bf586f6fa
Add Phase 5: SwapChain tests (3 tests)
...
- Add SwapChain tests: Initialize, Present, Resize
=== OpenGL Test Suite Complete ===
Total: 49 tests across all phases:
- Phase 1: Device, Buffer, Fence (17 tests)
- Phase 2: Texture, Sampler (9 tests)
- Phase 3: Shader, PipelineState, VertexArray (11 tests)
- Phase 4: CommandList, RTV, DSV (9 tests)
- Phase 5: SwapChain (3 tests)
2026-03-17 12:41:29 +08:00
4b14831c57
Add Phase 4: CommandList, RTV, DSV tests (13 tests)
...
- Add CommandList tests: Clear (color/depth/stencil), SetIndexBuffer, Draw (VAO), SetViewport, SetScissor
- Add RTV tests: Initialize (Texture2D), Bind/Unbind
- Add DSV tests: Bind/Unbind
- Simplify tests to work with available GL context
2026-03-17 12:40:07 +08:00
276a9c476a
Add Phase 3: Shader, PipelineState, VertexArray tests (11 tests)
...
- Add Shader tests: VertexFragment, Geometry, InvalidSource, SetUniforms
- Add PipelineState tests: DepthStencilState, BlendState, Viewport/Scissor
- Add VertexArray tests: Initialize, AddVertexBuffer, SetIndexBuffer, Bind/Unbind
2026-03-17 12:31:05 +08:00
1d181f1109
Add Phase 2: Texture and Sampler tests (9 tests)
...
- Add Texture tests: 2DTexture, CubeMap, Bind/Unbind, GenerateMipmap, SetFiltering/SetWrapping
- Add Sampler tests: Initialize (default/custom), Bind/Unbind, GetID
2026-03-17 12:27:47 +08:00
745f3ab225
Add OpenGL test infrastructure - Phase 1: Device, Buffer, Fence tests (17 tests)
...
- Create test directory structure at tests/RHI/OpenGL/
- Implement OpenGLTestFixture with GLFW/GLAD initialization
- Add Device tests: CreateRenderWindow, InitializeWithExistingWindow, GetDeviceInfo, SwapBuffers, PollEvents
- Add Buffer tests: VertexBuffer, IndexBuffer, UniformBuffer, Dynamic, Bind/Unbind, Map/Unmap
- Add Fence tests: Initialize (signaled/unsignaled), Signal, Wait, IsSignaled, GetStatus
- Add CMakeLists.txt with proper GLFW/GLAD/GTest linking
- Create implementation plan document at docs/OpenGL测试实施计划.md
2026-03-17 12:26:21 +08:00
f42a0795fb
Add D3D12 test progress report
2026-03-17 04:15:48 +08:00
19b33a3061
Add Phase 4 tests for DescriptorHeap, Shader, RootSignature, PipelineState, Views
...
- DescriptorHeap: CBV_SRV_UAV, Sampler, RTV, DSV, HandleIncrementSize
- Shader: Vertex/Pixel/Compute profiles
- RootSignature: Empty, with CBV parameter
- PipelineState: Graphics/Compute pipeline desc defaults
- Views: RTV, DSV, CBV descriptor heaps, handle increment
- All 54 tests pass
2026-03-17 04:04:57 +08:00
3f8805cde8
Add Phase 3 tests for Buffer and Texture
...
- Buffer: CreateBuffer (Default/Upload Heap), GPU Virtual Address, Map/Unmap, Alignment
- Texture: 2D, 3D, MipLevels, TextureArray
- All 38 tests pass
2026-03-17 04:02:35 +08:00
11ea2a4fc5
Fix GPU state issue - make device non-static per test
...
- Each test now creates its own D3D12 device, command queue, allocator, and command list
- Properly cleanup in TearDown to avoid GPU state issues
- All 29 tests now pass
2026-03-17 03:54:50 +08:00
0049f8334d
Add Phase 2 tests for CommandQueue, CommandAllocator, CommandList
...
- CommandAllocator: Reset, MultipleReset, DifferentTypes
- CommandList: Close, GetDesc
- CommandQueue: GetTimestampFrequency, ExecuteCommandLists
- Note: Some tests fail after ExecuteCommandLists due to GPU state
2026-03-17 03:47:51 +08:00
795cb10183
Add Phase 1 D3D12 tests for Device and Fence
...
- Implement real D3D12 tests for Device (feature level, descriptor handle,
shader model, resource binding tier, tiled resources)
- Implement real D3D12 tests for Fence (create, signal, wait, event)
- Move tests from tests/D3D12_engine/test/ to tests/RHI/D3D12/
- All 22 tests pass
2026-03-17 03:39:27 +08:00