Skip to content

Commit

Permalink
[d3d11] Validate viewport parameters
Browse files Browse the repository at this point in the history
And skip invalid calls. Fixes Senran Kagura Peach Ball.
  • Loading branch information
doitsujin committed Aug 23, 2024
1 parent 6da1ba7 commit 1c30bc9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/d3d11/d3d11_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2422,6 +2422,17 @@ namespace dxvk {
if (unlikely(NumViewports > m_state.rs.viewports.size()))
return;

for (uint32_t i = 0; i < NumViewports; i++) {
const D3D11_VIEWPORT& vp = pViewports[i];

bool valid = vp.Width >= 0.0f && vp.Height >= 0.0f
&& vp.MinDepth >= 0.0f && vp.MaxDepth <= 1.0f
&& vp.MinDepth <= vp.MaxDepth;

if (!valid)
return;
}

bool dirty = m_state.rs.numViewports != NumViewports;
m_state.rs.numViewports = NumViewports;

Expand Down

0 comments on commit 1c30bc9

Please sign in to comment.