summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_setup_line.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-11-02 14:20:20 +0000
committerKeith Whitwell <keithw@vmware.com>2010-11-02 16:48:10 +0000
commit98445b43071414a6bd82d0618002611c6ad70257 (patch)
tree09ce797ac92e5b5001fdd0e3ef5a5f71d2b2e276 /src/gallium/drivers/llvmpipe/lp_setup_line.c
parentfc70c05dbd5af94b04cf4717253cfbd57aadf1af (diff)
llvmpipe: avoid generating tri_16 for tris which extend past tile bounds
Don't trim triangle bounding box to scissor/draw-region until after the logic for emitting tri_16. Don't generate tri_16 commands for triangles with untrimmed bounding boxes outside the current tile. This is important as the tri-16 itself can extend past tile bounds and we don't want to add code to it to check against tile bounds (slow) or restrict it to locations within a tile (pessimistic).
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup_line.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_line.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index 827413bb33..29c231714e 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -569,7 +569,10 @@ try_setup_line( struct lp_setup_context *setup,
return TRUE;
}
- u_rect_find_intersection(&setup->draw_region, &bbox);
+ /* Can safely discard negative regions:
+ */
+ bbox.x0 = MAX2(bbox.x0, 0);
+ bbox.y0 = MAX2(bbox.y0, 0);
line = lp_setup_alloc_triangle(scene,
key->num_inputs,
@@ -680,24 +683,26 @@ try_setup_line( struct lp_setup_context *setup,
* these planes elsewhere.
*/
if (nr_planes == 8) {
+ const struct u_rect *scissor = &setup->scissor;
+
plane[4].dcdx = -1;
plane[4].dcdy = 0;
- plane[4].c = 1-bbox.x0;
+ plane[4].c = 1-scissor->x0;
plane[4].eo = 1;
plane[5].dcdx = 1;
plane[5].dcdy = 0;
- plane[5].c = bbox.x1+1;
+ plane[5].c = scissor->x1+1;
plane[5].eo = 0;
plane[6].dcdx = 0;
plane[6].dcdy = 1;
- plane[6].c = 1-bbox.y0;
+ plane[6].c = 1-scissor->y0;
plane[6].eo = 1;
plane[7].dcdx = 0;
plane[7].dcdy = -1;
- plane[7].c = bbox.y1+1;
+ plane[7].c = scissor->y1+1;
plane[7].eo = 0;
}