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)
This commit is contained in:
2026-03-24 17:20:51 +08:00
parent ac5c98584a
commit 0dde7234b7
10 changed files with 132 additions and 173 deletions

View File

@@ -138,7 +138,7 @@ TEST_P(RHITestFixture, CommandList_ClearRenderTarget) {
float color[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
cmdList->Reset();
cmdList->ClearRenderTarget(texture->GetNativeHandle(), color);
cmdList->ClearRenderTarget(static_cast<RHIResourceView*>(nullptr), color);
cmdList->Close();
texture->Shutdown();
@@ -218,7 +218,7 @@ TEST_P(RHITestFixture, CommandList_TransitionBarrier) {
ASSERT_NE(texture, nullptr);
cmdList->Reset();
cmdList->TransitionBarrier(texture->GetNativeHandle(), ResourceStates::Common, ResourceStates::RenderTarget);
cmdList->TransitionBarrier(static_cast<RHIResourceView*>(nullptr), ResourceStates::Common, ResourceStates::RenderTarget);
cmdList->Close();
texture->Shutdown();
@@ -265,7 +265,7 @@ TEST_P(RHITestFixture, CommandList_SetVertexBuffer_WithResourceView) {
ASSERT_NE(cmdList, nullptr);
cmdList->Reset();
cmdList->SetVertexBuffer(0, static_cast<RHIResourceView*>(nullptr), 0, 16);
cmdList->SetVertexBuffer(0, static_cast<RHIResourceView*>(nullptr), 0);
cmdList->Close();
cmdList->Shutdown();
@@ -280,7 +280,7 @@ TEST_P(RHITestFixture, CommandList_SetIndexBuffer_WithResourceView) {
ASSERT_NE(cmdList, nullptr);
cmdList->Reset();
cmdList->SetIndexBuffer(static_cast<RHIResourceView*>(nullptr), 0, Format::R32_UInt);
cmdList->SetIndexBuffer(static_cast<RHIResourceView*>(nullptr), 0);
cmdList->Close();
cmdList->Shutdown();