Fix crash in D3D12 when constant buffer was binded but not updated before the draw

This commit is contained in:
Wojtek Figat
2024-07-02 00:54:17 +02:00
parent fbc648302d
commit 1328e869a9

View File

@@ -459,8 +459,10 @@ void GPUContextDX12::flushCBs()
const auto cb = _cbHandles[i];
if (cb)
{
ASSERT(cb->GPUAddress != 0);
_commandList->SetGraphicsRootConstantBufferView(DX12_ROOT_SIGNATURE_CB + i, cb->GPUAddress);
if (cb->GPUAddress != 0)
_commandList->SetGraphicsRootConstantBufferView(DX12_ROOT_SIGNATURE_CB + i, cb->GPUAddress);
else
_cbGraphicsDirtyFlag = true; // CB was binded but not yet assigned so stay in dirty state
}
}
}
@@ -472,8 +474,10 @@ void GPUContextDX12::flushCBs()
const auto cb = _cbHandles[i];
if (cb)
{
ASSERT(cb->GPUAddress != 0);
_commandList->SetComputeRootConstantBufferView(DX12_ROOT_SIGNATURE_CB + i, cb->GPUAddress);
if (cb->GPUAddress != 0)
_commandList->SetComputeRootConstantBufferView(DX12_ROOT_SIGNATURE_CB + i, cb->GPUAddress);
else
_cbComputeDirtyFlag = true; // CB was binded but not yet assigned so stay in dirty state
}
}
}