sp_quad_colormask.c File Reference

Include dependency graph for sp_quad_colormask.c:

Go to the source code of this file.

Functions

static void colormask_quad (struct quad_stage *qs, struct quad_header *quad)
 quad colormask stage
static void colormask_begin (struct quad_stage *qs)
static void colormask_destroy (struct quad_stage *qs)
struct quad_stagesp_quad_colormask_stage (struct softpipe_context *softpipe)


Function Documentation

static void colormask_begin ( struct quad_stage qs  )  [static]

Definition at line 94 of file sp_quad_colormask.c.

References quad_stage::begin, and quad_stage::next.

00095 {
00096    qs->next->begin(qs->next);
00097 }

static void colormask_destroy ( struct quad_stage qs  )  [static]

Definition at line 100 of file sp_quad_colormask.c.

References FREE.

00101 {
00102    FREE( qs );
00103 }

static void colormask_quad ( struct quad_stage qs,
struct quad_header quad 
) [static]

quad colormask stage

Author:
Brian Paul XXX colormask could be rolled into blending...

Definition at line 48 of file sp_quad_colormask.c.

References softpipe_context::blend, softpipe_context::cbuf_cache, softpipe_cached_tile::color, quad_header_output::color, pipe_blend_state::colormask, COPY_4V, softpipe_cached_tile::data, softpipe_context::framebuffer, quad_header::input, quad_stage::next, pipe_framebuffer_state::num_cbufs, quad_header::output, PIPE_MASK_A, PIPE_MASK_B, PIPE_MASK_G, PIPE_MASK_R, QUAD_SIZE, quad_stage::run, quad_stage::softpipe, sp_get_cached_tile(), TILE_SIZE, softpipe_cached_tile::x, quad_header_input::x0, softpipe_cached_tile::y, and quad_header_input::y0.

00049 {
00050    struct softpipe_context *softpipe = qs->softpipe;
00051    uint cbuf;
00052 
00053    /* loop over colorbuffer outputs */
00054    for (cbuf = 0; cbuf < softpipe->framebuffer.num_cbufs; cbuf++) {
00055       float dest[4][QUAD_SIZE];
00056       struct softpipe_cached_tile *tile
00057          = sp_get_cached_tile(softpipe,
00058                               softpipe->cbuf_cache[cbuf],
00059                               quad->input.x0, quad->input.y0);
00060       float (*quadColor)[4] = quad->output.color[cbuf];
00061       uint i, j;
00062 
00063       /* get/swizzle dest colors */
00064       for (j = 0; j < QUAD_SIZE; j++) {
00065          int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1);
00066          int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1);
00067          for (i = 0; i < 4; i++) {
00068             dest[i][j] = tile->data.color[y][x][i];
00069          }
00070       }
00071 
00072       /* R */
00073       if (!(softpipe->blend->colormask & PIPE_MASK_R))
00074           COPY_4V(quadColor[0], dest[0]);
00075 
00076       /* G */
00077       if (!(softpipe->blend->colormask & PIPE_MASK_G))
00078           COPY_4V(quadColor[1], dest[1]);
00079 
00080       /* B */
00081       if (!(softpipe->blend->colormask & PIPE_MASK_B))
00082           COPY_4V(quadColor[2], dest[2]);
00083 
00084       /* A */
00085       if (!(softpipe->blend->colormask & PIPE_MASK_A))
00086           COPY_4V(quadColor[3], dest[3]);
00087    }
00088 
00089    /* pass quad to next stage */
00090    qs->next->run(qs->next, quad);
00091 }

struct quad_stage* sp_quad_colormask_stage ( struct softpipe_context softpipe  )  [read]

Definition at line 106 of file sp_quad_colormask.c.

References quad_stage::begin, CALLOC_STRUCT, colormask_begin(), colormask_destroy(), colormask_quad(), quad_stage::destroy, quad_stage::run, and quad_stage::softpipe.

00107 {
00108    struct quad_stage *stage = CALLOC_STRUCT(quad_stage);
00109 
00110    stage->softpipe = softpipe;
00111    stage->begin = colormask_begin;
00112    stage->run = colormask_quad;
00113    stage->destroy = colormask_destroy;
00114 
00115    return stage;
00116 }


Generated on Tue Sep 29 06:25:40 2009 for Gallium3D by  doxygen 1.5.4