diff options
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/draw/draw_clip.c | 28 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_context.c | 16 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_context.h | 4 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_cull.c | 18 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_flatshade.c | 25 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_offset.c | 24 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_private.h | 48 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_twoside.c | 18 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_unfilled.c | 30 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vb.c | 10 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_context.c | 5 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_context.h | 2 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_prim_setup.c | 29 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_prim_setup.h | 2 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_setup.c | 2 |
15 files changed, 141 insertions, 120 deletions
diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c index 619ad7d6d6..7ede51fc6c 100644 --- a/src/mesa/pipe/draw/draw_clip.c +++ b/src/mesa/pipe/draw/draw_clip.c @@ -37,7 +37,7 @@ struct clipper { - struct prim_stage stage; /**< base class */ + struct draw_stage stage; /**< base class */ GLuint active_user_planes; GLfloat (*plane)[4]; @@ -46,7 +46,7 @@ struct clipper { /* This is a bit confusing: */ -static INLINE struct clipper *clipper_stage( struct prim_stage *stage ) +static INLINE struct clipper *clipper_stage( struct draw_stage *stage ) { return (struct clipper *)stage; } @@ -139,7 +139,7 @@ static INLINE GLfloat dot4( const GLfloat *a, #if 0 -static INLINE void do_tri( struct prim_stage *next, +static INLINE void do_tri( struct draw_stage *next, struct prim_header *header ) { GLuint i; @@ -155,7 +155,7 @@ static INLINE void do_tri( struct prim_stage *next, #endif -static void emit_poly( struct prim_stage *stage, +static void emit_poly( struct draw_stage *stage, struct vertex_header **inlist, GLuint n ) { @@ -184,7 +184,7 @@ static void emit_poly( struct prim_stage *stage, #if 0 -static void emit_poly( struct prim_stage *stage ) +static void emit_poly( struct draw_stage *stage ) { GLuint i; @@ -202,7 +202,7 @@ static void emit_poly( struct prim_stage *stage ) /* Clip a triangle against the viewport and user clip planes. */ static void -do_clip_tri( struct prim_stage *stage, +do_clip_tri( struct draw_stage *stage, struct prim_header *header, GLuint clipmask ) { @@ -296,7 +296,7 @@ do_clip_tri( struct prim_stage *stage, /* Clip a line against the viewport and user clip planes. */ static void -do_clip_line( struct prim_stage *stage, +do_clip_line( struct draw_stage *stage, struct prim_header *header, GLuint clipmask ) { @@ -360,7 +360,7 @@ do_clip_line( struct prim_stage *stage, } -static void clip_begin( struct prim_stage *stage ) +static void clip_begin( struct draw_stage *stage ) { struct clipper *clipper = clipper_stage(stage); GLuint nr = stage->draw->nr_planes; @@ -374,7 +374,7 @@ static void clip_begin( struct prim_stage *stage ) static void -clip_point( struct prim_stage *stage, +clip_point( struct draw_stage *stage, struct prim_header *header ) { if (header->v[0]->clipmask == 0) @@ -383,7 +383,7 @@ clip_point( struct prim_stage *stage, static void -clip_line( struct prim_stage *stage, +clip_line( struct draw_stage *stage, struct prim_header *header ) { GLuint clipmask = (header->v[0]->clipmask | @@ -401,7 +401,7 @@ clip_line( struct prim_stage *stage, static void -clip_tri( struct prim_stage *stage, +clip_tri( struct draw_stage *stage, struct prim_header *header ) { GLuint clipmask = (header->v[0]->clipmask | @@ -420,7 +420,7 @@ clip_tri( struct prim_stage *stage, } -static void clip_end( struct prim_stage *stage ) +static void clip_end( struct draw_stage *stage ) { stage->next->end( stage->next ); } @@ -430,11 +430,11 @@ static void clip_end( struct prim_stage *stage ) * Allocate a new clipper stage. * \return pointer to new stage object */ -struct prim_stage *prim_clip( struct draw_context *draw ) +struct draw_stage *draw_clip_stage( struct draw_context *draw ) { struct clipper *clipper = CALLOC_STRUCT(clipper); - prim_alloc_tmps( &clipper->stage, MAX_CLIPPED_VERTICES ); + draw_alloc_tmps( &clipper->stage, MAX_CLIPPED_VERTICES ); clipper->stage.draw = draw; clipper->stage.begin = clip_begin; diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c index d4654791bb..a97f488387 100644 --- a/src/mesa/pipe/draw/draw_context.c +++ b/src/mesa/pipe/draw/draw_context.c @@ -42,12 +42,12 @@ struct draw_context *draw_create( void ) struct draw_context *draw = CALLOC_STRUCT( draw_context ); /* create pipeline stages */ - draw->pipeline.unfilled = prim_unfilled( draw ); - draw->pipeline.twoside = prim_twoside( draw ); - draw->pipeline.offset = prim_offset( draw ); - draw->pipeline.clip = prim_clip( draw ); - draw->pipeline.flatshade = prim_flatshade( draw ); - draw->pipeline.cull = prim_cull( draw ); + draw->pipeline.unfilled = draw_unfilled_stage( draw ); + draw->pipeline.twoside = draw_twoside_stage( draw ); + draw->pipeline.offset = draw_offset_stage( draw ); + draw->pipeline.clip = draw_clip_stage( draw ); + draw->pipeline.flatshade = draw_flatshade_stage( draw ); + draw->pipeline.cull = draw_cull_stage( draw ); ASSIGN_4V( draw->plane[0], -1, 0, 0, 1 ); ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 ); @@ -79,7 +79,7 @@ void draw_destroy( struct draw_context *draw ) */ static void validate_pipeline( struct draw_context *draw ) { - struct prim_stage *next = draw->pipeline.setup; + struct draw_stage *next = draw->pipeline.setup; /* * NOTE: we build up the pipeline in end-to-start order. @@ -150,7 +150,7 @@ void draw_set_setup_state( struct draw_context *draw, * This is provided by the device driver. */ void draw_set_setup_stage( struct draw_context *draw, - struct prim_stage *stage ) + struct draw_stage *stage ) { draw->pipeline.setup = stage; } diff --git a/src/mesa/pipe/draw/draw_context.h b/src/mesa/pipe/draw/draw_context.h index 85f2ace75f..c298d4f46d 100644 --- a/src/mesa/pipe/draw/draw_context.h +++ b/src/mesa/pipe/draw/draw_context.h @@ -44,7 +44,7 @@ struct vertex_buffer; struct draw_context; -struct prim_stage; +struct draw_stage; struct draw_context *draw_create( void ); @@ -61,7 +61,7 @@ void draw_set_setup_state( struct draw_context *draw, const struct pipe_setup_state *setup ); void draw_set_setup_stage( struct draw_context *draw, - struct prim_stage *stage ); + struct draw_stage *stage ); void draw_set_vertex_attributes( struct draw_context *draw, const GLuint *attrs, diff --git a/src/mesa/pipe/draw/draw_cull.c b/src/mesa/pipe/draw/draw_cull.c index 1498874fcf..863686f150 100644 --- a/src/mesa/pipe/draw/draw_cull.c +++ b/src/mesa/pipe/draw/draw_cull.c @@ -39,18 +39,18 @@ struct cull_stage { - struct prim_stage stage; + struct draw_stage stage; GLuint mode; /**< one of PIPE_WINDING_x */ }; -static INLINE struct cull_stage *cull_stage( struct prim_stage *stage ) +static INLINE struct cull_stage *cull_stage( struct draw_stage *stage ) { return (struct cull_stage *)stage; } -static void cull_begin( struct prim_stage *stage ) +static void cull_begin( struct draw_stage *stage ) { struct cull_stage *cull = cull_stage(stage); @@ -60,7 +60,7 @@ static void cull_begin( struct prim_stage *stage ) } -static void cull_tri( struct prim_stage *stage, +static void cull_tri( struct draw_stage *stage, struct prim_header *header ) { /* Window coords: */ @@ -89,21 +89,21 @@ static void cull_tri( struct prim_stage *stage, } -static void cull_line( struct prim_stage *stage, +static void cull_line( struct draw_stage *stage, struct prim_header *header ) { stage->next->line( stage->next, header ); } -static void cull_point( struct prim_stage *stage, +static void cull_point( struct draw_stage *stage, struct prim_header *header ) { stage->next->point( stage->next, header ); } -static void cull_end( struct prim_stage *stage ) +static void cull_end( struct draw_stage *stage ) { stage->next->end( stage->next ); } @@ -112,11 +112,11 @@ static void cull_end( struct prim_stage *stage ) /** * Create a new polygon culling stage. */ -struct prim_stage *prim_cull( struct draw_context *draw ) +struct draw_stage *draw_cull_stage( struct draw_context *draw ) { struct cull_stage *cull = CALLOC_STRUCT(cull_stage); - prim_alloc_tmps( &cull->stage, 0 ); + draw_alloc_tmps( &cull->stage, 0 ); cull->stage.draw = draw; cull->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c index 004b5bdc96..09547865fa 100644 --- a/src/mesa/pipe/draw/draw_flatshade.c +++ b/src/mesa/pipe/draw/draw_flatshade.c @@ -33,20 +33,20 @@ struct flatshade_stage { - struct prim_stage stage; + struct draw_stage stage; const GLuint *lookup; }; -static INLINE struct flatshade_stage *flatshade_stage( struct prim_stage *stage ) +static INLINE struct flatshade_stage *flatshade_stage( struct draw_stage *stage ) { return (struct flatshade_stage *)stage; } -static void flatshade_begin( struct prim_stage *stage ) +static void flatshade_begin( struct draw_stage *stage ) { stage->next->begin( stage->next ); } @@ -65,7 +65,7 @@ static INLINE void copy_attr( GLuint attr, } -static INLINE void copy_colors( struct prim_stage *stage, +static INLINE void copy_colors( struct draw_stage *stage, struct vertex_header *dst, const struct vertex_header *src ) { @@ -83,7 +83,7 @@ static INLINE void copy_colors( struct prim_stage *stage, * Flatshade tri. Required for clipping and when unfilled tris are * active, otherwise handled by hardware. */ -static void flatshade_tri( struct prim_stage *stage, +static void flatshade_tri( struct draw_stage *stage, struct prim_header *header ) { struct prim_header tmp; @@ -103,7 +103,7 @@ static void flatshade_tri( struct prim_stage *stage, /** * Flatshade line. Required for clipping. */ -static void flatshade_line( struct prim_stage *stage, +static void flatshade_line( struct draw_stage *stage, struct prim_header *header ) { struct prim_header tmp; @@ -117,24 +117,27 @@ static void flatshade_line( struct prim_stage *stage, } -static void flatshade_point( struct prim_stage *stage, - struct prim_header *header ) +static void flatshade_point( struct draw_stage *stage, + struct prim_header *header ) { stage->next->point( stage->next, header ); } -static void flatshade_end( struct prim_stage *stage ) +static void flatshade_end( struct draw_stage *stage ) { stage->next->end( stage->next ); } -struct prim_stage *prim_flatshade( struct draw_context *draw ) +/** + * Create flatshading drawing stage. + */ +struct draw_stage *draw_flatshade_stage( struct draw_context *draw ) { struct flatshade_stage *flatshade = CALLOC_STRUCT(flatshade_stage); - prim_alloc_tmps( &flatshade->stage, 2 ); + draw_alloc_tmps( &flatshade->stage, 2 ); flatshade->stage.draw = draw; flatshade->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_offset.c b/src/mesa/pipe/draw/draw_offset.c index a2705d5cd6..1a7f56d0c5 100644 --- a/src/mesa/pipe/draw/draw_offset.c +++ b/src/mesa/pipe/draw/draw_offset.c @@ -39,7 +39,7 @@ struct offset_stage { - struct prim_stage stage; + struct draw_stage stage; GLfloat scale; GLfloat units; @@ -47,13 +47,13 @@ struct offset_stage { -static INLINE struct offset_stage *offset_stage( struct prim_stage *stage ) +static INLINE struct offset_stage *offset_stage( struct draw_stage *stage ) { return (struct offset_stage *) stage; } -static void offset_begin( struct prim_stage *stage ) +static void offset_begin( struct draw_stage *stage ) { struct offset_stage *offset = offset_stage(stage); GLfloat mrd = 1.0 / 65535.0; /* XXX this depends on depthbuffer bits! */ @@ -69,7 +69,7 @@ static void offset_begin( struct prim_stage *stage ) * Offset tri Z. Some hardware can handle this, but not usually when * doing unfilled rendering. */ -static void do_offset_tri( struct prim_stage *stage, +static void do_offset_tri( struct draw_stage *stage, struct prim_header *header ) { struct offset_stage *offset = offset_stage(stage); @@ -110,7 +110,7 @@ static void do_offset_tri( struct prim_stage *stage, } -static void offset_tri( struct prim_stage *stage, +static void offset_tri( struct draw_stage *stage, struct prim_header *header ) { struct prim_header tmp; @@ -125,30 +125,34 @@ static void offset_tri( struct prim_stage *stage, -static void offset_line( struct prim_stage *stage, +static void offset_line( struct draw_stage *stage, struct prim_header *header ) { stage->next->line( stage->next, header ); } -static void offset_point( struct prim_stage *stage, +static void offset_point( struct draw_stage *stage, struct prim_header *header ) { stage->next->point( stage->next, header ); } -static void offset_end( struct prim_stage *stage ) +static void offset_end( struct draw_stage *stage ) { stage->next->end( stage->next ); } -struct prim_stage *prim_offset( struct draw_context *draw ) + +/** + * Create polygon offset drawing stage. + */ +struct draw_stage *draw_offset_stage( struct draw_context *draw ) { struct offset_stage *offset = CALLOC_STRUCT(offset_stage); - prim_alloc_tmps( &offset->stage, 3 ); + draw_alloc_tmps( &offset->stage, 3 ); offset->stage.draw = draw; offset->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index ac25628a08..573b5bf588 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -77,27 +77,27 @@ struct draw_context; /** * Base class for all primitive drawing stages. */ -struct prim_stage +struct draw_stage { struct draw_context *draw; /**< parent context */ - struct prim_stage *next; /**< next stage in pipeline */ + struct draw_stage *next; /**< next stage in pipeline */ struct vertex_header **tmp; GLuint nr_tmps; - void (*begin)( struct prim_stage * ); + void (*begin)( struct draw_stage * ); - void (*point)( struct prim_stage *, + void (*point)( struct draw_stage *, struct prim_header * ); - void (*line)( struct prim_stage *, + void (*line)( struct draw_stage *, struct prim_header * ); - void (*tri)( struct prim_stage *, + void (*tri)( struct draw_stage *, struct prim_header * ); - void (*end)( struct prim_stage * ); + void (*end)( struct draw_stage * ); }; @@ -107,16 +107,16 @@ struct prim_stage struct draw_context { struct { - struct prim_stage *first; /**< one of the following */ + struct draw_stage *first; /**< one of the following */ /* stages (in logical order) */ - struct prim_stage *flatshade; - struct prim_stage *clip; - struct prim_stage *cull; - struct prim_stage *twoside; - struct prim_stage *offset; - struct prim_stage *unfilled; - struct prim_stage *setup; /* aka render/rasterize */ + struct draw_stage *flatshade; + struct draw_stage *clip; + struct draw_stage *cull; + struct draw_stage *twoside; + struct draw_stage *offset; + struct draw_stage *unfilled; + struct draw_stage *setup; /* aka render/rasterize */ } pipeline; /* pipe state that we need: */ @@ -148,16 +148,16 @@ struct draw_context -extern struct prim_stage *prim_unfilled( struct draw_context *context ); -extern struct prim_stage *prim_twoside( struct draw_context *context ); -extern struct prim_stage *prim_offset( struct draw_context *context ); -extern struct prim_stage *prim_clip( struct draw_context *context ); -extern struct prim_stage *prim_flatshade( struct draw_context *context ); -extern struct prim_stage *prim_cull( struct draw_context *context ); +extern struct draw_stage *draw_unfilled_stage( struct draw_context *context ); +extern struct draw_stage *draw_twoside_stage( struct draw_context *context ); +extern struct draw_stage *draw_offset_stage( struct draw_context *context ); +extern struct draw_stage *draw_clip_stage( struct draw_context *context ); +extern struct draw_stage *draw_flatshade_stage( struct draw_context *context ); +extern struct draw_stage *draw_cull_stage( struct draw_context *context ); -extern void prim_free_tmps( struct prim_stage *stage ); -extern void prim_alloc_tmps( struct prim_stage *stage, GLuint nr ); +extern void draw_free_tmps( struct draw_stage *stage ); +extern void draw_alloc_tmps( struct draw_stage *stage, GLuint nr ); @@ -169,7 +169,7 @@ extern void prim_alloc_tmps( struct prim_stage *stage, GLuint nr ); * \return pointer to the copied vertex */ static INLINE struct vertex_header * -dup_vert( struct prim_stage *stage, +dup_vert( struct draw_stage *stage, const struct vertex_header *vert, GLuint idx ) { diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c index e8221639bb..e86123e84d 100644 --- a/src/mesa/pipe/draw/draw_twoside.c +++ b/src/mesa/pipe/draw/draw_twoside.c @@ -34,20 +34,20 @@ struct twoside_stage { - struct prim_stage stage; + struct draw_stage stage; GLfloat facing; const GLuint *lookup; }; -static INLINE struct twoside_stage *twoside_stage( struct prim_stage *stage ) +static INLINE struct twoside_stage *twoside_stage( struct draw_stage *stage ) { return (struct twoside_stage *)stage; } -static void twoside_begin( struct prim_stage *stage ) +static void twoside_begin( struct draw_stage *stage ) { struct twoside_stage *twoside = twoside_stage(stage); @@ -89,7 +89,7 @@ static struct vertex_header *copy_bfc( struct twoside_stage *twoside, /* Twoside tri: */ -static void twoside_tri( struct prim_stage *stage, +static void twoside_tri( struct draw_stage *stage, struct prim_header *header ) { struct twoside_stage *twoside = twoside_stage(stage); @@ -112,7 +112,7 @@ static void twoside_tri( struct prim_stage *stage, } -static void twoside_line( struct prim_stage *stage, +static void twoside_line( struct draw_stage *stage, struct prim_header *header ) { /* pass-through */ @@ -120,7 +120,7 @@ static void twoside_line( struct prim_stage *stage, } -static void twoside_point( struct prim_stage *stage, +static void twoside_point( struct draw_stage *stage, struct prim_header *header ) { /* pass-through */ @@ -128,7 +128,7 @@ static void twoside_point( struct prim_stage *stage, } -static void twoside_end( struct prim_stage *stage ) +static void twoside_end( struct draw_stage *stage ) { /* pass-through */ stage->next->end( stage->next ); @@ -138,11 +138,11 @@ static void twoside_end( struct prim_stage *stage ) /** * Create twoside pipeline stage. */ -struct prim_stage *prim_twoside( struct draw_context *draw ) +struct draw_stage *draw_twoside_stage( struct draw_context *draw ) { struct twoside_stage *twoside = CALLOC_STRUCT(twoside_stage); - prim_alloc_tmps( &twoside->stage, 3 ); + draw_alloc_tmps( &twoside->stage, 3 ); twoside->stage.draw = draw; twoside->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c index 8ee23d7493..f0aee58333 100644 --- a/src/mesa/pipe/draw/draw_unfilled.c +++ b/src/mesa/pipe/draw/draw_unfilled.c @@ -39,7 +39,7 @@ struct unfilled_stage { - struct prim_stage stage; + struct draw_stage stage; /** [0] = front face, [1] = back face. * legal values: PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE, @@ -49,13 +49,13 @@ struct unfilled_stage { }; -static INLINE struct unfilled_stage *unfilled_stage( struct prim_stage *stage ) +static INLINE struct unfilled_stage *unfilled_stage( struct draw_stage *stage ) { return (struct unfilled_stage *)stage; } -static void unfilled_begin( struct prim_stage *stage ) +static void unfilled_begin( struct draw_stage *stage ) { struct unfilled_stage *unfilled = unfilled_stage(stage); @@ -65,7 +65,7 @@ static void unfilled_begin( struct prim_stage *stage ) stage->next->begin( stage->next ); } -static void point( struct prim_stage *stage, +static void point( struct draw_stage *stage, struct vertex_header *v0 ) { struct prim_header tmp; @@ -73,7 +73,7 @@ static void point( struct prim_stage *stage, stage->next->point( stage->next, &tmp ); } -static void line( struct prim_stage *stage, +static void line( struct draw_stage *stage, struct vertex_header *v0, struct vertex_header *v1 ) { @@ -84,7 +84,7 @@ static void line( struct prim_stage *stage, } -static void points( struct prim_stage *stage, +static void points( struct draw_stage *stage, struct prim_header *header ) { struct vertex_header *v0 = header->v[0]; @@ -97,7 +97,7 @@ static void points( struct prim_stage *stage, } -static void lines( struct prim_stage *stage, +static void lines( struct draw_stage *stage, struct prim_header *header ) { struct vertex_header *v0 = header->v[0]; @@ -115,7 +115,7 @@ static void lines( struct prim_stage *stage, * Note edgeflags in the vertex struct is not sufficient as we will * need to manipulate them when decomposing primitives??? */ -static void unfilled_tri( struct prim_stage *stage, +static void unfilled_tri( struct draw_stage *stage, struct prim_header *header ) { struct unfilled_stage *unfilled = unfilled_stage(stage); @@ -136,30 +136,34 @@ static void unfilled_tri( struct prim_stage *stage, } } -static void unfilled_line( struct prim_stage *stage, +static void unfilled_line( struct draw_stage *stage, struct prim_header *header ) { stage->next->line( stage->next, header ); } -static void unfilled_point( struct prim_stage *stage, +static void unfilled_point( struct draw_stage *stage, struct prim_header *header ) { stage->next->point( stage->next, header ); } -static void unfilled_end( struct prim_stage *stage ) +static void unfilled_end( struct draw_stage *stage ) { stage->next->end( stage->next ); } -struct prim_stage *prim_unfilled( struct draw_context *draw ) + +/** + * Create unfilled triangle stage. + */ +struct draw_stage *draw_unfilled_stage( struct draw_context *draw ) { struct unfilled_stage *unfilled = CALLOC_STRUCT(unfilled_stage); - prim_alloc_tmps( &unfilled->stage, 0 ); + draw_alloc_tmps( &unfilled->stage, 0 ); unfilled->stage.draw = draw; unfilled->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_vb.c b/src/mesa/pipe/draw/draw_vb.c index 67e196618a..ac721c589d 100644 --- a/src/mesa/pipe/draw/draw_vb.c +++ b/src/mesa/pipe/draw/draw_vb.c @@ -88,7 +88,7 @@ static void draw_set_prim( struct draw_context *draw, -static void do_quad( struct prim_stage *first, +static void do_quad( struct draw_stage *first, struct vertex_header *v0, struct vertex_header *v1, struct vertex_header *v2, @@ -128,7 +128,7 @@ static void draw_indexed_prim( struct draw_context *draw, const GLuint *elts, GLuint count ) { - struct prim_stage * const first = draw->pipeline.first; + struct draw_stage * const first = draw->pipeline.first; struct prim_header prim; GLuint i; @@ -290,7 +290,7 @@ static void draw_prim( struct draw_context *draw, GLuint start, GLuint count ) { - struct prim_stage * const first = draw->pipeline.first; + struct draw_stage * const first = draw->pipeline.first; struct prim_header prim; GLuint i; @@ -698,7 +698,7 @@ void draw_set_vertex_attributes( struct draw_context *draw, #define MAX_VERTEX_SIZE ((2 + FRAG_ATTRIB_MAX) * 4 * sizeof(GLfloat)) -void prim_alloc_tmps( struct prim_stage *stage, GLuint nr ) +void draw_alloc_tmps( struct draw_stage *stage, GLuint nr ) { stage->nr_tmps = nr; @@ -713,7 +713,7 @@ void prim_alloc_tmps( struct prim_stage *stage, GLuint nr ) } } -void prim_free_tmps( struct prim_stage *stage ) +void draw_free_tmps( struct draw_stage *stage ) { if (stage->tmp) { FREE(stage->tmp[0]); diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 671ef2764b..d3aea3698a 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -98,5 +98,10 @@ struct pipe_context *softpipe_create( void ) softpipe->draw = draw_create(); draw_set_setup_stage(softpipe->draw, prim_setup(softpipe)); + /* + * XXX we could plug GL selection/feedback into the drawing pipeline + * by specifying a different setup/render stage. + */ + return &softpipe->pipe; } diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index 47ce2f0ad8..3ae1de71cf 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -41,7 +41,7 @@ struct softpipe_surface; struct draw_context; -struct prim_stage; +struct draw_stage; enum interp_mode { diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index b194f14c03..5db05ecccb 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -25,9 +25,14 @@ * **************************************************************************/ -/* Authors: Keith Whitwell <keith@tungstengraphics.com> +/** + * \brief Primitive rasterization/rendering (points, lines, triangles) + * + * \author Keith Whitwell <keith@tungstengraphics.com> + * \author Brian Paul */ + #include "imports.h" #include "macros.h" @@ -64,11 +69,11 @@ struct edge { /** - * Triangle setup info (derived from prim_stage). + * Triangle setup info (derived from draw_stage). * Also used for line drawing (taking some liberties). */ struct setup_stage { - struct prim_stage stage; /**< This must be first (base class) */ + struct draw_stage stage; /**< This must be first (base class) */ /*XXX NEW */ struct softpipe_context *softpipe; @@ -105,7 +110,7 @@ struct setup_stage { /** * Basically a cast wrapper. */ -static inline struct setup_stage *setup_stage( struct prim_stage *stage ) +static inline struct setup_stage *setup_stage( struct draw_stage *stage ) { return (struct setup_stage *)stage; } @@ -122,7 +127,7 @@ static inline GLint block( GLint x ) -static void setup_begin( struct prim_stage *stage ) +static void setup_begin( struct draw_stage *stage ) { struct setup_stage *setup = setup_stage(stage); @@ -559,7 +564,7 @@ static void subtriangle( struct setup_stage *setup, /** * Do setup for triangle rasterization, then render the triangle. */ -static void setup_tri( struct prim_stage *stage, +static void setup_tri( struct draw_stage *stage, struct prim_header *prim ) { struct setup_stage *setup = setup_stage( stage ); @@ -576,9 +581,9 @@ static void setup_tri( struct prim_stage *stage, setup->span.y_flags = 0; setup->span.right[0] = 0; setup->span.right[1] = 0; -// setup->span.z_mode = tri_z_mode( setup->ctx ); + /* setup->span.z_mode = tri_z_mode( setup->ctx ); */ -// init_constant_attribs( setup ); + /* init_constant_attribs( setup ); */ if (setup->oneoverarea < 0.0) { /* emaj on left: @@ -714,7 +719,7 @@ plot(struct setup_stage *setup, GLint x, GLint y) * XXX no scissoring yet. */ static void -setup_line(struct prim_stage *stage, struct prim_header *prim) +setup_line(struct draw_stage *stage, struct prim_header *prim) { const struct vertex_header *v0 = prim->v[0]; const struct vertex_header *v1 = prim->v[1]; @@ -810,7 +815,7 @@ setup_line(struct prim_stage *stage, struct prim_header *prim) * XXX could optimize a lot for 1-pixel points. */ static void -setup_point(struct prim_stage *stage, struct prim_header *prim) +setup_point(struct draw_stage *stage, struct prim_header *prim) { struct setup_stage *setup = setup_stage( stage ); /*XXX this should be a vertex attrib! */ @@ -923,7 +928,7 @@ setup_point(struct prim_stage *stage, struct prim_header *prim) -static void setup_end( struct prim_stage *stage ) +static void setup_end( struct draw_stage *stage ) { } @@ -931,7 +936,7 @@ static void setup_end( struct prim_stage *stage ) /** * Create a new primitive setup/render stage. */ -struct prim_stage *prim_setup( struct softpipe_context *softpipe ) +struct draw_stage *prim_setup( struct softpipe_context *softpipe ) { struct setup_stage *setup = CALLOC_STRUCT(setup_stage); diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.h b/src/mesa/pipe/softpipe/sp_prim_setup.h index 4d26c05458..be00b0182b 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.h +++ b/src/mesa/pipe/softpipe/sp_prim_setup.h @@ -43,7 +43,7 @@ #include "s_context.h" -extern struct prim_stage *prim_setup( struct softpipe_context *softpipe ); +extern struct draw_stage *prim_setup( struct softpipe_context *softpipe ); #if 0 /* UNUSED? */ diff --git a/src/mesa/pipe/softpipe/sp_state_setup.c b/src/mesa/pipe/softpipe/sp_state_setup.c index 6dbb87ae79..cef70d42d9 100644 --- a/src/mesa/pipe/softpipe/sp_state_setup.c +++ b/src/mesa/pipe/softpipe/sp_state_setup.c @@ -34,7 +34,7 @@ #if 0 static void validate_prim_pipe( struct softpipe_context *softpipe ) { - struct prim_stage *next = softpipe->prim.setup; + struct draw_stage *next = softpipe->prim.setup; /* TODO: make the current primitive part of the state and build * shorter pipelines for lines & points. |