summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/draw/draw_flatshade.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-25 08:15:04 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-25 08:15:50 -0700
commita148cc51fbe56266199057cfde2abb2b59eb8713 (patch)
tree3f12713495b2091865edcd6474f8ff7fb1a8c24d /src/mesa/pipe/draw/draw_flatshade.c
parent48355538a65fe9c0be234c61080edd70f6a86736 (diff)
gallium: optimizations to flatshade, two-side prim stages
Diffstat (limited to 'src/mesa/pipe/draw/draw_flatshade.c')
-rw-r--r--src/mesa/pipe/draw/draw_flatshade.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c
index 46b0f7970f..8444c53310 100644
--- a/src/mesa/pipe/draw/draw_flatshade.c
+++ b/src/mesa/pipe/draw/draw_flatshade.c
@@ -70,18 +70,31 @@ static void flatshade_begin( struct draw_stage *stage )
/** Copy all the color attributes from 'src' vertex to 'dst' vertex */
-static INLINE void copy_colors( struct draw_stage *stage,
- struct vertex_header *dst,
+static INLINE void copy_colors( struct draw_stage *stage,
+ struct vertex_header *dst,
const struct vertex_header *src )
{
const struct flat_stage *flat = flat_stage(stage);
uint i;
+ for (i = 0; i < flat->num_color_attribs; i++) {
+ const uint attr = flat->color_attribs[i];
+ COPY_4FV(dst->data[attr], src->data[attr]);
+ }
+}
- /* Look for constant/flat attribs and duplicate from src to dst vertex */
- /* skip attrib[0] which is vert pos */
+
+/** Copy all the color attributes from src vertex to dst0 & dst1 vertices */
+static INLINE void copy_colors2( struct draw_stage *stage,
+ struct vertex_header *dst0,
+ struct vertex_header *dst1,
+ const struct vertex_header *src )
+{
+ const struct flat_stage *flat = flat_stage(stage);
+ uint i;
for (i = 0; i < flat->num_color_attribs; i++) {
const uint attr = flat->color_attribs[i];
- memcpy(dst->data[attr], src->data[attr], sizeof(src->data[0]));
+ COPY_4FV(dst0->data[attr], src->data[attr]);
+ COPY_4FV(dst1->data[attr], src->data[attr]);
}
}
@@ -101,8 +114,7 @@ static void flatshade_tri( struct draw_stage *stage,
tmp.v[1] = dup_vert(stage, header->v[1], 1);
tmp.v[2] = header->v[2];
- copy_colors(stage, tmp.v[0], tmp.v[2]);
- copy_colors(stage, tmp.v[1], tmp.v[2]);
+ copy_colors2(stage, tmp.v[0], tmp.v[1], tmp.v[2]);
stage->next->tri( stage->next, &tmp );
}