+ 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_depth_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(rast, x, y);
+
+ assert(task->depth_tile);
+ }
+ else {
+ task->depth_tile = NULL;
+ }
+ }