draw_pipe.c File Reference

Include dependency graph for draw_pipe.c:

Go to the source code of this file.

Defines

#define QUAD(i0, i1, i2, i3)
#define TRIANGLE(flags, i0, i1, i2)
#define LINE(flags, i0, i1)
#define POINT(i0)
#define FUNC   pipe_run
#define ARGS
#define LOCAL_VARS
#define FLUSH
#define QUAD(i0, i1, i2, i3)
#define TRIANGLE(flags, i0, i1, i2)
#define LINE(flags, i0, i1)
#define POINT(i0)
#define FUNC   pipe_run_linear
#define ARGS
#define LOCAL_VARS
#define FLUSH

Functions

boolean draw_pipeline_init (struct draw_context *draw)
void draw_pipeline_destroy (struct draw_context *draw)
static void do_point (struct draw_context *draw, const char *v0)
static void do_line (struct draw_context *draw, ushort flags, const char *v0, const char *v1)
static void do_triangle (struct draw_context *draw, ushort flags, char *v0, char *v1, char *v2)
void draw_pipeline_run (struct draw_context *draw, unsigned prim, struct vertex_header *vertices, unsigned vertex_count, unsigned stride, const ushort *elts, unsigned count)
void draw_pipeline_run_linear (struct draw_context *draw, unsigned prim, struct vertex_header *vertices, unsigned count, unsigned stride)
void draw_pipeline_flush (struct draw_context *draw, unsigned flags)


Define Documentation

#define ARGS

Value:

struct draw_context *draw,                  \
    unsigned prim,                              \
    struct vertex_header *vertices,             \
    unsigned stride

Definition at line 279 of file draw_pipe.c.

#define ARGS

Value:

struct draw_context *draw,                  \
    unsigned prim,                              \
    struct vertex_header *vertices,             \
    unsigned stride,                            \
    const ushort *elts

Definition at line 279 of file draw_pipe.c.

#define FLUSH

Definition at line 292 of file draw_pipe.c.

#define FLUSH

Definition at line 292 of file draw_pipe.c.

#define FUNC   pipe_run_linear

Definition at line 278 of file draw_pipe.c.

#define FUNC   pipe_run

Definition at line 278 of file draw_pipe.c.

#define LINE ( flags,
i0,
i1   ) 

Value:

do_line( draw,                                           \
            flags,                                          \
            verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \
            verts + stride * (i1))

Definition at line 268 of file draw_pipe.c.

#define LINE ( flags,
i0,
i1   ) 

Value:

do_line( draw,                                               \
            elts[i0],                                   \
            verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
            verts + stride * elts[i1])

Definition at line 268 of file draw_pipe.c.

#define LOCAL_VARS

Value:

char *verts = (char *)vertices;                           \
   boolean flatfirst = (draw->rasterizer->flatshade &&       \
                        draw->rasterizer->flatshade_first);  \
   unsigned i;                                               \
   ushort flags

Definition at line 285 of file draw_pipe.c.

#define LOCAL_VARS

Value:

char *verts = (char *)vertices;                           \
   boolean flatfirst = (draw->rasterizer->flatshade &&       \
                        draw->rasterizer->flatshade_first);  \
   unsigned i;                                               \
   ushort flags

Definition at line 285 of file draw_pipe.c.

#define POINT ( i0   ) 

Value:

do_point( draw,                              \
             verts + stride * i0 )

Definition at line 274 of file draw_pipe.c.

#define POINT ( i0   ) 

Value:

do_point( draw,                              \
             verts + stride * elts[i0] )

Definition at line 274 of file draw_pipe.c.

#define QUAD ( i0,
i1,
i2,
i3   ) 

Value:

do_triangle( draw,                                            \
                ( DRAW_PIPE_RESET_STIPPLE |                      \
                  DRAW_PIPE_EDGE_FLAG_0 |                        \
                  DRAW_PIPE_EDGE_FLAG_2 ),                       \
                 verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \
                 verts + stride * (i1),                          \
                verts + stride * (i3));                          \
      do_triangle( draw,                                         \
                   ( DRAW_PIPE_EDGE_FLAG_0 |                     \
                     DRAW_PIPE_EDGE_FLAG_1 ),                    \
                 verts + stride * ((i1) & ~DRAW_PIPE_FLAG_MASK), \
                 verts + stride * (i2),                          \
                 verts + stride * (i3))

Definition at line 246 of file draw_pipe.c.

#define QUAD ( i0,
i1,
i2,
i3   ) 

Value:

do_triangle( draw,                           \
                ( DRAW_PIPE_RESET_STIPPLE |     \
                  DRAW_PIPE_EDGE_FLAG_0 |       \
                  DRAW_PIPE_EDGE_FLAG_2 ),      \
                verts + stride * elts[i0],      \
                verts + stride * elts[i1],      \
                verts + stride * elts[i3]);     \
   do_triangle( draw,                           \
                ( DRAW_PIPE_EDGE_FLAG_0 |       \
                  DRAW_PIPE_EDGE_FLAG_1 ),      \
                verts + stride * elts[i1],      \
                verts + stride * elts[i2],      \
                verts + stride * elts[i3])

