1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 02:52:10 +01:00

[d3d11] Add range checking to GetConstantBuffers

This commit is contained in:
Philip Rebohle 2021-04-21 13:14:36 +02:00
parent 2d9c229eaa
commit ef9ad29b7f
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -3775,14 +3775,25 @@ namespace dxvk {
UINT* pFirstConstant,
UINT* pNumConstants) {
for (uint32_t i = 0; i < NumBuffers; i++) {
if (ppConstantBuffers != nullptr)
ppConstantBuffers[i] = Bindings[StartSlot + i].buffer.ref();
const bool inRange = StartSlot + i < Bindings.size();
if (ppConstantBuffers != nullptr) {
ppConstantBuffers[i] = inRange
? Bindings[StartSlot + i].buffer.ref()
: nullptr;
}
if (pFirstConstant != nullptr)
pFirstConstant[i] = Bindings[StartSlot + i].constantOffset;
if (pFirstConstant != nullptr) {
pFirstConstant[i] = inRange
? Bindings[StartSlot + i].constantOffset
: 0u;
}
if (pNumConstants != nullptr)
pNumConstants[i] = Bindings[StartSlot + i].constantCount;
if (pNumConstants != nullptr) {
pNumConstants[i] = inRange
? Bindings[StartSlot + i].constantCount
: 0u;
}
}
}