diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-01-25 08:15:04 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-01-25 08:15:50 -0700 |
commit | a148cc51fbe56266199057cfde2abb2b59eb8713 (patch) | |
tree | 3f12713495b2091865edcd6474f8ff7fb1a8c24d /src/mesa/pipe/draw/draw_twoside.c | |
parent | 48355538a65fe9c0be234c61080edd70f6a86736 (diff) |
gallium: optimizations to flatshade, two-side prim stages
Diffstat (limited to 'src/mesa/pipe/draw/draw_twoside.c')
-rw-r--r-- | src/mesa/pipe/draw/draw_twoside.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c index da8e7bd90d..75c51ec6a9 100644 --- a/src/mesa/pipe/draw/draw_twoside.c +++ b/src/mesa/pipe/draw/draw_twoside.c @@ -75,6 +75,12 @@ static void twoside_begin( struct draw_stage *stage ) } } + if (!twoside->attrib_back0) + twoside->attrib_front0 = 0; + + if (!twoside->attrib_back1) + twoside->attrib_front1 = 0; + /* * We'll multiply the primitive's determinant by this sign to determine * if the triangle is back-facing (negative). @@ -86,28 +92,23 @@ static void twoside_begin( struct draw_stage *stage ) } -static INLINE void copy_attrib( unsigned attr_dst, - unsigned attr_src, - struct vertex_header *v ) -{ - COPY_4FV(v->data[attr_dst], v->data[attr_src]); -} - - /** * Copy back color(s) to front color(s). */ -static struct vertex_header *copy_bfc( struct twoside_stage *twoside, - const struct vertex_header *v, - unsigned idx ) +static INLINE struct vertex_header * +copy_bfc( struct twoside_stage *twoside, + const struct vertex_header *v, + unsigned idx ) { struct vertex_header *tmp = dup_vert( &twoside->stage, v, idx ); - if (twoside->attrib_front0 && twoside->attrib_back0) { - copy_attrib(twoside->attrib_front0, twoside->attrib_back0, tmp); + if (twoside->attrib_back0) { + COPY_4FV(tmp->data[twoside->attrib_front0], + tmp->data[twoside->attrib_back0]); } - if (twoside->attrib_front1 && twoside->attrib_back1) { - copy_attrib(twoside->attrib_front1, twoside->attrib_back1, tmp); + if (twoside->attrib_back1) { + COPY_4FV(tmp->data[twoside->attrib_front1], + tmp->data[twoside->attrib_back1]); } return tmp; |