llvmpipe: adjust rounding for viewport scissoring
authorRoland Scheidegger <sroland@vmware.com>
Mon, 15 Nov 2021 17:27:44 +0000 (18:27 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 18 Nov 2021 19:23:13 +0000 (19:23 +0000)
commitb7e2214b3c89490181685dded4480f2bd04d1990
treecfa8b7e6479d8153948eec803914b6148ec67cb5
parentf6dd931640ebdaaf5a45770e061d0b0390895267
llvmpipe: adjust rounding for viewport scissoring

Some apps may try to use a viewport adjusted by 0.5 pixels (among other
things) to emulate d3d9 pixel center, and in this case we would end up
with incorrect "fake scissor" box (shifted by 1 pixel), hence pixels
being incorrectly scissored away when permit_linear_rasterizer is set
(this happens even if the linear rasterizer is not used in the end).

So adjust the offset so that the half-way points get rounded down instead
of up.
(This is all a bit iffy I think since we don't use fractional
boxes (with 8 subpixel bits) anywhere yet, but at least without msaa
it should work out.)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13794>
src/gallium/drivers/llvmpipe/lp_setup.c