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
This commit is contained in:
2026-03-23 23:52:27 +08:00
parent 062984953e
commit 36c1c8338f
3 changed files with 26 additions and 6 deletions

View File

@@ -52,13 +52,31 @@ void D3D12CommandQueue::Shutdown() {
}
void D3D12CommandQueue::ExecuteCommandLists(uint32_t count, void** lists) {
ExecuteCommandListsInternal(count, reinterpret_cast<ID3D12CommandList**>(lists));
if (count == 0 || lists == nullptr) {
return;
}
std::vector<ID3D12CommandList*> cmdLists(count);
for (uint32_t i = 0; i < count; ++i) {
auto* cmdList = static_cast<D3D12CommandList*>(lists[i]);
if (cmdList) {
cmdList->Reset();
cmdLists[i] = cmdList->GetCommandList();
}
}
ExecuteCommandListsInternal(count, cmdLists.data());
}
void D3D12CommandQueue::ExecuteCommandListsInternal(uint32_t count, ID3D12CommandList** lists) {
if (!m_commandQueue || count == 0 || lists == nullptr) {
return;
}
m_commandQueue->ExecuteCommandLists(count, lists);
m_currentFrame++;
m_commandQueue->Signal(m_frameFence.Get(), m_currentFrame);
if (m_frameFence) {
m_commandQueue->Signal(m_frameFence.Get(), m_currentFrame);
}
}
void D3D12CommandQueue::Signal(RHIFence* fence, uint64_t value) {