From: Brian Date: Mon, 10 Dec 2007 04:10:39 +0000 (-0700) Subject: Fix looping for multi-color buffer writing. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=98848382731b71a51e4a80f1820f009e70f06a25;p=mesa.git Fix looping for multi-color buffer writing. --- diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index d4763a98c66..b97cdc52c61 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -154,7 +154,7 @@ struct softpipe_context { struct draw_stage *setup; struct draw_stage *vbuf; - struct pipe_surface *cbuf; /**< current color buffer (one of cbufs) */ + uint current_cbuf; /**< current color buffer being written to */ struct softpipe_tile_cache *cbuf_cache[PIPE_MAX_COLOR_BUFS]; struct softpipe_tile_cache *zbuf_cache; diff --git a/src/mesa/pipe/softpipe/sp_quad.c b/src/mesa/pipe/softpipe/sp_quad.c index e0327c4cf9c..6330465a8b9 100644 --- a/src/mesa/pipe/softpipe/sp_quad.c +++ b/src/mesa/pipe/softpipe/sp_quad.c @@ -77,7 +77,7 @@ sp_build_quad_pipeline(struct softpipe_context *sp) if (sp->framebuffer.num_cbufs == 1) { /* the usual case: write to exactly one colorbuf */ - sp->cbuf = sp->framebuffer.cbufs[0]; + sp->current_cbuf = 0; } else { /* insert bufloop stage */ diff --git a/src/mesa/pipe/softpipe/sp_quad_blend.c b/src/mesa/pipe/softpipe/sp_quad_blend.c index 696e252af17..76a0873fc5e 100644 --- a/src/mesa/pipe/softpipe/sp_quad_blend.c +++ b/src/mesa/pipe/softpipe/sp_quad_blend.c @@ -107,7 +107,8 @@ logicop_quad(struct quad_stage *qs, struct quad_header *quad) uint *dst4 = (uint *) dst; uint *res4 = (uint *) res; struct softpipe_cached_tile * - tile = sp_get_cached_tile(softpipe, softpipe->cbuf_cache[0], + tile = sp_get_cached_tile(softpipe, + softpipe->cbuf_cache[softpipe->current_cbuf], quad->x0, quad->y0); uint i, j; @@ -224,7 +225,8 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) static const float one[4] = { 1, 1, 1, 1 }; float source[4][QUAD_SIZE], dest[4][QUAD_SIZE]; struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe, softpipe->cbuf_cache[0], + = sp_get_cached_tile(softpipe, + softpipe->cbuf_cache[softpipe->current_cbuf], quad->x0, quad->y0); uint i, j; diff --git a/src/mesa/pipe/softpipe/sp_quad_bufloop.c b/src/mesa/pipe/softpipe/sp_quad_bufloop.c index aac70e2b04e..e704b4043cf 100644 --- a/src/mesa/pipe/softpipe/sp_quad_bufloop.c +++ b/src/mesa/pipe/softpipe/sp_quad_bufloop.c @@ -30,7 +30,7 @@ cbuf_loop_quad(struct quad_stage *qs, struct quad_header *quad) for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) { /* set current cbuffer */ - softpipe->cbuf = softpipe->framebuffer.cbufs[i]; + softpipe->current_cbuf = i; /* pass blended quad to next stage */ qs->next->run(qs->next, quad); @@ -38,8 +38,6 @@ cbuf_loop_quad(struct quad_stage *qs, struct quad_header *quad) /* restore quad's colors for next buffer */ memcpy(quad->outputs.color, tmp, sizeof(tmp)); } - - softpipe->cbuf = NULL; /* prevent accidental use */ } diff --git a/src/mesa/pipe/softpipe/sp_quad_colormask.c b/src/mesa/pipe/softpipe/sp_quad_colormask.c index c585aa3eddd..f5e0a32d1b7 100644 --- a/src/mesa/pipe/softpipe/sp_quad_colormask.c +++ b/src/mesa/pipe/softpipe/sp_quad_colormask.c @@ -50,7 +50,8 @@ colormask_quad(struct quad_stage *qs, struct quad_header *quad) float dest[4][QUAD_SIZE]; struct softpipe_cached_tile *tile = sp_get_cached_tile(softpipe, - softpipe->cbuf_cache[0], quad->x0, quad->y0); + softpipe->cbuf_cache[softpipe->current_cbuf], + quad->x0, quad->y0); uint i, j; /* get/swizzle dest colors */ diff --git a/src/mesa/pipe/softpipe/sp_quad_output.c b/src/mesa/pipe/softpipe/sp_quad_output.c index cebfec18f74..f04a550e3df 100644 --- a/src/mesa/pipe/softpipe/sp_quad_output.c +++ b/src/mesa/pipe/softpipe/sp_quad_output.c @@ -43,7 +43,8 @@ output_quad(struct quad_stage *qs, struct quad_header *quad) { struct softpipe_context *softpipe = qs->softpipe; struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe, softpipe->cbuf_cache[0], + = sp_get_cached_tile(softpipe, + softpipe->cbuf_cache[softpipe->current_cbuf], quad->x0, quad->y0); /* in-tile pos: */ const int itx = quad->x0 % TILE_SIZE;