1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Don't use clamped constant buffer range for bounds checking

This commit is contained in:
Robin Kertels 2020-09-14 22:19:03 +02:00 committed by Philip Rebohle
parent 73cb711f32
commit b21a673a8d

View File

@ -3652,7 +3652,8 @@ namespace dxvk {
UINT constantBound; UINT constantBound;
if (likely(newBuffer != nullptr)) { if (likely(newBuffer != nullptr)) {
constantBound = std::min(newBuffer->Desc()->ByteWidth / 16, UINT(D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT)); UINT bufferConstantsCount = newBuffer->Desc()->ByteWidth / 16;
constantBound = std::min(bufferConstantsCount, UINT(D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT));
if (likely(pFirstConstant && pNumConstants)) { if (likely(pFirstConstant && pNumConstants)) {
constantOffset = pFirstConstant[i]; constantOffset = pFirstConstant[i];
@ -3661,8 +3662,8 @@ namespace dxvk {
if (unlikely(constantCount > D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT)) if (unlikely(constantCount > D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT))
continue; continue;
constantBound = (constantOffset + constantCount > constantBound) constantBound = (constantOffset + constantCount > bufferConstantsCount)
? constantBound - std::min(constantOffset, constantBound) ? bufferConstantsCount - std::min(constantOffset, bufferConstantsCount)
: constantCount; : constantCount;
} else { } else {
constantOffset = 0; constantOffset = 0;