diff options
author | Marek Olšák <[email protected]> | 2012-09-13 00:46:54 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-09-30 18:57:56 +0200 |
commit | c15dbd7ef2d60bcab3d1914f8e19fde3e966694e (patch) | |
tree | 5134796858ff1af673aa4e480862b962f6863696 /src/gallium/drivers | |
parent | 0615e8324ca949a5f86614e727122bfb2f230135 (diff) |
softpipe: fix set_framebuffer_state with uninitialized surfaces past nr_cbufs-1
Tested-by: Michel Dänzer <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state_surface.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c index 2db6faeca46..c0bd1f757e1 100644 --- a/src/gallium/drivers/softpipe/sp_state_surface.c +++ b/src/gallium/drivers/softpipe/sp_state_surface.c @@ -54,16 +54,18 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, draw_flush(sp->draw); for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + struct pipe_surface *cb = i < fb->nr_cbufs ? fb->cbufs[i] : NULL; + /* check if changing cbuf */ - if (sp->framebuffer.cbufs[i] != fb->cbufs[i]) { + if (sp->framebuffer.cbufs[i] != cb) { /* flush old */ sp_flush_tile_cache(sp->cbuf_cache[i]); /* assign new */ - pipe_surface_reference(&sp->framebuffer.cbufs[i], fb->cbufs[i]); + pipe_surface_reference(&sp->framebuffer.cbufs[i], cb); /* update cache */ - sp_tile_cache_set_surface(sp->cbuf_cache[i], fb->cbufs[i]); + sp_tile_cache_set_surface(sp->cbuf_cache[i], cb); } } |