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

[d3d11] Add range checking to IAGetVertexBuffers

This commit is contained in:
Philip Rebohle 2021-04-21 13:11:10 +02:00
parent a13dad07cc
commit b51fd4d06c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -1708,14 +1708,25 @@ namespace dxvk {
D3D10DeviceLock lock = LockContext();
for (uint32_t i = 0; i < NumBuffers; i++) {
if (ppVertexBuffers != nullptr)
ppVertexBuffers[i] = m_state.ia.vertexBuffers[StartSlot + i].buffer.ref();
const bool inRange = StartSlot + i < m_state.ia.vertexBuffers.size();
if (ppVertexBuffers != nullptr) {
ppVertexBuffers[i] = inRange
? m_state.ia.vertexBuffers[StartSlot + i].buffer.ref()
: nullptr;
}
if (pStrides != nullptr)
pStrides[i] = m_state.ia.vertexBuffers[StartSlot + i].stride;
if (pStrides != nullptr) {
pStrides[i] = inRange
? m_state.ia.vertexBuffers[StartSlot + i].stride
: 0u;
}
if (pOffsets != nullptr)
pOffsets[i] = m_state.ia.vertexBuffers[StartSlot + i].offset;
if (pOffsets != nullptr) {
pOffsets[i] = inRange
? m_state.ia.vertexBuffers[StartSlot + i].offset
: 0u;
}
}
}