From eb4840eac4dad8827467ff06c09d239ecebe4731 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Tue, 24 Mar 2026 05:00:38 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=85=B3=E9=94=AE=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E3=80=91=E4=BF=AE=E5=A4=8DD3D12CommandQueue::ExecuteCommandLis?= =?UTF-8?q?ts=E7=B1=BB=E5=9E=8B=E6=B7=B7=E6=B7=86bug=E5=B9=B6=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E9=9B=86=E6=88=90=E6=B5=8B=E8=AF=95=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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全部通过 --- engine/src/RHI/D3D12/D3D12CommandQueue.cpp | 2 +- tests/RHI/D3D12/integration/minimal/main.cpp | 2 +- tests/RHI/D3D12/integration/quad/CMakeLists.txt | 3 +++ tests/RHI/D3D12/integration/quad/main.cpp | 2 +- tests/RHI/D3D12/integration/sphere/CMakeLists.txt | 3 +++ tests/RHI/D3D12/integration/sphere/main.cpp | 2 +- tests/RHI/D3D12/integration/triangle/CMakeLists.txt | 3 +++ tests/RHI/D3D12/integration/triangle/main.cpp | 2 +- tests/RHI/OpenGL/integration/quad/CMakeLists.txt | 3 +++ tests/RHI/OpenGL/integration/sphere/CMakeLists.txt | 3 +++ tests/RHI/OpenGL/integration/triangle/CMakeLists.txt | 3 +++ 11 files changed, 23 insertions(+), 5 deletions(-) diff --git a/engine/src/RHI/D3D12/D3D12CommandQueue.cpp b/engine/src/RHI/D3D12/D3D12CommandQueue.cpp index 7c5a43ce..0183bd92 100644 --- a/engine/src/RHI/D3D12/D3D12CommandQueue.cpp +++ b/engine/src/RHI/D3D12/D3D12CommandQueue.cpp @@ -59,7 +59,7 @@ void D3D12CommandQueue::ExecuteCommandLists(uint32_t count, void** lists) { std::vector cmdLists(count); for (uint32_t i = 0; i < count; ++i) { if (lists[i]) { - RHICommandList* cmdList = static_cast(lists[i]); + auto* cmdList = static_cast(lists[i]); cmdLists[i] = static_cast(cmdList->GetNativeHandle()); } } diff --git a/tests/RHI/D3D12/integration/minimal/main.cpp b/tests/RHI/D3D12/integration/minimal/main.cpp index 269756d0..8b34839c 100644 --- a/tests/RHI/D3D12/integration/minimal/main.cpp +++ b/tests/RHI/D3D12/integration/minimal/main.cpp @@ -151,7 +151,7 @@ void WaitForGPU() { // Execute command list void ExecuteCommandList() { gCommandList.Close(); - void* commandLists[] = { gCommandList.GetCommandList() }; + void* commandLists[] = { &gCommandList }; gCommandQueue.ExecuteCommandLists(1, commandLists); } diff --git a/tests/RHI/D3D12/integration/quad/CMakeLists.txt b/tests/RHI/D3D12/integration/quad/CMakeLists.txt index a619a592..bf16ba6f 100644 --- a/tests/RHI/D3D12/integration/quad/CMakeLists.txt +++ b/tests/RHI/D3D12/integration/quad/CMakeLists.txt @@ -48,6 +48,9 @@ add_custom_command(TARGET d3d12_quad_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm $/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ENGINE_ROOT_DIR}/third_party/renderdoc/renderdoc.dll + $/ ) add_test(NAME d3d12_quad_test diff --git a/tests/RHI/D3D12/integration/quad/main.cpp b/tests/RHI/D3D12/integration/quad/main.cpp index 93d788be..0651b7c7 100644 --- a/tests/RHI/D3D12/integration/quad/main.cpp +++ b/tests/RHI/D3D12/integration/quad/main.cpp @@ -282,7 +282,7 @@ void WaitForGPU() { void ExecuteCommandList() { gCommandList.Close(); - void* commandLists[] = { gCommandList.GetCommandList() }; + void* commandLists[] = { &gCommandList }; gCommandQueue.ExecuteCommandLists(1, commandLists); } diff --git a/tests/RHI/D3D12/integration/sphere/CMakeLists.txt b/tests/RHI/D3D12/integration/sphere/CMakeLists.txt index 7185247f..20113737 100644 --- a/tests/RHI/D3D12/integration/sphere/CMakeLists.txt +++ b/tests/RHI/D3D12/integration/sphere/CMakeLists.txt @@ -46,6 +46,9 @@ add_custom_command(TARGET d3d12_sphere_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm $/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ENGINE_ROOT_DIR}/third_party/renderdoc/renderdoc.dll + $/ ) add_test(NAME d3d12_sphere_test diff --git a/tests/RHI/D3D12/integration/sphere/main.cpp b/tests/RHI/D3D12/integration/sphere/main.cpp index c6f17f55..6c95fd10 100644 --- a/tests/RHI/D3D12/integration/sphere/main.cpp +++ b/tests/RHI/D3D12/integration/sphere/main.cpp @@ -370,7 +370,7 @@ void WaitForGPU() { void ExecuteCommandList() { gCommandList.Close(); - void* commandLists[] = { gCommandList.GetCommandList() }; + void* commandLists[] = { &gCommandList }; gCommandQueue.ExecuteCommandLists(1, commandLists); } diff --git a/tests/RHI/D3D12/integration/triangle/CMakeLists.txt b/tests/RHI/D3D12/integration/triangle/CMakeLists.txt index ee1e9df9..8740b2ce 100644 --- a/tests/RHI/D3D12/integration/triangle/CMakeLists.txt +++ b/tests/RHI/D3D12/integration/triangle/CMakeLists.txt @@ -45,6 +45,9 @@ add_custom_command(TARGET d3d12_triangle_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm $/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ENGINE_ROOT_DIR}/third_party/renderdoc/renderdoc.dll + $/ ) add_test(NAME d3d12_triangle_test diff --git a/tests/RHI/D3D12/integration/triangle/main.cpp b/tests/RHI/D3D12/integration/triangle/main.cpp index e3a9fe39..f86d05d2 100644 --- a/tests/RHI/D3D12/integration/triangle/main.cpp +++ b/tests/RHI/D3D12/integration/triangle/main.cpp @@ -217,7 +217,7 @@ void WaitForGPU() { void ExecuteCommandList() { gCommandList.Close(); - void* commandLists[] = { gCommandList.GetCommandList() }; + void* commandLists[] = { &gCommandList }; gCommandQueue.ExecuteCommandLists(1, commandLists); } diff --git a/tests/RHI/OpenGL/integration/quad/CMakeLists.txt b/tests/RHI/OpenGL/integration/quad/CMakeLists.txt index e605a212..d58f953f 100644 --- a/tests/RHI/OpenGL/integration/quad/CMakeLists.txt +++ b/tests/RHI/OpenGL/integration/quad/CMakeLists.txt @@ -45,6 +45,9 @@ add_custom_command(TARGET opengl_quad_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm $/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ENGINE_ROOT_DIR}/third_party/renderdoc/renderdoc.dll + $/ ) add_test(NAME opengl_quad_test diff --git a/tests/RHI/OpenGL/integration/sphere/CMakeLists.txt b/tests/RHI/OpenGL/integration/sphere/CMakeLists.txt index 596ac57b..ae802d59 100644 --- a/tests/RHI/OpenGL/integration/sphere/CMakeLists.txt +++ b/tests/RHI/OpenGL/integration/sphere/CMakeLists.txt @@ -45,6 +45,9 @@ add_custom_command(TARGET opengl_sphere_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm $/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ENGINE_ROOT_DIR}/third_party/renderdoc/renderdoc.dll + $/ ) add_test(NAME opengl_sphere_test diff --git a/tests/RHI/OpenGL/integration/triangle/CMakeLists.txt b/tests/RHI/OpenGL/integration/triangle/CMakeLists.txt index 27c95541..0fe9bb13 100644 --- a/tests/RHI/OpenGL/integration/triangle/CMakeLists.txt +++ b/tests/RHI/OpenGL/integration/triangle/CMakeLists.txt @@ -45,6 +45,9 @@ add_custom_command(TARGET opengl_triangle_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm $/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${ENGINE_ROOT_DIR}/third_party/renderdoc/renderdoc.dll + $/ ) add_test(NAME opengl_triangle_test