1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 13:08:50 +01:00

[d3d11] Fix some possible constant buffer binding bugs

This commit is contained in:
Philip Rebohle 2022-08-07 15:54:53 +02:00
parent 2e6a2f1be3
commit 45a1587b88
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -4233,13 +4233,13 @@ namespace dxvk {
for (uint32_t i = 0; i < NumBuffers; i++) {
auto newBuffer = static_cast<D3D11Buffer*>(ppConstantBuffers[i]);
UINT constantCount = 0;
if (likely(newBuffer != nullptr))
constantCount = std::min(newBuffer->Desc()->ByteWidth / 16, UINT(D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT));
uint32_t constantCount = newBuffer
? std::min(newBuffer->Desc()->ByteWidth / 16, UINT(D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT))
: 0u;
if (bindings.buffers[StartSlot + i].buffer != newBuffer
|| bindings.buffers[StartSlot + i].constantBound != constantCount) {
|| bindings.buffers[StartSlot + i].constantOffset != 0
|| bindings.buffers[StartSlot + i].constantCount != constantCount) {
bindings.buffers[StartSlot + i].buffer = newBuffer;
bindings.buffers[StartSlot + i].constantOffset = 0;
bindings.buffers[StartSlot + i].constantCount = constantCount;