-/**
- * Prepare this scene for the rasterizer.
- * Map the framebuffer surfaces. Initialize the 'rast' state.
- */
-static boolean
-lp_scene_map_buffers( struct lp_scene *scene )
-{
- struct pipe_context *pipe = scene->pipe;
- struct pipe_surface *cbuf, *zsbuf;
- int i;
-
- LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
-
-
- /* Map all color buffers
- */
- for (i = 0; i < scene->fb.nr_cbufs; i++) {
- cbuf = scene->fb.cbufs[i];
- if (cbuf) {
- scene->cbuf_transfer[i] = pipe->get_tex_transfer(pipe,
- cbuf->texture,
- cbuf->face,
- cbuf->level,
- cbuf->zslice,
- PIPE_TRANSFER_READ_WRITE,
- 0, 0,
- cbuf->width,
- cbuf->height);
- if (!scene->cbuf_transfer[i])
- goto fail;
-
- scene->cbuf_map[i] = pipe->transfer_map(pipe,
- scene->cbuf_transfer[i]);
- if (!scene->cbuf_map[i])
- goto fail;
- }
- }
-
- /* Map the zsbuffer
- */
- zsbuf = scene->fb.zsbuf;
- if (zsbuf) {
- scene->zsbuf_transfer = pipe->get_tex_transfer(pipe,
- zsbuf->texture,
- zsbuf->face,
- zsbuf->level,
- zsbuf->zslice,
- PIPE_TRANSFER_READ_WRITE,
- 0, 0,
- zsbuf->width,
- zsbuf->height);
- if (!scene->zsbuf_transfer)
- goto fail;
-
- scene->zsbuf_map = pipe->transfer_map(pipe,
- scene->zsbuf_transfer);
- if (!scene->zsbuf_map)
- goto fail;
- }
-
- return TRUE;
-
-fail:
- /* Unmap and release transfers?
- */
- return FALSE;
-}
-
-
-
-/**
- * Called after rasterizer as finished rasterizing a scene.
- *
- * We want to call this from the pipe_context's current thread to
- * avoid having to have mutexes on the transfer functions.
- */
-static void
-lp_scene_unmap_buffers( struct lp_scene *scene )
-{
- struct pipe_context *pipe = scene->pipe;
- unsigned i;
-
- for (i = 0; i < scene->fb.nr_cbufs; i++) {
- if (scene->cbuf_map[i])
- pipe->transfer_unmap(pipe, scene->cbuf_transfer[i]);
-
- if (scene->cbuf_transfer[i])
- pipe->tex_transfer_destroy(pipe, scene->cbuf_transfer[i]);
-
- scene->cbuf_transfer[i] = NULL;
- scene->cbuf_map[i] = NULL;
- }
-
- if (scene->zsbuf_map)
- pipe->transfer_unmap(pipe, scene->zsbuf_transfer);
-
- if (scene->zsbuf_transfer)
- pipe->tex_transfer_destroy(pipe, scene->zsbuf_transfer);
-
- scene->zsbuf_transfer = NULL;
- scene->zsbuf_map = NULL;
-
- util_unreference_framebuffer_state( &scene->fb );
-}
-
-