Definition at line 246 of file draw_pipe.c.

#define TRIANGLE ( flags,
i0,
i1,
i2   ) 

Value:

do_triangle( draw,                                            \
                flags,  /* flags */                              \
                 verts + stride * ((i0) & ~DRAW_PIPE_FLAG_MASK), \
                 verts + stride * (i1),                          \
                 verts + stride * (i2))

Definition at line 261 of file draw_pipe.c.

#define TRIANGLE ( flags,
i0,
i1,
i2   ) 

Value:

do_triangle( draw,                                                   \
                elts[i0],  /* flags */                          \
                verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK),     \
                verts + stride * elts[i1],                              \
                verts + stride * elts[i2])

Definition at line 261 of file draw_pipe.c.


Function Documentation

static void do_line ( struct draw_context draw,
ushort  flags,
const char *  v0,
const char *  v1 
) [static]

Definition at line 126 of file draw_pipe.c.

References draw_context::first, prim_header::flags, draw_stage::line, prim_header::pad, draw_context::pipeline, and prim_header::v.

00130 {
00131    struct prim_header prim;
00132    
00133    prim.flags = flags;
00134    prim.pad = 0;
00135    prim.v[0] = (struct vertex_header *)v0;
00136    prim.v[1] = (struct vertex_header *)v1;
00137 
00138    draw->pipeline.first->line( draw->pipeline.first, &prim );
00139 }

static void do_point ( struct draw_context draw,
const char *  v0 
) [static]

Definition at line 113 of file draw_pipe.c.

References draw_context::first, prim_header::flags, prim_header::pad, draw_context::pipeline, draw_stage::point, and prim_header::v.

00115 {
00116    struct prim_header prim;
00117    
00118    prim.flags = 0;
00119    prim.pad = 0;
00120    prim.v[0] = (struct vertex_header *)v0;
00121 
00122    draw->pipeline.first->point( draw->pipeline.first, &prim );
00123 }

static void do_triangle ( struct draw_context draw,
ushort  flags,
char *  v0,
char *  v1,
char *  v2 
) [static]

Definition at line 142 of file draw_pipe.c.

References draw_context::first, prim_header::flags, prim_header::pad, draw_context::pipeline, draw_stage::tri, and prim_header::v.

00147 {
00148    struct prim_header prim;
00149    
00150    prim.v[0] = (struct vertex_header *)v0;
00151    prim.v[1] = (struct vertex_header *)v1;
00152    prim.v[2] = (struct vertex_header *)v2;
00153    prim.flags = flags;
00154    prim.pad = 0;
00155 
00156    draw->pipeline.first->tri( draw->pipeline.first, &prim );
00157 }

void draw_pipeline_destroy ( struct draw_context draw  ) 

Definition at line 75 of file draw_pipe.c.

References draw_context::aaline, draw_context::aapoint, draw_context::clip, draw_context::cull, draw_stage::destroy, draw_context::flatshade, draw_context::offset, draw_context::pipeline, draw_context::pstipple, draw_context::rasterize, draw_context::stipple, draw_context::twoside, draw_context::unfilled, draw_context::validate, draw_context::wide_line, and draw_context::wide_point.

00076 {
00077    if (draw->pipeline.wide_line)
00078       draw->pipeline.wide_line->destroy( draw->pipeline.wide_line );
00079    if (draw->pipeline.wide_point)
00080       draw->pipeline.wide_point->destroy( draw->pipeline.wide_point );
00081    if (draw->pipeline.stipple)
00082       draw->pipeline.stipple->destroy( draw->pipeline.stipple );
00083    if (draw->pipeline.unfilled)
00084       draw->pipeline.unfilled->destroy( draw->pipeline.unfilled );
00085    if (draw->pipeline.twoside)
00086       draw->pipeline.twoside->destroy( draw->pipeline.twoside );
00087    if (draw->pipeline.offset)
00088       draw->pipeline.offset->destroy( draw->pipeline.offset );
00089    if (draw->pipeline.clip)
00090       draw->pipeline.clip->destroy( draw->pipeline.clip );
00091    if (draw->pipeline.flatshade)
00092       draw->pipeline.flatshade->destroy( draw->pipeline.flatshade );
00093    if (draw->pipeline.cull)
00094       draw->pipeline.cull->destroy( draw->pipeline.cull );
00095    if (draw->pipeline.validate)
00096       draw->pipeline.validate->destroy( draw->pipeline.validate );
00097    if (draw->pipeline.aaline)
00098       draw->pipeline.aaline->destroy( draw->pipeline.aaline );
00099    if (draw->pipeline.aapoint)
00100       draw->pipeline.aapoint->destroy( draw->pipeline.aapoint );
00101    if (draw->pipeline.pstipple)
00102       draw->pipeline.pstipple->destroy( draw->pipeline.pstipple );
00103    if (draw->pipeline.rasterize)
00104       draw->pipeline.rasterize->destroy( draw->pipeline.rasterize );
00105 }

