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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga
2020-03-11 16:24:15 +01:00
committed by Marge Bot
parent 5ba6fd3447
commit 57f5fa08cb
+8
View File
@@ -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;