diff options
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_scene.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_scene.c | 138 |
1 files changed, 50 insertions, 88 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index 72492c0f0c..0b185c4c41 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -35,6 +35,14 @@ #include "lp_debug.h" +/** List of texture references */ +struct texture_ref { + struct pipe_resource *texture; + struct texture_ref *prev, *next; /**< linked list w/ u_simple_list.h */ +}; + + + struct lp_scene * lp_scene_create( struct pipe_context *pipe, struct lp_scene_queue *queue ) @@ -57,7 +65,7 @@ lp_scene_create( struct pipe_context *pipe, scene->data.head = scene->data.tail = CALLOC_STRUCT(data_block); - make_empty_list(&scene->textures); + make_empty_list(&scene->resources); pipe_mutex_init(scene->mutex); @@ -178,14 +186,17 @@ lp_scene_reset(struct lp_scene *scene ) /* Release texture refs */ { - struct texture_ref *ref, *next, *ref_list = &scene->textures; + struct resource_ref *ref, *next, *ref_list = &scene->resources; for (ref = ref_list->next; ref != ref_list; ref = next) { next = next_elem(ref); - pipe_texture_reference(&ref->texture, NULL); + pipe_resource_reference(&ref->resource, NULL); FREE(ref); } make_empty_list(ref_list); } + + scene->has_color_clear = FALSE; + scene->has_depth_clear = FALSE; } @@ -244,32 +255,32 @@ lp_scene_bin_size( const struct lp_scene *scene, unsigned x, unsigned y ) /** - * Add a reference to a texture by the scene. + * Add a reference to a resource by the scene. */ void -lp_scene_texture_reference( struct lp_scene *scene, - struct pipe_texture *texture ) +lp_scene_add_resource_reference(struct lp_scene *scene, + struct pipe_resource *resource) { - struct texture_ref *ref = CALLOC_STRUCT(texture_ref); + struct resource_ref *ref = CALLOC_STRUCT(resource_ref); if (ref) { - struct texture_ref *ref_list = &scene->textures; - pipe_texture_reference(&ref->texture, texture); + struct resource_ref *ref_list = &scene->resources; + pipe_resource_reference(&ref->resource, resource); insert_at_tail(ref_list, ref); } } /** - * Does this scene have a reference to the given texture? + * Does this scene have a reference to the given resource? */ boolean -lp_scene_is_texture_referenced( const struct lp_scene *scene, - const struct pipe_texture *texture ) +lp_scene_is_resource_referenced(const struct lp_scene *scene, + const struct pipe_resource *resource) { - const struct texture_ref *ref_list = &scene->textures; - const struct texture_ref *ref; + const struct resource_ref *ref_list = &scene->resources; + const struct resource_ref *ref; foreach (ref, ref_list) { - if (ref->texture == texture) + if (ref->resource == resource) return TRUE; } return FALSE; @@ -390,6 +401,7 @@ end: } + /** * Prepare this scene for the rasterizer. * Map the framebuffer surfaces. Initialize the 'rast' state. @@ -397,65 +409,12 @@ end: static boolean lp_scene_map_buffers( struct lp_scene *scene ) { - struct pipe_screen *screen = scene->pipe->screen; - 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] = screen->get_tex_transfer(screen, - 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] = screen->transfer_map(screen, - scene->cbuf_transfer[i]); - if (!scene->cbuf_map[i]) - goto fail; - } - } - - /* Map the zsbuffer - */ - zsbuf = scene->fb.zsbuf; - if (zsbuf) { - scene->zsbuf_transfer = screen->get_tex_transfer(screen, - 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 = screen->transfer_map(screen, - scene->zsbuf_transfer); - if (!scene->zsbuf_map) - goto fail; - } + /* XXX framebuffer surfaces are no longer mapped here */ + /* XXX move all map/unmap stuff into rast module... */ return TRUE; - -fail: - /* Unmap and release transfers? - */ - return FALSE; } @@ -469,28 +428,29 @@ fail: static void lp_scene_unmap_buffers( struct lp_scene *scene ) { - struct pipe_screen *screen = scene->pipe->screen; +#if 0 unsigned i; for (i = 0; i < scene->fb.nr_cbufs; i++) { - if (scene->cbuf_map[i]) - screen->transfer_unmap(screen, scene->cbuf_transfer[i]); - - if (scene->cbuf_transfer[i]) - screen->tex_transfer_destroy(scene->cbuf_transfer[i]); - - scene->cbuf_transfer[i] = NULL; - scene->cbuf_map[i] = NULL; + if (scene->cbuf_map[i]) { + struct pipe_surface *cbuf = scene->fb.cbufs[i]; + llvmpipe_resource_unmap(cbuf->texture, + cbuf->face, + cbuf->level, + cbuf->zslice); + scene->cbuf_map[i] = NULL; + } } - if (scene->zsbuf_map) - screen->transfer_unmap(screen, scene->zsbuf_transfer); - - if (scene->zsbuf_transfer) - screen->tex_transfer_destroy(scene->zsbuf_transfer); - - scene->zsbuf_transfer = NULL; - scene->zsbuf_map = NULL; + if (scene->zsbuf_map) { + struct pipe_surface *zsbuf = scene->fb.zsbuf; + llvmpipe_resource_unmap(zsbuf->texture, + zsbuf->face, + zsbuf->level, + zsbuf->zslice); + scene->zsbuf_map = NULL; + } +#endif util_unreference_framebuffer_state( &scene->fb ); } @@ -505,6 +465,9 @@ void lp_scene_begin_binning( struct lp_scene *scene, scene->tiles_x = align(fb->width, TILE_SIZE) / TILE_SIZE; scene->tiles_y = align(fb->height, TILE_SIZE) / TILE_SIZE; + + assert(scene->tiles_x <= TILES_X); + assert(scene->tiles_y <= TILES_Y); } @@ -524,7 +487,6 @@ void lp_scene_rasterize( struct lp_scene *scene, } } - scene->write_depth = (scene->fb.zsbuf != NULL && write_depth); |