static void blend_fallback(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) { struct softpipe_context *softpipe = qs->softpipe; const struct pipe_blend_state *blend = softpipe->blend; unsigned cbuf; for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { /* which blend/mask state index to use: */ const uint blend_buf = blend->independent_blend_enable ? cbuf : 0; float dest[4][QUAD_SIZE]; struct softpipe_cached_tile *tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], quads[0]->input.x0, quads[0]->input.y0); uint q, i, j; for (q = 0; q < nr; q++) { struct quad_header *quad = quads[q]; float (*quadColor)[4] = quad->output.color[cbuf]; const int itx = (quad->input.x0 & (TILE_SIZE-1)); const int ity = (quad->input.y0 & (TILE_SIZE-1)); /* get/swizzle dest colors */ for (j = 0; j < QUAD_SIZE; j++) { int x = itx + (j & 1); int y = ity + (j >> 1); for (i = 0; i < 4; i++) { dest[i][j] = tile->data.color[y][x][i]; } } if (blend->logicop_enable) { logicop_quad( qs, quadColor, dest ); } else if (blend->rt[blend_buf].blend_enable) { blend_quad( qs, quadColor, dest, cbuf ); } if (blend->rt[blend_buf].colormask != 0xf) colormask_quad( blend->rt[cbuf].colormask, quadColor, dest); /* Output color values */ for (j = 0; j < QUAD_SIZE; j++) { if (quad->inout.mask & (1 << j)) { int x = itx + (j & 1); int y = ity + (j >> 1); for (i = 0; i < 4; i++) { /* loop over color chans */ tile->data.color[y][x][i] = quadColor[i][j]; } } } } }
static void blend_fallback(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) { const struct blend_quad_stage *bqs = blend_quad_stage(qs); struct softpipe_context *softpipe = qs->softpipe; const struct pipe_blend_state *blend = softpipe->blend; unsigned cbuf; boolean write_all; write_all = softpipe->fs_variant->info.color0_writes_all_cbufs; for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { /* which blend/mask state index to use: */ const uint blend_buf = blend->independent_blend_enable ? cbuf : 0; float dest[4][TGSI_QUAD_SIZE]; struct softpipe_cached_tile *tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], quads[0]->input.x0, quads[0]->input.y0); const boolean clamp = bqs->clamp[cbuf]; const float *blend_color; const boolean dual_source_blend = util_blend_state_is_dual(blend, cbuf); uint q, i, j; if (clamp) blend_color = softpipe->blend_color_clamped.color; else blend_color = softpipe->blend_color.color; for (q = 0; q < nr; q++) { struct quad_header *quad = quads[q]; float (*quadColor)[4]; float (*quadColor2)[4] = NULL; float temp_quad_color[TGSI_QUAD_SIZE][4]; const int itx = (quad->input.x0 & (TILE_SIZE-1)); const int ity = (quad->input.y0 & (TILE_SIZE-1)); if (write_all) { for (j = 0; j < TGSI_QUAD_SIZE; j++) { for (i = 0; i < 4; i++) { temp_quad_color[i][j] = quad->output.color[0][i][j]; } } quadColor = temp_quad_color; } else { quadColor = quad->output.color[cbuf]; if (dual_source_blend) quadColor2 = quad->output.color[cbuf + 1]; } /* If fixed-point dest color buffer, need to clamp the incoming * fragment colors now. */ if (clamp || softpipe->rasterizer->clamp_fragment_color) { clamp_colors(quadColor); } /* get/swizzle dest colors */ for (j = 0; j < TGSI_QUAD_SIZE; j++) { int x = itx + (j & 1); int y = ity + (j >> 1); for (i = 0; i < 4; i++) { dest[i][j] = tile->data.color[y][x][i]; } } if (blend->logicop_enable) { if (bqs->format_type[cbuf] != UTIL_FORMAT_TYPE_FLOAT) { logicop_quad( qs, quadColor, dest ); } } else if (blend->rt[blend_buf].blend_enable) { blend_quad(qs, quadColor, quadColor2, dest, blend_color, blend_buf); /* If fixed-point dest color buffer, need to clamp the outgoing * fragment colors now. */ if (clamp) { clamp_colors(quadColor); } } rebase_colors(bqs->base_format[cbuf], quadColor); if (blend->rt[blend_buf].colormask != 0xf) colormask_quad( blend->rt[cbuf].colormask, quadColor, dest); /* Output color values */ for (j = 0; j < TGSI_QUAD_SIZE; j++) { if (quad->inout.mask & (1 << j)) { int x = itx + (j & 1); int y = ity + (j >> 1); for (i = 0; i < 4; i++) { /* loop over color chans */ tile->data.color[y][x][i] = quadColor[i][j]; } } } } }