aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Marek <jonathan@marek.ca>2020-06-25 10:55:48 -0400
committerMarge Bot <eric+marge@anholt.net>2020-06-26 11:34:49 +0000
commit2fbc12a0ac0472b85922c406ce14931091d74eb6 (patch)
treebf64f9026407a0372974687e5b6cf794d58a4870
parent1854eeefded9dafca62a24ed4b2f460e0bf1dd71 (diff)
downloadexternal_mesa3d-2fbc12a0ac0472b85922c406ce14931091d74eb6.tar.gz
external_mesa3d-2fbc12a0ac0472b85922c406ce14931091d74eb6.tar.bz2
external_mesa3d-2fbc12a0ac0472b85922c406ce14931091d74eb6.zip
turnip: fix huge scissor min/max case
Now that tu_cs_emit_regs is used for the scissor, it hits an assert when the scissor is too large. Fixes this dEQP test: dEQP-VK.draw.scissor.static_scissor_max_int32 Fixes: 9c0ae5704d654108fd36b ("turnip: fix empty scissor case") Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5655>
-rw-r--r--src/freedreno/vulkan/tu_pipeline.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c
index 794aa4abb32..54d011b002a 100644
--- a/src/freedreno/vulkan/tu_pipeline.c
+++ b/src/freedreno/vulkan/tu_pipeline.c
@@ -1562,6 +1562,15 @@ tu6_emit_scissor(struct tu_cs *cs, const VkRect2D *scissor)
if (max.y == 0)
min.y = max.y = 1;
+ /* avoid overflow with large scissor
+ * note the max will be limited to min - 1, so that empty scissor works
+ */
+ uint32_t scissor_max = BITFIELD_MASK(15);
+ min.x = MIN2(scissor_max, min.x);
+ min.y = MIN2(scissor_max, min.y);
+ max.x = MIN2(scissor_max, max.x);
+ max.y = MIN2(scissor_max, max.y);
+
tu_cs_emit_regs(cs,
A6XX_GRAS_SC_SCREEN_SCISSOR_TL_0(.x = min.x, .y = min.y),
A6XX_GRAS_SC_SCREEN_SCISSOR_BR_0(.x = max.x - 1, .y = max.y - 1));