- assert(x % TILE_SIZE == 0);
- assert(y % TILE_SIZE == 0);
-
- task->x = x;
- task->y = y;
-
- if (scene->has_color_clear)
- usage = LP_TEX_USAGE_WRITE_ALL;
- else
- usage = LP_TEX_USAGE_READ_WRITE;
-
- /* get pointers to color tile(s) */
- for (buf = 0; buf < rast->state.nr_cbufs; buf++) {
- struct pipe_surface *cbuf = rast->curr_scene->fb.cbufs[buf];
- struct llvmpipe_resource *lpt;
- assert(cbuf);
- lpt = llvmpipe_resource(cbuf->texture);
- task->color_tiles[buf] = llvmpipe_get_texture_tile(lpt,
- cbuf->face + cbuf->zslice,
- cbuf->level,
- usage,
- x, y);
- assert(task->color_tiles[buf]);
- }
-
- /* get pointer to depth/stencil tile */
- {
- struct pipe_surface *zsbuf = rast->curr_scene->fb.zsbuf;
- if (zsbuf) {
- struct llvmpipe_resource *lpt = llvmpipe_resource(zsbuf->texture);
-
- if (scene->has_depthstencil_clear)
- usage = LP_TEX_USAGE_WRITE_ALL;
- else
- usage = LP_TEX_USAGE_READ_WRITE;
-
- /* "prime" the tile: convert data from linear to tiled if necessary
- * and update the tile's layout info.
- */
- (void) llvmpipe_get_texture_tile(lpt,
- zsbuf->face + zsbuf->zslice,
- zsbuf->level,
- usage,
- x, y);
- /* Get actual pointer to the tile data. Note that depth/stencil
- * data is tiled differently than color data.
- */
- task->depth_tile = lp_rast_get_depth_block_pointer(task, x, y);
-
- assert(task->depth_tile);
- }
- else {
- task->depth_tile = NULL;
+ task->bin = bin;
+ task->x = x * TILE_SIZE;
+ task->y = y * TILE_SIZE;
+ task->width = TILE_SIZE + x * TILE_SIZE > task->scene->fb.width ?
+ task->scene->fb.width - x * TILE_SIZE : TILE_SIZE;
+ task->height = TILE_SIZE + y * TILE_SIZE > task->scene->fb.height ?
+ task->scene->fb.height - y * TILE_SIZE : TILE_SIZE;
+
+ task->thread_data.vis_counter = 0;
+ task->ps_invocations = 0;
+
+ for (i = 0; i < task->scene->fb.nr_cbufs; i++) {
+ if (task->scene->fb.cbufs[i]) {
+ task->color_tiles[i] = scene->cbufs[i].map +
+ scene->cbufs[i].stride * task->y +
+ scene->cbufs[i].format_bytes * task->x;