diff options
author | Brian Paul <[email protected]> | 2008-04-07 16:45:17 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-04-07 16:45:17 -0600 |
commit | 985134211d9fbfe9b7885beeeb85fdcf2ab78f87 (patch) | |
tree | 5f999b1217d7b08a21179dfb4f9e3ad81509ccfd | |
parent | d28a2004b8a69d66595f2c6b5398085b73873533 (diff) |
gallium: check ctx->DrawBuffer before flushing bitmap cache.
During context unbind, we may not have a draw buffer.
This fixes demos/tunnel2.c
-rw-r--r-- | src/mesa/state_tracker/st_cb_bitmap.c | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 59f3c385df3..505a13cc2b3 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -547,36 +547,38 @@ void st_flush_bitmap_cache(struct st_context *st) { if (!st->bitmap.cache->empty) { - struct bitmap_cache *cache = st->bitmap.cache; - struct pipe_context *pipe = st->pipe; - struct pipe_screen *screen = pipe->screen; - struct pipe_surface *surf; - void *dest; - - assert(cache->xmin <= cache->xmax); - /* - printf("flush size %d x %d at %d, %d\n", - cache->xmax - cache->xmin, - cache->ymax - cache->ymin, - cache->xpos, cache->ypos); - */ - - /* update the texture map image */ - surf = screen->get_tex_surface(screen, cache->texture, 0, 0, 0); - dest = pipe_surface_map(surf); - memcpy(dest, cache->buffer, sizeof(cache->buffer)); - pipe_surface_unmap(surf); - pipe_surface_reference(&surf, NULL); - - pipe->texture_update(pipe, cache->texture, 0, 0x1); - - draw_bitmap_quad(st->ctx, - cache->xpos, - cache->ypos, - st->ctx->Current.RasterPos[2], - BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT, - cache->texture); + if (st->ctx->DrawBuffer) { + struct bitmap_cache *cache = st->bitmap.cache; + struct pipe_context *pipe = st->pipe; + struct pipe_screen *screen = pipe->screen; + struct pipe_surface *surf; + void *dest; + + assert(cache->xmin <= cache->xmax); + /* + printf("flush size %d x %d at %d, %d\n", + cache->xmax - cache->xmin, + cache->ymax - cache->ymin, + cache->xpos, cache->ypos); + */ + + /* update the texture map image */ + surf = screen->get_tex_surface(screen, cache->texture, 0, 0, 0); + dest = pipe_surface_map(surf); + memcpy(dest, cache->buffer, sizeof(cache->buffer)); + pipe_surface_unmap(surf); + pipe_surface_reference(&surf, NULL); + + pipe->texture_update(pipe, cache->texture, 0, 0x1); + + draw_bitmap_quad(st->ctx, + cache->xpos, + cache->ypos, + st->ctx->Current.RasterPos[2], + BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT, + cache->texture); + } reset_cache(st); } } |