sp_quad_bufloop.c File Reference

Include dependency graph for sp_quad_bufloop.c:

Go to the source code of this file.

Functions

static void cbuf_loop_quad (struct quad_stage *qs, struct quad_header *quad)
 Loop over colorbuffers, passing quad to next stage each time.
static void cbuf_loop_begin (struct quad_stage *qs)
static void cbuf_loop_destroy (struct quad_stage *qs)
struct quad_stagesp_quad_bufloop_stage (struct softpipe_context *softpipe)
 Create the colorbuffer loop stage.


Function Documentation

static void cbuf_loop_begin ( struct quad_stage qs  )  [static]

Definition at line 46 of file sp_quad_bufloop.c.

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

00047 {
00048    qs->next->begin(qs->next);
00049 }

static void cbuf_loop_destroy ( struct quad_stage qs  )  [static]

Definition at line 52 of file sp_quad_bufloop.c.

References FREE.

00053 {
00054    FREE( qs );
00055 }

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

Loop over colorbuffers, passing quad to next stage each time.

Definition at line 13 of file sp_quad_bufloop.c.

References assert, softpipe_context::framebuffer, quad_stage::next, pipe_framebuffer_state::num_cbufs, PIPE_MAX_COLOR_BUFS, QUAD_SIZE, quad_stage::run, and quad_stage::softpipe.

00014 {
00015    struct softpipe_context *softpipe = qs->softpipe;
00016    float tmp[PIPE_MAX_COLOR_BUFS][4][QUAD_SIZE];
00017    unsigned i;
00018 
00019    assert(sizeof(quad->outputs.color) == sizeof(tmp));
00020    assert(softpipe->framebuffer.num_cbufs <= PIPE_MAX_COLOR_BUFS);
00021 
00022    /* make copy of original colors since they can get modified
00023     * by blending and masking.
00024     * XXX we won't have to do this if the fragment program actually emits
00025     * N separate colors and we're drawing to N color buffers (MRT).
00026     * But if we emitted one color and glDrawBuffer(GL_FRONT_AND_BACK) is
00027     * in effect, we need to save/restore colors like this.
00028     */
00029    memcpy(tmp, quad->outputs.color, sizeof(tmp));
00030 
00031    for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) {
00032       /* set current cbuffer */
00033 #if 0 /* obsolete & going away */
00034       softpipe->current_cbuf = i;
00035 #endif
00036 
00037       /* pass blended quad to next stage */
00038       qs->next->run(qs->next, quad);
00039 
00040       /* restore quad's colors for next buffer */
00041       memcpy(quad->outputs.color, tmp, sizeof(tmp));
00042    }
00043 }

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

Create the colorbuffer loop stage.

This is used to implement multiple render targets and GL_FRONT_AND_BACK rendering.

Definition at line 63 of file sp_quad_bufloop.c.

References quad_stage::begin, CALLOC_STRUCT, cbuf_loop_begin(), cbuf_loop_destroy(), cbuf_loop_quad(), quad_stage::destroy, quad_stage::run, and quad_stage::softpipe.

00064 {
00065    struct quad_stage *stage = CALLOC_STRUCT(quad_stage);
00066 
00067    stage->softpipe = softpipe;
00068    stage->begin = cbuf_loop_begin;
00069    stage->run = cbuf_loop_quad;
00070    stage->destroy = cbuf_loop_destroy;
00071 
00072    return stage;
00073 }


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