summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_rast_tri.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-10-09 12:19:49 +0100
committerKeith Whitwell <[email protected]>2009-10-09 12:19:49 +0100
commite215f94f15fd20919cc0ed500dc2efde4f076516 (patch)
tree90e883fd2880009002545180a83399b1668684f6 /src/gallium/drivers/llvmpipe/lp_rast_tri.c
parent4cdd10cb4b60d85f6c231a26739f7d5e264a05e5 (diff)
llvmpipe: get lp_setup_tri building
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast_tri.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_tri.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
index efc635bffea..7110afb9d57 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
@@ -158,21 +158,6 @@ void lp_rast_triangle( struct lp_rasterizer *rast,
const union lp_rast_cmd_arg arg )
{
const struct lp_rast_triangle *tri = arg.triangle;
- int minx, maxx, miny, maxy;
-
- /* Clamp to tile dimensions:
- */
- minx = MAX2(tri->maxx, rast->x);
- miny = MAX2(tri->miny, rast->y);
- maxx = MIN2(tri->maxx, rast->x + TILE_SIZE);
- maxy = MIN2(tri->maxy, rast->y + TILE_SIZE);
-
- if (miny == maxy ||
- minx == maxx) {
- debug_printf("%s: non-intersecting triangle in bin\n", __FUNCTION__);
- //assert(0);
- return;
- }
const int step = BLOCKSIZE;
@@ -191,11 +176,33 @@ void lp_rast_triangle( struct lp_rasterizer *rast,
float ystep1 = step * tri->dx12;
float ystep2 = step * tri->dx23;
float ystep3 = step * tri->dx31;
+
+ /* Clamp to tile dimensions:
+ */
+ int minx = MAX2(tri->maxx, rast->x);
+ int miny = MAX2(tri->miny, rast->y);
+ int maxx = MIN2(tri->maxx, rast->x + TILE_SIZE);
+ int maxy = MIN2(tri->maxy, rast->y + TILE_SIZE);
+
int x, y;
+ float x0, y0;
+ float c1, c2, c3;
+
+ if (miny == maxy || minx == maxx) {
+ debug_printf("%s: non-intersecting triangle in bin\n", __FUNCTION__);
+ return;
+ }
minx &= ~(step-1);
miny &= ~(step-1);
+ x0 = (float)minx;
+ y0 = (float)miny;
+
+ c1 = tri->c1 + tri->dx12 * y0 - tri->dy12 * x0;
+ c2 = tri->c2 + tri->dx23 * y0 - tri->dy23 * x0;
+ c3 = tri->c3 + tri->dx31 * y0 - tri->dy31 * x0;
+
for (y = miny; y < maxy; y += step)
{
float cx1 = c1;