struct framebuffer fb;
-uint tile[TILE_SIZE][TILE_SIZE] ALIGN16_ATTRIB;
+uint ctile[TILE_SIZE][TILE_SIZE] ALIGN16_ATTRIB;
+uint ztile[TILE_SIZE][TILE_SIZE] ALIGN16_ATTRIB;
int DefaultTag;
void
get_tile(const struct framebuffer *fb, uint tx, uint ty, uint *tile,
- int tag)
+ int tag, int zBuf)
{
- uint offset = ty * fb->width_tiles + tx;
- uint bytesPerTile = TILE_SIZE * TILE_SIZE * 4;
- ubyte *src = (ubyte *) fb->color_start + offset * bytesPerTile;
+ const uint offset = ty * fb->width_tiles + tx;
+ const uint bytesPerTile = TILE_SIZE * TILE_SIZE * 4;
+ const ubyte *src = zBuf ? fb->depth_start : fb->color_start;
+
+ src += offset * bytesPerTile;
assert(tx < fb->width_tiles);
assert(ty < fb->height_tiles);
void
put_tile(const struct framebuffer *fb, uint tx, uint ty, const uint *tile,
- int tag)
+ int tag, int zBuf)
{
- uint offset = ty * fb->width_tiles + tx;
- uint bytesPerTile = TILE_SIZE * TILE_SIZE * 4;
- ubyte *dst = (ubyte *) fb->color_start + offset * bytesPerTile;
+ const uint offset = ty * fb->width_tiles + tx;
+ const uint bytesPerTile = TILE_SIZE * TILE_SIZE * 4;
+ ubyte *dst = zBuf ? fb->depth_start : fb->color_start;
+
+ dst += offset * bytesPerTile;
assert(tx < fb->width_tiles);
assert(ty < fb->height_tiles);
clear_tiles(const struct cell_command_clear_tiles *clear)
{
uint num_tiles = fb.width_tiles * fb.height_tiles;
- uint i;
- uint tile[TILE_SIZE * TILE_SIZE] ALIGN16_ATTRIB;
+ uint i, j;
int tag = init.id;
- for (i = 0; i < TILE_SIZE * TILE_SIZE; i++)
- tile[i] = clear->value;
+ for (i = 0; i < TILE_SIZE; i++)
+ for (j = 0; j < TILE_SIZE; j++)
+ ctile[i][j] = clear->value;
/*
printf("SPU: %s num=%d w=%d h=%d\n",
for (i = init.id; i < num_tiles; i += init.num_spus) {
uint tx = i % fb.width_tiles;
uint ty = i / fb.width_tiles;
- put_tile(&fb, tx, ty, tile, tag);
+ put_tile(&fb, tx, ty, (uint *) ctile, tag, 0);
/* XXX we don't want this here, but it fixes bad tile results */
wait_on_mask(1 << tag);
}
assert(tx < fb.width_tiles);
assert(ty < fb.height_tiles);
- get_tile(&fb, tx, ty, (uint *) tile, tag);
+ get_tile(&fb, tx, ty, (uint *) ctile, tag, 0);
wait_on_mask(1 << tag); /* XXX temporary */
+ if (fb.depth_format == PIPE_FORMAT_Z32_UNORM) {
+ get_tile(&fb, tx, ty, (uint *) ztile, tag+1, 1);
+ wait_on_mask(1 << (tag+1)); /* XXX temporary */
+ }
+
assert(render->prim_type == PIPE_PRIM_TRIANGLES);
/* loop over tris */
tri_draw(&prim, tx, ty);
}
- put_tile(&fb, tx, ty, (uint *) tile, tag);
+ put_tile(&fb, tx, ty, (uint *) ctile, tag, 0);
wait_on_mask(1 << tag); /* XXX temp */
+
+ if (fb.depth_format == PIPE_FORMAT_Z32_UNORM) {
+ put_tile(&fb, tx, ty, (uint *) ztile, tag+1, 1);
+ wait_on_mask(1 << (tag+1)); /* XXX temporary */
+ }
}
}
eval_coeff(setup, 1, (float) x, (float) y, colors);
if (mask & MASK_TOP_LEFT)
- tile[iy][ix] = pack_color(colors[QUAD_TOP_LEFT]);
+ ctile[iy][ix] = pack_color(colors[QUAD_TOP_LEFT]);
if (mask & MASK_TOP_RIGHT)
- tile[iy][ix+1] = pack_color(colors[QUAD_TOP_RIGHT]);
+ ctile[iy][ix+1] = pack_color(colors[QUAD_TOP_RIGHT]);
if (mask & MASK_BOTTOM_LEFT)
- tile[iy+1][ix] = pack_color(colors[QUAD_BOTTOM_LEFT]);
+ ctile[iy+1][ix] = pack_color(colors[QUAD_BOTTOM_LEFT]);
if (mask & MASK_BOTTOM_RIGHT)
- tile[iy+1][ix+1] = pack_color(colors[QUAD_BOTTOM_RIGHT]);
+ ctile[iy+1][ix+1] = pack_color(colors[QUAD_BOTTOM_RIGHT]);
#endif
}