Fix RHI swap chain queue binding and restore minimal GT checks

This commit is contained in:
2026-03-25 21:50:57 +08:00
parent 8f76564ded
commit 30b5f93157
13 changed files with 127 additions and 74 deletions

View File

@@ -78,24 +78,12 @@ bool D3D12Device::Initialize(const RHIDeviceDesc& desc) {
return false;
}
D3D12_COMMAND_QUEUE_DESC queueDesc = {};
queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
queueDesc.Priority = 0;
queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
queueDesc.NodeMask = 0;
if (FAILED(m_device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&m_commandQueue)))) {
return false;
}
QueryAdapterInfo();
m_initialized = true;
return true;
}
void D3D12Device::Shutdown() {
if (m_commandQueue) {
m_commandQueue.Reset();
}
if (m_device) {
m_device.Reset();
}
@@ -398,10 +386,19 @@ RHIFence* D3D12Device::CreateFence(const FenceDesc& desc) {
return nullptr;
}
RHISwapChain* D3D12Device::CreateSwapChain(const SwapChainDesc& desc) {
RHISwapChain* D3D12Device::CreateSwapChain(const SwapChainDesc& desc, RHICommandQueue* presentQueue) {
if (presentQueue == nullptr) {
return nullptr;
}
auto* nativeQueue = static_cast<ID3D12CommandQueue*>(presentQueue->GetNativeHandle());
if (nativeQueue == nullptr) {
return nullptr;
}
auto* swapChain = new D3D12SwapChain();
HWND hwnd = static_cast<HWND>(desc.windowHandle);
if (swapChain->Initialize(m_factory.Get(), m_commandQueue.Get(), hwnd,
if (swapChain->Initialize(m_factory.Get(), nativeQueue, hwnd,
desc.width, desc.height, desc.bufferCount)) {
return swapChain;
}