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
This commit is contained in:
2026-03-24 23:41:57 +08:00
parent 7a66913f2b
commit 1e88beacb8
10 changed files with 505 additions and 44 deletions

View File

@@ -369,29 +369,6 @@ void D3D12CommandList::SetRenderTargetsHandle(uint32_t count, const D3D12_CPU_DE
}
}
void D3D12CommandList::SetVertexBuffer(uint32_t slot, RHIResourceView* buffer, uint64_t offset) {
if (!buffer || !buffer->IsValid()) return;
D3D12ResourceView* view = static_cast<D3D12ResourceView*>(buffer);
D3D12_VERTEX_BUFFER_VIEW vbView = {};
vbView.BufferLocation = view->GetResource()->GetGPUVirtualAddress() + offset;
vbView.SizeInBytes = static_cast<UINT>(view->GetResource()->GetDesc().Width) - static_cast<UINT>(offset);
vbView.StrideInBytes = 0;
m_commandList->IASetVertexBuffers(slot, 1, &vbView);
}
void D3D12CommandList::SetVertexBuffer(uint32_t slot, ID3D12Resource* buffer, uint64_t offset, uint32_t stride) {
SetVertexBufferInternal(slot, buffer, offset, stride);
}
void D3D12CommandList::SetVertexBufferInternal(uint32_t slot, ID3D12Resource* buffer, uint64_t offset, uint32_t stride) {
D3D12_VERTEX_BUFFER_VIEW view = {};
view.BufferLocation = buffer->GetGPUVirtualAddress() + offset;
view.SizeInBytes = static_cast<UINT>(buffer->GetDesc().Width) - static_cast<UINT>(offset);
view.StrideInBytes = stride;
m_commandList->IASetVertexBuffers(slot, 1, &view);
}
void D3D12CommandList::SetVertexBuffers(uint32_t startSlot, uint32_t count, RHIResourceView** buffers, const uint64_t* offsets, const uint32_t* strides) {
std::vector<D3D12_VERTEX_BUFFER_VIEW> views(count);
for (uint32_t i = 0; i < count; ++i) {