void draw_pipeline_flush ( struct draw_context draw,
unsigned  flags 
)

Definition at line 314 of file draw_pipe.c.

References draw_context::first, draw_stage::flush, draw_context::pipeline, and draw_context::validate.

00316 {
00317    draw->pipeline.first->flush( draw->pipeline.first, flags );
00318    draw->pipeline.first = draw->pipeline.validate;
00319 }

boolean draw_pipeline_init ( struct draw_context draw  ) 

Definition at line 38 of file draw_pipe.c.

References draw_context::clip, draw_context::cull, draw_clip_stage(), draw_cull_stage(), draw_flatshade_stage(), draw_offset_stage(), draw_stipple_stage(), draw_twoside_stage(), draw_unfilled_stage(), draw_validate_stage(), draw_wide_line_stage(), draw_wide_point_stage(), FALSE, draw_context::first, draw_context::flatshade, draw_context::line_stipple, draw_context::offset, draw_context::pipeline, draw_context::point_sprite, draw_context::stipple, TRUE, draw_context::twoside, draw_context::unfilled, draw_context::validate, draw_context::wide_line, draw_context::wide_line_threshold, draw_context::wide_point, and draw_context::wide_point_threshold.

00039 {
00040    /* create pipeline stages */
00041    draw->pipeline.wide_line  = draw_wide_line_stage( draw );
00042    draw->pipeline.wide_point = draw_wide_point_stage( draw );
00043    draw->pipeline.stipple   = draw_stipple_stage( draw );
00044    draw->pipeline.unfilled  = draw_unfilled_stage( draw );
00045    draw->pipeline.twoside   = draw_twoside_stage( draw );
00046    draw->pipeline.offset    = draw_offset_stage( draw );
00047    draw->pipeline.clip      = draw_clip_stage( draw );
00048    draw->pipeline.flatshade = draw_flatshade_stage( draw );
00049    draw->pipeline.cull      = draw_cull_stage( draw );
00050    draw->pipeline.validate  = draw_validate_stage( draw );
00051    draw->pipeline.first     = draw->pipeline.validate;
00052 
00053    if (!draw->pipeline.wide_line ||
00054        !draw->pipeline.wide_point ||
00055        !draw->pipeline.stipple ||
00056        !draw->pipeline.unfilled ||
00057        !draw->pipeline.twoside ||
00058        !draw->pipeline.offset ||
00059        !draw->pipeline.clip ||
00060        !draw->pipeline.flatshade ||
00061        !draw->pipeline.cull ||
00062        !draw->pipeline.validate)
00063       return FALSE;
00064 
00065    /* these defaults are oriented toward the needs of softpipe */
00066    draw->pipeline.wide_point_threshold = 1000000.0; /* infinity */
00067    draw->pipeline.wide_line_threshold = 1.0;
00068    draw->pipeline.line_stipple = TRUE;
00069    draw->pipeline.point_sprite = TRUE;
00070 
00071    return TRUE;
00072 }

void draw_pipeline_run ( struct draw_context draw,
unsigned  prim,
struct vertex_header vertices,
unsigned  vertex_count,
unsigned  stride,
const ushort elts,
unsigned  count 
)

Definition at line 226 of file draw_pipe.c.

References draw_context::pipeline, draw_context::vertex_count, draw_context::vertex_stride, and draw_context::verts.

00233 {
00234    char *verts = (char *)vertices;
00235 
00236    draw->pipeline.verts = verts;
00237    draw->pipeline.vertex_stride = stride;
00238    draw->pipeline.vertex_count = vertex_count;
00239    
00240    pipe_run(draw, prim, vertices, stride, elts, count);
00241    
00242    draw->pipeline.verts = NULL;
00243    draw->pipeline.vertex_count = 0;
00244 }

void draw_pipeline_run_linear ( struct draw_context draw,
unsigned  prim,
struct vertex_header vertices,
unsigned  count,
unsigned  stride 
)

Definition at line 296 of file draw_pipe.c.

References draw_context::pipeline, draw_context::vertex_count, draw_context::vertex_stride, and draw_context::verts.

00301 {
00302    char *verts = (char *)vertices;
00303    draw->pipeline.verts = verts;
00304    draw->pipeline.vertex_stride = stride;
00305    draw->pipeline.vertex_count = count;
00306 
00307    pipe_run_linear(draw, prim, vertices, stride, count);
00308 
00309    draw->pipeline.verts = NULL;
00310    draw->pipeline.vertex_count = 0;
00311 }


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