summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_rast.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-10-09 19:16:36 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-10-09 19:16:36 +0100
commit61f3eeb6403e404d297bdcd924c215ed36060945 (patch)
tree65941a3bb39bc6b87740a06038b4cb66785b71c8 /src/gallium/drivers/llvmpipe/lp_rast.c
parent8c80413360855106734068066382be8c3a46a64f (diff)
llvmpipe: Use framebuffer coords consistently.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 38c3aea921..2038403c8f 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -202,7 +202,7 @@ void lp_rast_shade_tile( struct lp_rasterizer *rast,
*/
for (y = 0; y < TILE_SIZE; y += 2)
for (x = 0; x < TILE_SIZE; x += 8)
- lp_rast_shade_quads( rast, inputs, x, y, masks);
+ lp_rast_shade_quads( rast, inputs, rast->x + x, rast->y + y, masks);
}
@@ -211,6 +211,7 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast,
unsigned x, unsigned y,
const unsigned *masks)
{
+#if 1
const struct lp_rast_state *state = inputs->state;
struct lp_rast_tile *tile = &rast->tile;
void *color;
@@ -218,23 +219,27 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast,
uint32_t ALIGN16_ATTRIB mask[4][NUM_CHANNELS];
unsigned chan_index;
unsigned q;
+ unsigned ix, iy;
/* Sanity checks */
assert(x % TILE_VECTOR_WIDTH == 0);
assert(y % TILE_VECTOR_HEIGHT == 0);
+ ix = x % TILE_SIZE;
+ iy = y % TILE_SIZE;
+
/* mask */
for (q = 0; q < 4; ++q)
for (chan_index = 0; chan_index < NUM_CHANNELS; ++chan_index)
mask[q][chan_index] = masks[q] & (1 << chan_index) ? ~0 : 0;
/* color buffer */
- color = &TILE_PIXEL(tile->color, x, y, 0);
+ color = &TILE_PIXEL(tile->color, ix, iy, 0);
/* depth buffer */
assert((x % 2) == 0);
assert((y % 2) == 0);
- depth = tile->depth + y*TILE_SIZE + 2*x;
+ depth = tile->depth + iy*TILE_SIZE + 2*ix;
/* XXX: This will most likely fail on 32bit x86 without -mstackrealign */
assert(lp_check_alignment(mask, 16));
@@ -245,14 +250,30 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast,
/* run shader */
state->jit_function( &state->jit_context,
- rast->x + x, rast->y + y,
+ x, y,
inputs->a0,
inputs->dadx,
inputs->dady,
&mask[0][0],
color,
depth);
+#else
+ struct lp_rast_tile *tile = &rast->tile;
+ unsigned chan_index;
+ unsigned q, ix, iy;
+
+ x %= TILE_SIZE;
+ y %= TILE_SIZE;
+
+ /* mask */
+ for (q = 0; q < 4; ++q)
+ for(iy = 0; iy < 2; ++iy)
+ for(ix = 0; ix < 2; ++ix)
+ if(masks[q] & (1 << (iy*2 + ix)))
+ for (chan_index = 0; chan_index < NUM_CHANNELS; ++chan_index)
+ TILE_PIXEL(tile->color, x + q*2 + ix, y + iy, chan_index) = 0xff;
+#endif
}