aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_setup_line.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2016-02-03 00:36:15 +0100
committerRoland Scheidegger <[email protected]>2016-02-03 01:25:45 +0100
commit848a023c053b312ba5e76a124d7088bbf0b69df0 (patch)
tree934e0a1c7447855a367553bad61b78273d99eb6e /src/gallium/drivers/llvmpipe/lp_setup_line.c
parent141ef75569aa9ffe392f19d7a375bbadebfd08be (diff)
llvmpipe: use scissor_planes_needed helper function
So it doesn't get out of sync in multiple places.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup_line.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_line.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index f6e1198d036..af4e7900d3c 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -591,11 +591,9 @@ try_setup_line( struct lp_setup_context *setup,
*/
if (setup->scissor_test) {
/* why not just use draw_regions */
- struct u_rect *scissor = &setup->scissors[viewport_index];
- nr_planes += (bbox.x0 < scissor->x0);
- nr_planes += (bbox.x1 > scissor->x1);
- nr_planes += (bbox.y0 < scissor->y0);
- nr_planes += (bbox.y1 > scissor->y1);
+ boolean s_planes[4];
+ scissor_planes_needed(s_planes, &bbox, &setup->scissors[viewport_index]);
+ nr_planes += s_planes[0] + s_planes[1] + s_planes[2] + s_planes[3];
}
line = lp_setup_alloc_triangle(scene,
@@ -723,29 +721,31 @@ try_setup_line( struct lp_setup_context *setup,
/* why not just use draw_regions */
struct u_rect *scissor = &setup->scissors[viewport_index];
struct lp_rast_plane *plane_s = &plane[4];
+ boolean s_planes[4];
+ scissor_planes_needed(s_planes, &bbox, scissor);
- if (bbox.x0 < scissor->x0) {
+ if (s_planes[0]) {
plane_s->dcdx = -1 << 8;
plane_s->dcdy = 0;
plane_s->c = (1-scissor->x0) << 8;
plane_s->eo = 1 << 8;
plane_s++;
}
- if (bbox.x1 > scissor->x1) {
+ if (s_planes[1]) {
plane_s->dcdx = 1 << 8;
plane_s->dcdy = 0;
plane_s->c = (scissor->x1+1) << 8;
plane_s->eo = 0 << 8;
plane_s++;
}
- if (bbox.y0 < scissor->y0) {
+ if (s_planes[2]) {
plane_s->dcdx = 0;
plane_s->dcdy = 1 << 8;
plane_s->c = (1-scissor->y0) << 8;
plane_s->eo = 1 << 8;
plane_s++;
}
- if (bbox.y1 > scissor->y1) {
+ if (s_planes[3]) {
plane_s->dcdx = 0;
plane_s->dcdy = -1 << 8;
plane_s->c = (scissor->y1+1) << 8;