aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_span.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-11-01 00:13:16 +0000
committerBrian Paul <[email protected]>2006-11-01 00:13:16 +0000
commite6f47d1855354165c6eed5080d8a72024891f10f (patch)
treed123b91baf8aae2c7e04cb1ddece51479fd97618 /src/mesa/swrast/s_span.c
parent90fcf6ccc345c287309d7d17b2ff256cc22fb2b7 (diff)
fix some bugs in interpolate_specular()
Diffstat (limited to 'src/mesa/swrast/s_span.c')
-rw-r--r--src/mesa/swrast/s_span.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 2e20f7a2965..c74b98facfb 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -353,32 +353,38 @@ interpolate_specular(SWspan *span)
case GL_FLOAT:
{
GLfloat (*spec)[4] = span->array->color.sz4.spec;
+#if CHAN_BITS <= 16
+ GLfloat r = CHAN_TO_FLOAT(FixedToChan(span->specRed));
+ GLfloat g = CHAN_TO_FLOAT(FixedToChan(span->specGreen));
+ GLfloat b = CHAN_TO_FLOAT(FixedToChan(span->specBlue));
+#else
+ GLfloat r = span->specRed;
+ GLfloat g = span->specGreen;
+ GLfloat b = span->specBlue;
+#endif
+ GLfloat dr, dg, db;
if (span->interpMask & SPAN_FLAT) {
- GLfloat color[4];
- color[RCOMP] = span->specRed;
- color[GCOMP] = span->specGreen;
- color[BCOMP] = span->specBlue;
- color[ACOMP] = 0.0F;
- for (i = 0; i < n; i++) {
- COPY_4V(spec[i], color);
- }
+ dr = dg = db = 0.0;
}
else {
- GLfloat r = span->specRed;
- GLfloat g = span->specGreen;
- GLfloat b = span->specBlue;
- GLfloat dr = span->specRedStep;
- GLfloat dg = span->specGreenStep;
- GLfloat db = span->specBlueStep;
- for (i = 0; i < n; i++) {
- spec[i][RCOMP] = r;
- spec[i][GCOMP] = g;
- spec[i][BCOMP] = b;
- spec[i][ACOMP] = 0.0F;
- r += dr;
- g += dg;
- b += db;
- }
+#if CHAN_BITS <= 16
+ dr = CHAN_TO_FLOAT(FixedToChan(span->specRedStep));
+ dg = CHAN_TO_FLOAT(FixedToChan(span->specGreenStep));
+ db = CHAN_TO_FLOAT(FixedToChan(span->specBlueStep));
+#else
+ dr = span->specRedStep;
+ dg = span->specGreenStep;
+ db = span->specBlueStep;
+#endif
+ }
+ for (i = 0; i < n; i++) {
+ spec[i][RCOMP] = r;
+ spec[i][GCOMP] = g;
+ spec[i][BCOMP] = b;
+ spec[i][ACOMP] = 0.0F;
+ r += dr;
+ g += dg;
+ b += db;
}
}
break;