-/* $Id: osmesa.c,v 1.62 2001/07/13 20:07:37 brianp Exp $ */
+/* $Id: osmesa.c,v 1.63 2001/07/14 17:53:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
for (i = 0; i < span.count; i++, img += 4) { \
const GLdepth z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
- PACK_RGBA(img, FixedToInt(span.red), \
- FixedToInt(span.green), FixedToInt(span.blue), \
- FixedToInt(span.alpha)); \
+ PACK_RGBA(img, FixedToChan(span.red), \
+ FixedToChan(span.green), FixedToChan(span.blue), \
+ FixedToChan(span.alpha)); \
zRow[i] = z; \
} \
span.red += span.redStep; \
-# $Id: Makefile.OSMesa16,v 1.4 2001/07/13 20:07:37 brianp Exp $
+# $Id: Makefile.OSMesa16,v 1.5 2001/07/14 17:53:04 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.5
swrast_setup/ss_context.c \
swrast_setup/ss_triangle.c \
swrast_setup/ss_vb.c \
- swrast_setup/ss_interp.c \
tnl/t_array_api.c \
tnl/t_array_import.c \
tnl/t_context.c \
-/* $Id: colortab.c,v 1.40 2001/04/20 19:21:41 brianp Exp $ */
+/* $Id: colortab.c,v 1.41 2001/07/14 17:53:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
static void
set_component_sizes( struct gl_color_table *table )
{
- /* XXX what about GLfloat tables? */
switch (table->Format) {
case GL_ALPHA:
table->RedSize = 0;
-/* $Id: image.c,v 1.62 2001/06/13 14:55:25 brianp Exp $ */
+/* $Id: image.c,v 1.63 2001/07/14 17:53:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
+/*
+ * Used to pack an array [][4] of RGBA GLchan colors as specified
+ * by the dstFormat, dstType and dstPacking. Used by glReadPixels,
+ * glGetConvolutionFilter(), etc.
+ */
void
_mesa_pack_float_rgba_span( GLcontext *ctx,
GLuint n, CONST GLfloat rgbaIn[][4],
if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {
for (i = 0; i < n; i++) {
GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+#if CHAN_TYPE == GL_FLOAT
+ luminance[i] = sum;
+#else
luminance[i] = CLAMP(sum, 0.0F, 1.0F);
+#endif
}
}
}
/* clamp to [0,1] */
+#if CHAN_TYPE != GL_FLOAT
{
GLuint i;
for (i = 0; i < n; i++) {
rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
}
}
+#endif
/* Now determine which color channels we need to produce.
* And determine the dest index (offset) within each color tuple.
}
/* clamp to [0,1] */
+#if CHAN_TYPE != GL_FLOAT
if (clamp) {
GLuint i;
for (i = 0; i < n; i++) {
rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
}
}
+#endif
/* Now determine which color channels we need to produce.
* And determine the dest index (offset) within each color tuple.
-/* $Id: s_texture.c,v 1.33 2001/07/13 20:07:37 brianp Exp $ */
+/* $Id: s_texture.c,v 1.34 2001/07/14 17:53:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
{
const GLfloat a = FRAC(u);
-#if CHAN_BITS == 32
+#if CHAN_TYPE == GL_FLOAT
const GLfloat w0 = (1.0F-a);
const GLfloat w1 = a ;
#else /* CHAN_BITS == 8 || CHAN_BITS == 16 */
}
}
-#if CHAN_BITS == 32
+#if CHAN_TYPE == GL_FLOAT
rgba[0] = w0 * t0[0] + w1 * t1[0];
rgba[1] = w0 * t0[1] + w1 * t1[1];
rgba[2] = w0 * t0[2] + w1 * t1[2];
+/*
+ * This is really just needed in order to prevent warnings with some compilers.
+ */
+#if CHAN_TYPE == GL_FLOAT
+#define INTCAST
+#else
+#define INTCAST (GLint)
+#endif
+
+
static void
sample_1d_nearest_mipmap_linear(GLcontext *ctx,
const struct gl_texture_object *tObj,
const GLfloat f = FRAC(lambda);
sample_1d_nearest(ctx, tObj, tObj->Image[level ], s, t0);
sample_1d_nearest(ctx, tObj, tObj->Image[level+1], s, t1);
- rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
const GLfloat f = FRAC(lambda);
sample_1d_linear(ctx, tObj, tObj->Image[level ], s, t0);
sample_1d_linear(ctx, tObj, tObj->Image[level+1], s, t1);
- rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
const GLfloat a = FRAC(u);
const GLfloat b = FRAC(v);
-#if CHAN_BITS == 32
+#if CHAN_TYPE == GL_FLOAT
const GLfloat w00 = (1.0F-a) * (1.0F-b);
const GLfloat w10 = a * (1.0F-b);
const GLfloat w01 = (1.0F-a) * b ;
palette_sample(ctx, tObj, t11[0], t11);
}
}
-#if CHAN_BITS == 32
+#if CHAN_TYPE == GL_FLOAT
rgba[0] = w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0];
rgba[1] = w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1];
rgba[2] = w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2];
const GLfloat f = FRAC(lambda);
sample_2d_nearest(ctx, tObj, tObj->Image[level ], s, t, t0);
sample_2d_nearest(ctx, tObj, tObj->Image[level+1], s, t, t1);
- rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
const GLfloat f = FRAC(lambda);
sample_2d_linear(ctx, tObj, tObj->Image[level ], s, t, t0);
sample_2d_linear(ctx, tObj, tObj->Image[level+1], s, t, t1);
- rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
const GLfloat b = FRAC(v);
const GLfloat c = FRAC(w);
-#if CHAN_BITS == 32
+#if CHAN_TYPE == GL_FLOAT
/* compute sample weights in fixed point in [0,WEIGHT_SCALE] */
GLfloat w000 = (1.0F-a) * (1.0F-b) * (1.0F-c);
GLfloat w100 = a * (1.0F-b) * (1.0F-c);
}
}
-#if CHAN_BITS == 32
+#if CHAN_TYPE == GL_FLOAT
rgba[0] = w000*t000[0] + w010*t010[0] + w001*t001[0] + w011*t011[0] +
w100*t100[0] + w110*t110[0] + w101*t101[0] + w111*t111[0];
rgba[1] = w000*t000[1] + w010*t010[1] + w001*t001[1] + w011*t011[1] +
const GLfloat f = FRAC(lambda);
sample_3d_nearest(ctx, tObj, tObj->Image[level ], s, t, r, t0);
sample_3d_nearest(ctx, tObj, tObj->Image[level+1], s, t, r, t1);
- rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
const GLfloat f = FRAC(lambda);
sample_3d_linear(ctx, tObj, tObj->Image[level ], s, t, r, t0);
sample_3d_linear(ctx, tObj, tObj->Image[level+1], s, t, r, t1);
- rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
const GLfloat f = FRAC(lambda);
sample_2d_nearest(ctx, tObj, images[level ], newS, newT, t0);
sample_2d_nearest(ctx, tObj, images[level+1], newS, newT, t1);
- rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
const GLfloat f = FRAC(lambda);
sample_2d_linear(ctx, tObj, images[level ], newS, newT, t0);
sample_2d_linear(ctx, tObj, images[level+1], newS, newT, t1);
- rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
+ rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
+ rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
+ rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
+ rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
}
}
+
static void
null_sample_func( GLcontext *ctx, GLuint texUnit,
const struct gl_texture_object *tObj, GLuint n,
{
}
+
+
/**********************************************************************/
/* Texture Sampling Setup */
/**********************************************************************/
if (RGBshift) {
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan r = arg0[i][RCOMP] * RGBmult;
- GLchan g = arg0[i][GCOMP] * RGBmult;
- GLchan b = arg0[i][BCOMP] * RGBmult;
+ rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult;
+ rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult;
+ rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult;
#else
GLuint r = (GLuint) arg0[i][RCOMP] << RGBshift;
GLuint g = (GLuint) arg0[i][GCOMP] << RGBshift;
GLuint b = (GLuint) arg0[i][BCOMP] << RGBshift;
-#endif
rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
+#endif
}
}
else {
#endif
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan r = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult;
- GLuint g = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult;
- GLuint b = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult;
+ rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult;
+ rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult;
+ rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult;
#else
GLuint r = PROD(arg0[i][RCOMP], arg1[i][RCOMP]) >> shift;
GLuint g = PROD(arg0[i][GCOMP], arg1[i][GCOMP]) >> shift;
GLuint b = PROD(arg0[i][BCOMP], arg1[i][BCOMP]) >> shift;
-#endif
rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
+#endif
}
}
break;
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan r = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult;
- GLchan g = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult;
- GLchan b = (arg0[i][BCOMP] + arg1[i][BCOMP]) * RGBmult;
+ rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult;
+ rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult;
+ rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * RGBmult;
#else
GLint r = ((GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP]) << RGBshift;
GLint g = ((GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP]) << RGBshift;
GLint b = ((GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP]) << RGBshift;
-#endif
rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
+#endif
}
}
break;
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan r = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult;
- GLchan g = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult;
- GLchan b = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * RGBmult;
+ rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult;
+ rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult;
+ rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * RGBmult;
#else
GLint r = (GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP] -half;
GLint g = (GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP] -half;
r = (r < 0) ? 0 : r << RGBshift;
g = (g < 0) ? 0 : g << RGBshift;
b = (b < 0) ? 0 : b << RGBshift;
-#endif
rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
+#endif
}
}
break;
#endif
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan r = (arg0[i][RCOMP] * arg2[i][RCOMP] +
+ rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] +
arg1[i][RCOMP] * (CHAN_MAXF - arg2[i][RCOMP])) * RGBmult;
- GLchan g = (arg0[i][GCOMP] * arg2[i][GCOMP] +
+ rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] +
arg1[i][GCOMP] * (CHAN_MAXF - arg2[i][GCOMP])) * RGBmult;
- GLchan b = (arg0[i][BCOMP] * arg2[i][BCOMP] +
+ rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] +
arg1[i][BCOMP] * (CHAN_MAXF - arg2[i][BCOMP])) * RGBmult;
#else
GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP])
GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP])
+ PROD(arg1[i][BCOMP], CHAN_MAX - arg2[i][BCOMP]))
>> shift;
-#endif
rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
+#endif
}
}
break;
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan r = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult;
- GLchan g = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult;
- GLchan b = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult;
+ rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult;
+ rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult;
+ rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult;
#else
GLint r = ((GLint) arg0[i][RCOMP] - (GLint) arg1[i][RCOMP]) << RGBshift;
GLint g = ((GLint) arg0[i][GCOMP] - (GLint) arg1[i][GCOMP]) << RGBshift;
GLint b = ((GLint) arg0[i][BCOMP] - (GLint) arg1[i][BCOMP]) << RGBshift;
-#endif
rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
+#endif
}
}
break;
#endif
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan a = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult;
+ rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult;
#else
GLuint a = (PROD(arg0[i][ACOMP], arg1[i][ACOMP]) >> shift);
-#endif
rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX);
+#endif
}
}
break;
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan a = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult;
- rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAXF);
+ rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult;
#else
GLint a = ((GLint) arg0[i][ACOMP] + arg1[i][ACOMP]) << Ashift;
rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX);
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan a = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult;
+ rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult;
#else
GLint a = (GLint) arg0[i][ACOMP] + (GLint) arg1[i][ACOMP] -half;
a = (a < 0) ? 0 : a << Ashift;
-#endif
rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX);
+#endif
}
}
break;
#endif
for (i=0; i<n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan a = (arg0[i][ACOMP] * arg2[i][ACOMP] +
- arg1[i][ACOMP] * (CHAN_MAXF - arg2[i][ACOMP]))
- * Amult;
+ rgba[i][ACOMP] = (arg0[i][ACOMP] * arg2[i][ACOMP] +
+ arg1[i][ACOMP] * (CHAN_MAXF - arg2[i][ACOMP]))
+ * Amult;
#else
GLuint a = (PROD(arg0[i][ACOMP], arg2[i][ACOMP])
+ PROD(arg1[i][ACOMP], CHAN_MAX - arg2[i][ACOMP]))
>> shift;
-#endif
rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX);
+#endif
}
}
break;
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
for (i = 0; i < n; i++) {
#if CHAN_TYPE == GL_FLOAT
- GLchan a = (arg0[i][ACOMP] - arg1[i][ACOMP]) * Amult;
+ rgba[i][ACOMP] = (arg0[i][ACOMP] - arg1[i][ACOMP]) * Amult;
#else
GLint a = ((GLint) arg0[i][ACOMP] - (GLint) arg1[i][ACOMP]) << RGBshift;
-#endif
rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
+#endif
}
}
break;
}
break;
+ /* XXX don't clamp results if GLchan is float??? */
+
case GL_ADD: /* GL_EXT_texture_add_env */
switch (format) {
case GL_ALPHA:
-/* $Id: s_triangle.c,v 1.33 2001/07/13 20:07:37 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.34 2001/07/14 17:53:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLfloat fogSpan[MAX_WIDTH]; \
GLuint i; \
for (i = 0; i < span.count; i++) { \
- rgbaSpan[i][RCOMP] = FixedToInt(span.red); \
- rgbaSpan[i][GCOMP] = FixedToInt(span.green); \
- rgbaSpan[i][BCOMP] = FixedToInt(span.blue); \
- rgbaSpan[i][ACOMP] = FixedToInt(span.alpha); \
+ rgbaSpan[i][RCOMP] = FixedToChan(span.red); \
+ rgbaSpan[i][GCOMP] = FixedToChan(span.green); \
+ rgbaSpan[i][BCOMP] = FixedToChan(span.blue); \
+ rgbaSpan[i][ACOMP] = FixedToChan(span.alpha); \
span.red += span.redStep; \
span.green += span.greenStep; \
span.blue += span.blueStep; \
}
-#endif /* CHAN_BITS != GL_FLOAT */
struct persp_info
}
+#endif /* CHAN_BITS != GL_FLOAT */
+
/*
* Generate arrays of fragment colors, z, fog, texcoords, etc from a
CHECKARRAY(mLambda, return);
if (span->activeMask & SPAN_RGBA) {
+#if CHAN_TYPE == GL_FLOAT
+ GLfloat r = span->red;
+ GLfloat g = span->green;
+ GLfloat b = span->blue;
+ GLfloat a = span->alpha;
+#else
GLfixed r = span->red;
GLfixed g = span->green;
GLfixed b = span->blue;
GLfixed a = span->alpha;
+#endif
GLuint i;
for (i = 0; i < span->count; i++) {
- rgba[i][RCOMP] = FixedToInt(r);
- rgba[i][GCOMP] = FixedToInt(g);
- rgba[i][BCOMP] = FixedToInt(b);
- rgba[i][ACOMP] = FixedToInt(a);
+ rgba[i][RCOMP] = FixedToChan(r);
+ rgba[i][GCOMP] = FixedToChan(g);
+ rgba[i][BCOMP] = FixedToChan(b);
+ rgba[i][ACOMP] = FixedToChan(a);
r += span->redStep;
g += span->greenStep;
b += span->blueStep;
}
}
if (span->activeMask & SPAN_SPEC) {
+#if CHAN_TYPE == GL_FLOAT
+ GLfloat r = span->specRed;
+ GLfloat g = span->specGreen;
+ GLfloat b = span->specBlue;
+#else
GLfixed r = span->specRed;
GLfixed g = span->specGreen;
GLfixed b = span->specBlue;
+#endif
GLuint i;
for (i = 0; i < span->count; i++) {
- spec[i][RCOMP] = FixedToInt(r);
- spec[i][GCOMP] = FixedToInt(g);
- spec[i][BCOMP] = FixedToInt(b);
+ spec[i][RCOMP] = FixedToChan(r);
+ spec[i][GCOMP] = FixedToChan(g);
+ spec[i][BCOMP] = FixedToChan(b);
r += span->specRedStep;
g += span->specGreenStep;
b += span->specBlueStep;
span.z += span.zStep; \
fogSpan[i] = span.fog; \
span.fog += span.fogStep; \
- rgbaSpan[i][RCOMP] = FixedToInt(span.red); \
- rgbaSpan[i][GCOMP] = FixedToInt(span.green); \
- rgbaSpan[i][BCOMP] = FixedToInt(span.blue); \
- rgbaSpan[i][ACOMP] = FixedToInt(span.alpha); \
+ rgbaSpan[i][RCOMP] = FixedToChan(span.red); \
+ rgbaSpan[i][GCOMP] = FixedToChan(span.green); \
+ rgbaSpan[i][BCOMP] = FixedToChan(span.blue); \
+ rgbaSpan[i][ACOMP] = FixedToChan(span.alpha); \
span.red += span.redStep; \
span.green += span.greenStep; \
span.blue += span.blueStep; \
}
}
else {
-#if CHAN_TYPE != GL_FLOAT
- if (ctx->Texture.Unit[0].EnvMode != GL_ADD) {
- USE(affine_textured_triangle);
- }
- else
+#if CHAN_TYPE == GL_FLOAT
+ USE(general_textured_triangle);
+#else
+ USE(affine_textured_triangle);
#endif
- {
- USE(general_textured_triangle);
- }
}
}
else {
- if (ctx->Texture.Unit[0].EnvMode==GL_ADD) {
- USE(general_textured_triangle);
- }
- else {
- USE(persp_textured_triangle);
- }
+#if CHAN_TYPE == GL_FLOAT
+ USE(general_textured_triangle);
+#else
+ USE(persp_textured_triangle);
+#endif
}
}
else {
-/* $Id: s_trispan.h,v 1.1 2001/05/14 16:23:04 brianp Exp $ */
+/* $Id: s_trispan.h,v 1.2 2001/07/14 17:53:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLint x, y;
GLuint count;
GLuint activeMask; /* OR of the SPAN_* flags */
+#if CHAN_TYPE == GL_FLOAT
+ GLfloat red, redStep;
+ GLfloat green, greenStep;
+ GLfloat blue, blueStep;
+ GLfloat alpha, alphaStep;
+ GLfloat specRed, specRedStep;
+ GLfloat specGreen, specGreenStep;
+ GLfloat specBlue, specBlueStep;
+#else
GLfixed red, redStep;
GLfixed green, greenStep;
GLfixed blue, blueStep;
GLfixed specRed, specRedStep;
GLfixed specGreen, specGreenStep;
GLfixed specBlue, specBlueStep;
+#endif
GLfixed index, indexStep;
GLfixed z, zStep;
GLfloat fog, fogStep;
-/* $Id: s_tritemp.h,v 1.21 2001/07/14 16:05:44 brianp Exp $ */
+/* $Id: s_tritemp.h,v 1.22 2001/07/14 17:53:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
* INTERP_MULTITEX - if defined, interpolate N units of STRQ texcoords
* INTERP_LAMBDA - if defined, compute lambda value (for mipmapping)
* a lambda value for every texture unit
+ * INTERP_FLOAT_RGBA - if defined, interpolate RGBA with floating point
+ * INTERP_FLOAT_SPEC - if defined, interpolate specular with floating point
*
* When one can directly address pixels in the color buffer the following
* macros can be defined and used to compute pixel addresses during
* Inspired by triangle rasterizer code written by Allen Akin. Thanks Allen!
*/
+
+/*
+ * This is a bit of a hack, but it's a centralized place to enable floating-
+ * point color interpolation when GLchan is actually floating point.
+ */
+#if CHAN_TYPE == GL_FLOAT
+
+#if defined(INTERP_RGB)
+#undef INTERP_RGB
+#undef INTERP_ALPHA
+#define INTERP_FLOAT_RGBA
+#endif
+
+#if defined(INTERP_SPEC)
+#undef INTERP_SPEC
+#define INTERP_FLOAT_SPEC
+#endif
+
+#endif
+
+
/*void triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2 )*/
{
typedef struct {
#ifdef INTERP_FOG
GLfloat dfogdy;
#endif
-#ifdef INTERP_RGB
+#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA)
GLfloat drdx, drdy;
GLfloat dgdx, dgdy;
GLfloat dbdx, dbdy;
#endif
-#ifdef INTERP_ALPHA
+#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA)
GLfloat dadx, dady;
#endif
-#ifdef INTERP_SPEC
+#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC)
GLfloat dsrdx, dsrdy;
GLfloat dsgdx, dsgdy;
GLfloat dsbdx, dsbdy;
dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
}
#endif
+#ifdef INTERP_FLOAT_RGBA
+ span.activeMask |= SPAN_RGBA;
+ {
+ GLfloat eMaj_dr, eBot_dr;
+ GLfloat eMaj_dg, eBot_dg;
+ GLfloat eMaj_db, eBot_db;
+ GLfloat eMaj_da, eBot_da;
+ eMaj_dr = (GLint) vMax->color[0] - (GLint) vMin->color[0];
+ eBot_dr = (GLint) vMid->color[0] - (GLint) vMin->color[0];
+ drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr);
+ span.redStep = drdx;
+ drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx);
+ eMaj_dg = (GLint) vMax->color[1] - (GLint) vMin->color[1];
+ eBot_dg = (GLint) vMid->color[1] - (GLint) vMin->color[1];
+ dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg);
+ span.greenStep = dgdx;
+ dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx);
+ eMaj_db = (GLint) vMax->color[2] - (GLint) vMin->color[2];
+ eBot_db = (GLint) vMid->color[2] - (GLint) vMin->color[2];
+ dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db);
+ span.blueStep = dbdx;
+ dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx);
+ eMaj_da = (GLint) vMax->color[3] - (GLint) vMin->color[3];
+ eBot_da = (GLint) vMid->color[3] - (GLint) vMin->color[3];
+ dadx = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da);
+ span.alphaStep = dadx;
+ dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
+ }
+#endif
#ifdef INTERP_SPEC
span.activeMask |= SPAN_SPEC;
{
GLfloat eMaj_dsr, eBot_dsr;
+ GLfloat eMaj_dsg, eBot_dsg;
+ GLfloat eMaj_dsb, eBot_dsb;
eMaj_dsr = (GLint) vMax->specular[0] - (GLint) vMin->specular[0];
eBot_dsr = (GLint) vMid->specular[0] - (GLint) vMin->specular[0];
dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr);
span.specRedStep = SignedFloatToFixed(dsrdx);
dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx);
- }
- {
- GLfloat eMaj_dsg, eBot_dsg;
eMaj_dsg = (GLint) vMax->specular[1] - (GLint) vMin->specular[1];
eBot_dsg = (GLint) vMid->specular[1] - (GLint) vMin->specular[1];
dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg);
span.specGreenStep = SignedFloatToFixed(dsgdx);
dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx);
+ eMaj_dsb = (GLint) vMax->specular[2] - (GLint) vMin->specular[2];
+ eBot_dsb = (GLint) vMid->specular[2] - (GLint) vMin->specular[2];
+ dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb);
+ span.specBlueStep = SignedFloatToFixed(dsbdx);
+ dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx);
}
+#endif
+#ifdef INTERP_FLOAT_SPEC
+ span.activeMask |= SPAN_SPEC;
{
+ GLfloat eMaj_dsr, eBot_dsr;
+ GLfloat eMaj_dsg, eBot_dsg;
GLfloat eMaj_dsb, eBot_dsb;
+ eMaj_dsr = (GLint) vMax->specular[0] - (GLint) vMin->specular[0];
+ eBot_dsr = (GLint) vMid->specular[0] - (GLint) vMin->specular[0];
+ dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr);
+ span.specRedStep = dsrdx;
+ dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx);
+ eMaj_dsg = (GLint) vMax->specular[1] - (GLint) vMin->specular[1];
+ eBot_dsg = (GLint) vMid->specular[1] - (GLint) vMin->specular[1];
+ dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg);
+ span.specGreenStep = dsgdx;
+ dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx);
eMaj_dsb = (GLint) vMax->specular[2] - (GLint) vMin->specular[2];
eBot_dsb = (GLint) vMid->specular[2] - (GLint) vMin->specular[2];
dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb);
- span.specBlueStep = SignedFloatToFixed(dsbdx);
+ span.specBlueStep = dsbdx;
dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx);
}
#endif
+
#ifdef INTERP_INDEX
span.activeMask |= SPAN_INDEX;
{
#ifdef INTERP_ALPHA
GLfixed fa=0, fdaOuter=0, fdaInner;
#endif
+#ifdef INTERP_FLOAT_RGBA
+ GLfloat fr, fdrOuter, fdrInner;
+ GLfloat fg, fdgOuter, fdgInner;
+ GLfloat fb, fdbOuter, fdbInner;
+ GLfloat fa, fdaOuter, fdaInner;
+#endif
#ifdef INTERP_SPEC
GLfixed fsr=0, fdsrOuter=0, fdsrInner;
GLfixed fsg=0, fdsgOuter=0, fdsgInner;
GLfixed fsb=0, fdsbOuter=0, fdsbInner;
#endif
+#ifdef INTERP_FLOAT_SPEC
+ GLfloat fsr=0, fdsrOuter=0, fdsrInner;
+ GLfloat fsg=0, fdsgOuter=0, fdsgInner;
+ GLfloat fsb=0, fdsbOuter=0, fdsbInner;
+#endif
#ifdef INTERP_INDEX
GLfixed fi=0, fdiOuter=0, fdiInner;
#endif
dfogOuter = dfogdy + dxOuter * span.fogStep;
#endif
#ifdef INTERP_RGB
- fr = (GLfixed)(ChanToFixed(vLower->color[0])
- + drdx * adjx + drdy * adjy) + FIXED_HALF;
+ fr = (GLfixed) (ChanToFixed(vLower->color[0])
+ + drdx * adjx + drdy * adjy) + FIXED_HALF;
fdrOuter = SignedFloatToFixed(drdy + dxOuter * drdx);
-
- fg = (GLfixed)(ChanToFixed(vLower->color[1])
- + dgdx * adjx + dgdy * adjy) + FIXED_HALF;
+ fg = (GLfixed) (ChanToFixed(vLower->color[1])
+ + dgdx * adjx + dgdy * adjy) + FIXED_HALF;
fdgOuter = SignedFloatToFixed(dgdy + dxOuter * dgdx);
-
- fb = (GLfixed)(ChanToFixed(vLower->color[2])
- + dbdx * adjx + dbdy * adjy) + FIXED_HALF;
+ fb = (GLfixed) (ChanToFixed(vLower->color[2])
+ + dbdx * adjx + dbdy * adjy) + FIXED_HALF;
fdbOuter = SignedFloatToFixed(dbdy + dxOuter * dbdx);
#endif
#ifdef INTERP_ALPHA
- fa = (GLfixed)(ChanToFixed(vLower->color[3])
- + dadx * adjx + dady * adjy) + FIXED_HALF;
+ fa = (GLfixed) (ChanToFixed(vLower->color[3])
+ + dadx * adjx + dady * adjy) + FIXED_HALF;
fdaOuter = SignedFloatToFixed(dady + dxOuter * dadx);
#endif
+#ifdef INTERP_FLOAT_RGBA
+ fr = vLower->color[0] + drdx * adjx + drdy * adjy;
+ fdrOuter = drdy + dxOuter * drdx;
+ fg = vLower->color[1] + dgdx * adjx + dgdy * adjy;
+ fdgOuter = dgdy + dxOuter * dgdx;
+ fb = vLower->color[2] + dbdx * adjx + dbdy * adjy;
+ fdbOuter = dbdy + dxOuter * dbdx;
+ fa = vLower->color[3] + dadx * adjx + dady * adjy;
+ fdaOuter = dady + dxOuter * dadx;
+#endif
#ifdef INTERP_SPEC
- fsr = (GLfixed)(ChanToFixed(vLower->specular[0])
- + dsrdx * adjx + dsrdy * adjy) + FIXED_HALF;
+ fsr = (GLfixed) (ChanToFixed(vLower->specular[0])
+ + dsrdx * adjx + dsrdy * adjy) + FIXED_HALF;
fdsrOuter = SignedFloatToFixed(dsrdy + dxOuter * dsrdx);
-
- fsg = (GLfixed)(ChanToFixed(vLower->specular[1])
- + dsgdx * adjx + dsgdy * adjy) + FIXED_HALF;
+ fsg = (GLfixed) (ChanToFixed(vLower->specular[1])
+ + dsgdx * adjx + dsgdy * adjy) + FIXED_HALF;
fdsgOuter = SignedFloatToFixed(dsgdy + dxOuter * dsgdx);
-
- fsb = (GLfixed)(ChanToFixed(vLower->specular[2])
- + dsbdx * adjx + dsbdy * adjy) + FIXED_HALF;
+ fsb = (GLfixed) (ChanToFixed(vLower->specular[2])
+ + dsbdx * adjx + dsbdy * adjy) + FIXED_HALF;
fdsbOuter = SignedFloatToFixed(dsbdy + dxOuter * dsbdx);
#endif
+#ifdef INTERP_FLOAT_SPEC
+ fsr = vLower->specular[0] + dsrdx * adjx + dsrdy * adjy;
+ fdsrOuter = dsrdy + dxOuter * dsrdx;
+ fsg = vLower->specular[1] + dsgdx * adjx + dsgdy * adjy;
+ fdsgOuter = dsgdy + dxOuter * dsgdx;
+ fsb = vLower->specular[2] + dsbdx * adjx + dsbdy * adjy;
+ fdsbOuter = dsbdy + dxOuter * dsbdx;
+#endif
#ifdef INTERP_INDEX
fi = (GLfixed)(vLower->index * FIXED_SCALE
+ didx * adjx + didy * adjy) + FIXED_HALF;
#ifdef INTERP_FOG
dfogInner = dfogOuter + span.fogStep;
#endif
-#ifdef INTERP_RGB
+#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA)
fdrInner = fdrOuter + span.redStep;
fdgInner = fdgOuter + span.greenStep;
fdbInner = fdbOuter + span.blueStep;
#endif
-#ifdef INTERP_ALPHA
+#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA)
fdaInner = fdaOuter + span.alphaStep;
#endif
-#ifdef INTERP_SPEC
+#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC)
fdsrInner = fdsrOuter + span.specRedStep;
fdsgInner = fdsgOuter + span.specGreenStep;
fdsbInner = fdsbOuter + span.specBlueStep;
#ifdef INTERP_FOG
span.fog = fogLeft;
#endif
-#ifdef INTERP_RGB
+#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA)
span.red = fr;
span.green = fg;
span.blue = fb;
#endif
-#ifdef INTERP_ALPHA
+#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA)
span.alpha = fa;
#endif
-#ifdef INTERP_SPEC
+#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC)
span.specRed = fsr;
span.specGreen = fsg;
span.specBlue = fsb;
#ifdef INTERP_FOG
fogLeft += dfogOuter;
#endif
-#ifdef INTERP_RGB
+#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA)
fr += fdrOuter;
fg += fdgOuter;
fb += fdbOuter;
#endif
-#ifdef INTERP_ALPHA
+#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA)
fa += fdaOuter;
#endif
-#ifdef INTERP_SPEC
+#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC)
fsr += fdsrOuter;
fsg += fdsgOuter;
fsb += fdsbOuter;
#ifdef INTERP_FOG
fogLeft += dfogInner;
#endif
-#ifdef INTERP_RGB
+#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA)
fr += fdrInner;
fg += fdgInner;
fb += fdbInner;
#endif
-#ifdef INTERP_ALPHA
+#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA)
fa += fdaInner;
#endif
-#ifdef INTERP_SPEC
+#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC)
fsr += fdsrInner;
fsg += fdsgInner;
fsb += fdsbInner;
#undef INTERP_TEX
#undef INTERP_MULTITEX
#undef INTERP_LAMBDA
+#undef INTERP_FLOAT_RGBA
+#undef INTERP_FLOAT_SPEC
#undef S_SCALE
#undef T_SCALE