Fix looping for multi-color buffer writing.

This commit is contained in:
Brian 2007-12-09 21:10:39 -07:00
parent 04e88f469c
commit 9884838273
6 changed files with 11 additions and 9 deletions

View file

@ -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;

View file

@ -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 */

View file

@ -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;

View file

@ -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 */
}

View file

@ -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 */

View file

@ -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;