From 1c30bc92bb49b67631abcccda884bab141f9ccb6 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 23 Aug 2024 14:39:56 +0200 Subject: [PATCH] [d3d11] Validate viewport parameters And skip invalid calls. Fixes Senran Kagura Peach Ball. --- src/d3d11/d3d11_context.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index b1399b7c120..8107bcb8ab7 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -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;