[Mesa-dev] [PATCH 02/23] softpipe: fix set_framebuffer_state with uninitialized surfaces past nr_cbufs-1
Marek Olšák
maraeo at gmail.com
Fri Sep 14 10:09:29 PDT 2012
---
src/gallium/drivers/softpipe/sp_state_surface.c | 8 +++++---
1 file 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 2db6fae..c0bd1f7 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);
}
}
--
1.7.9.5
More information about the mesa-dev
mailing list