summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast_setup/ss_tritmp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast_setup/ss_tritmp.h')
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h126
1 files changed, 66 insertions, 60 deletions
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 570827a1b56..37b56642252 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -45,16 +45,24 @@ static void TAG(triangle)(GLcontext *ctx,
if (IND & (SS_TWOSIDE_BIT | SS_FLAT_BIT)) {
SS_COLOR(c[0], v[0]->color);
- SS_COLOR(c[1], v[1]->color);
- SS_COLOR(c[2], v[2]->color);
- SS_SPEC(s[0], v[0]->specular);
- SS_SPEC(s[1], v[1]->specular);
- SS_SPEC(s[2], v[2]->specular);
+ if (IND & SS_TWOSIDE_BIT) {
+ SS_COLOR(c[1], v[1]->color);
+ SS_COLOR(c[2], v[2]->color);
+ }
+
+ if (IND & SS_COPY_EXTRAS) {
+ SS_SPEC(s[0], v[0]->specular);
+ SS_IND(i[0], v[0]->index);
+
+ if (IND & SS_TWOSIDE_BIT) {
+ SS_SPEC(s[1], v[1]->specular);
+ SS_IND(i[1], v[1]->index);
- SS_IND(i[0], v[0]->index);
- SS_IND(i[1], v[1]->index);
- SS_IND(i[2], v[2]->index);
+ SS_SPEC(s[2], v[2]->specular);
+ SS_IND(i[2], v[2]->index);
+ }
+ }
}
if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT))
@@ -82,25 +90,29 @@ static void TAG(triangle)(GLcontext *ctx,
SS_COLOR(v[1]->color, vbcolor[pv]);
SS_COLOR(v[2]->color, vbcolor[pv]);
- SS_SPEC(v[0]->specular, vbspec[pv]);
- SS_SPEC(v[1]->specular, vbspec[pv]);
- SS_SPEC(v[2]->specular, vbspec[pv]);
-
- SS_IND(v[0]->index, vbindex[pv]);
- SS_IND(v[1]->index, vbindex[pv]);
- SS_IND(v[2]->index, vbindex[pv]);
+ if (IND & SS_COPY_EXTRAS) {
+ SS_SPEC(v[0]->specular, vbspec[pv]);
+ SS_SPEC(v[1]->specular, vbspec[pv]);
+ SS_SPEC(v[2]->specular, vbspec[pv]);
+
+ SS_IND(v[0]->index, vbindex[pv]);
+ SS_IND(v[1]->index, vbindex[pv]);
+ SS_IND(v[2]->index, vbindex[pv]);
+ }
} else {
SS_COLOR(v[0]->color, vbcolor[e0]);
SS_COLOR(v[1]->color, vbcolor[e1]);
SS_COLOR(v[2]->color, vbcolor[e2]);
- SS_SPEC(v[0]->specular, vbspec[e0]);
- SS_SPEC(v[1]->specular, vbspec[e1]);
- SS_SPEC(v[2]->specular, vbspec[e2]);
+ if (IND & SS_COPY_EXTRAS) {
+ SS_SPEC(v[0]->specular, vbspec[e0]);
+ SS_SPEC(v[1]->specular, vbspec[e1]);
+ SS_SPEC(v[2]->specular, vbspec[e2]);
- SS_IND(v[0]->index, vbindex[e0]);
- SS_IND(v[1]->index, vbindex[e1]);
- SS_IND(v[2]->index, vbindex[e2]);
+ SS_IND(v[0]->index, vbindex[e0]);
+ SS_IND(v[1]->index, vbindex[e1]);
+ SS_IND(v[2]->index, vbindex[e2]);
+ }
}
}
}
@@ -125,23 +137,18 @@ static void TAG(triangle)(GLcontext *ctx,
}
}
}
- else if(IND & SS_FLAT_BIT)
+ else if (IND & SS_FLAT_BIT)
{
GLubyte *color = VB->Color[0]->data[pv];
GLubyte *spec = VB->SecondaryColor[0]->data[pv];
GLuint index = VB->Index[0]->data[pv];
SS_COLOR(v[0]->color, color);
- SS_COLOR(v[1]->color, color);
- SS_COLOR(v[2]->color, color);
- SS_SPEC(v[0]->specular, spec);
- SS_SPEC(v[1]->specular, spec);
- SS_SPEC(v[2]->specular, spec);
-
- SS_IND(v[0]->index, index);
- SS_IND(v[1]->index, index);
- SS_IND(v[2]->index, index);
+ if (IND & SS_COPY_EXTRAS) {
+ SS_SPEC(v[0]->specular, spec);
+ SS_IND(v[0]->index, index);
+ }
}
if (mode == GL_POINT) {
@@ -181,16 +188,24 @@ static void TAG(triangle)(GLcontext *ctx,
if (IND & (SS_FLAT_BIT | SS_TWOSIDE_BIT)) {
SS_COLOR(v[0]->color, c[0]);
- SS_COLOR(v[1]->color, c[1]);
- SS_COLOR(v[2]->color, c[2]);
-
- SS_SPEC(v[0]->specular, s[0]);
- SS_SPEC(v[1]->specular, s[1]);
- SS_SPEC(v[2]->specular, s[2]);
- SS_IND(v[0]->index, i[0]);
- SS_IND(v[1]->index, i[1]);
- SS_IND(v[2]->index, i[2]);
+ if (IND & SS_TWOSIDE_BIT) {
+ SS_COLOR(v[1]->color, c[1]);
+ SS_COLOR(v[2]->color, c[2]);
+ }
+
+ if (IND & SS_COPY_EXTRAS) {
+ SS_SPEC(v[0]->specular, s[0]);
+ SS_IND(v[0]->index, i[0]);
+
+ if (IND & SS_TWOSIDE_BIT) {
+ SS_SPEC(v[1]->specular, s[1]);
+ SS_IND(v[1]->index, i[1]);
+
+ SS_SPEC(v[2]->specular, s[2]);
+ SS_IND(v[2]->index, i[2]);
+ }
+ }
}
}
@@ -223,35 +238,26 @@ static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv )
GLuint index = VB->Index[0]->data[pv];
SS_COLOR(c[0], vert0->color);
- SS_COLOR(c[1], vert1->color);
-
- SS_SPEC(s[0], vert0->specular);
- SS_SPEC(s[1], vert1->specular);
-
- SS_IND(i[0], vert0->index);
- SS_IND(i[1], vert1->index);
-
SS_COLOR(vert0->color, color);
- SS_COLOR(vert1->color, color);
-
- SS_SPEC(vert0->specular, spec);
- SS_SPEC(vert1->specular, spec);
- SS_IND(vert0->index, index);
- SS_IND(vert1->index, index);
+ if (IND & SS_COPY_EXTRAS) {
+ SS_SPEC(s[0], vert0->specular);
+ SS_SPEC(vert0->specular, spec);
+
+ SS_IND(i[0], vert0->index);
+ SS_IND(vert0->index, index);
+ }
}
_swrast_Line( ctx, vert0, vert1 );
if (IND & SS_FLAT_BIT) {
SS_COLOR(vert0->color, c[0]);
- SS_COLOR(vert1->color, c[1]);
- SS_SPEC(vert0->specular, s[0]);
- SS_SPEC(vert1->specular, s[1]);
-
- SS_IND(vert0->index, i[0]);
- SS_IND(vert1->index, i[1]);
+ if (IND & SS_COPY_EXTRAS) {
+ SS_SPEC(vert0->specular, s[0]);
+ SS_IND(vert0->index, i[0]);
+ }
}
}