From 57f5fa08cbb9bdbdd2643e4a99e9eaaeb5f83017 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 11 Mar 2020 16:24:15 +0100 Subject: [PATCH] v3dv: fix scissor outside viewport In this scenario we can end up generating a clip window where the max coordinates are smaller than the min coordinates and the simulator asserts. Fixes: dEQP-VK.draw.scissor.dynamic_scissor_outside_viewport dEQP-VK.draw.scissor.static_scissor_outside_viewport Part-of: --- src/broadcom/vulkan/v3dv_cmd_buffer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index bc93f7b6200..68d468da5b7 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -1860,6 +1860,14 @@ emit_scissor(struct v3dv_cmd_buffer *cmd_buffer) maxy = MIN2(maxy, scissor->offset.y + scissor->extent.height); } + /* If the scissor is outside the viewport area we end up with + * min{x,y} > max{x,y}. + */ + if (minx > maxx) + maxx = minx; + if (miny > maxy) + maxy = miny; + clip_window.offset.x = minx; clip_window.offset.y = miny; clip_window.extent.width = maxx - minx;