llvmpipe/scissor: rewrite scissor planes interaction.

This just changes the calcs to be cleaner and easier to interpret.

Adjust the inclusive (x0/y0) by -1 like before, and then flip the
sign for the correct direction.

Add full pixel to the exclusive side after scaling, this is do
show that this value is incorrect and the next patch fixes that
taking multisample into account

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>
This commit is contained in:
Dave Airlie 2021-08-30 13:56:03 +10:00 committed by Marge Bot
parent 22b5e61db9
commit 519f235459

View file

@ -1779,30 +1779,38 @@ lp_setup_add_scissor_planes(const struct u_rect *scissor,
* (easier to evaluate) to ordinary planes.)
*/
if (s_planes[0]) {
int x0 = scissor->x0 - 1;
plane_s->dcdx = ~0U << 8;
plane_s->dcdy = 0;
plane_s->c = (1-scissor->x0) << 8;
plane_s->c = x0 << 8;
plane_s->c = -plane_s->c; /* flip sign */
plane_s->eo = 1 << 8;
plane_s++;
}
if (s_planes[1]) {
int x1 = scissor->x1;
plane_s->dcdx = 1 << 8;
plane_s->dcdy = 0;
plane_s->c = (scissor->x1+1) << 8;
plane_s->c = x1 << 8;
plane_s->c += 255;
plane_s->eo = 0 << 8;
plane_s++;
}
if (s_planes[2]) {
int y0 = scissor->y0 - 1;
plane_s->dcdx = 0;
plane_s->dcdy = 1 << 8;
plane_s->c = (1-scissor->y0) << 8;
plane_s->c = y0 << 8;
plane_s->c = -plane_s->c; /* flip sign */
plane_s->eo = 1 << 8;
plane_s++;
}
if (s_planes[3]) {
int y1 = scissor->y1;
plane_s->dcdx = 0;
plane_s->dcdy = ~0U << 8;
plane_s->c = (scissor->y1+1) << 8;
plane_s->c = y1 << 8;
plane_s->c += 255;
plane_s->eo = 0;
plane_s++;
}