Skip to content

Commit

Permalink
[d3d9] Fix off-by-one when copying shader defined constants
Browse files Browse the repository at this point in the history
  • Loading branch information
K0bin authored and misyltoad committed Dec 25, 2023
1 parent adb33d3 commit 9cde0b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5260,7 +5260,7 @@ namespace dxvk {
uint32_t floatCount = m_vsFloatConstsCount;
if (constSet.meta.needsConstantCopies) {
auto shader = GetCommonShader(m_state.vertexShader);
floatCount = std::max(floatCount, shader->GetMaxDefinedConstant());
floatCount = std::max(floatCount, shader->GetMaxDefinedConstant() + 1);
}
floatCount = std::min(floatCount, constSet.meta.maxConstIndexF);

Expand Down Expand Up @@ -5322,7 +5322,7 @@ namespace dxvk {
uint32_t floatCount = ShaderStage == DxsoProgramType::VertexShader ? m_vsFloatConstsCount : m_psFloatConstsCount;
if (constSet.meta.needsConstantCopies) {
auto shader = GetCommonShader(Shader);
floatCount = std::max(floatCount, shader->GetMaxDefinedConstant());
floatCount = std::max(floatCount, shader->GetMaxDefinedConstant() + 1);
}
floatCount = std::min(constSet.meta.maxConstIndexF, floatCount);

Expand Down

0 comments on commit 9cde0b5

Please sign in to comment.