summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-03-04 19:16:47 +0000
committerBrian Paul <[email protected]>2003-03-04 19:16:47 +0000
commitcc9464e082b82179e3c4b51ea460212c10b2bf0c (patch)
treef9adc3eeac73b2c4d7fb2a2e04654dfbefd55c5a /src
parent612cf792dbcb8b69819751c62f8df5fe47aae9b4 (diff)
fix GLchan=GLfloat problems
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c20
-rw-r--r--src/mesa/swrast/s_texture.c44
-rw-r--r--src/mesa/swrast/s_tritemp.h10
3 files changed, 49 insertions, 25 deletions
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 25efb7ef4ad..0141bf1a34e 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1,4 +1,4 @@
-/* $Id: osmesa.c,v 1.100 2003/03/01 01:50:23 brianp Exp $ */
+/* $Id: osmesa.c,v 1.101 2003/03/04 19:16:47 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -225,14 +225,14 @@ clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
#define INC_PIXEL_PTR(P) P += 4
#if CHAN_TYPE == GL_FLOAT
#define STORE_RGB_PIXEL(P, R, G, B) \
- P[0] = MAX2((R), 0.0F);
- P[1] = MAX2((G), 0.0F);
- P[2] = MAX2((B), 0.0F);
+ P[0] = MAX2((R), 0.0F); \
+ P[1] = MAX2((G), 0.0F); \
+ P[2] = MAX2((B), 0.0F); \
P[3] = CHAN_MAXF
#define STORE_RGBA_PIXEL(P, R, G, B, A) \
- P[0] = MAX2((R), 0.0F);
- P[1] = MAX2((G), 0.0F);
- P[2] = MAX2((B), 0.0F);
+ P[0] = MAX2((R), 0.0F); \
+ P[1] = MAX2((G), 0.0F); \
+ P[2] = MAX2((B), 0.0F); \
P[3] = CLAMP((A), 0.0F, CHAN_MAXF)
#else
#define STORE_RGB_PIXEL(P, R, G, B) \
@@ -305,6 +305,7 @@ clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
#include "swrast/s_spantemp.h"
/* 16-bit BGR */
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
#define NAME(PREFIX) PREFIX##_RGB_565
#define SPAN_VARS \
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
@@ -321,6 +322,7 @@ clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
B = ( (((*P) << 3) & 0xf8) | (((*P) ) & 0x7) ); \
A = CHAN_MAX
#include "swrast/s_spantemp.h"
+#endif
/* color index */
#define NAME(PREFIX) PREFIX##_CI
@@ -699,6 +701,7 @@ hook_in_driver_functions( GLcontext *ctx )
swdd->ReadRGBASpan = read_rgba_span_BGR;
swdd->ReadRGBAPixels = read_rgba_pixels_BGR;
}
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
else if (osmesa->format == OSMESA_RGB_565) {
swdd->WriteRGBASpan = write_rgba_span_RGB_565;
swdd->WriteRGBSpan = write_rgb_span_RGB_565;
@@ -708,6 +711,7 @@ hook_in_driver_functions( GLcontext *ctx )
swdd->ReadRGBASpan = read_rgba_span_RGB_565;
swdd->ReadRGBAPixels = read_rgba_pixels_RGB_565;
}
+#endif
else if (osmesa->format == OSMESA_RGBA) {
swdd->WriteRGBASpan = write_rgba_span_RGBA;
swdd->WriteRGBSpan = write_rgb_span_RGBA;
@@ -909,6 +913,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
bind = 0;
rgbmode = GL_TRUE;
}
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
else if (format==OSMESA_RGB_565) {
indexBits = 0;
redBits = 5;
@@ -924,6 +929,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
bind = 0;
rgbmode = GL_TRUE;
}
+#endif
else {
return NULL;
}
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index e63f49c7424..e497f9bba76 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -1,4 +1,4 @@
-/* $Id: s_texture.c,v 1.82 2003/03/01 01:50:26 brianp Exp $ */
+/* $Id: s_texture.c,v 1.83 2003/03/04 19:17:31 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -321,7 +321,8 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
}
}
else {
- if (CHAN_TYPE == GL_UNSIGNED_BYTE && table->Size == 256) {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
/* common case */
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -331,7 +332,9 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
rgba[i][BCOMP] = rgba[i][ACOMP] = c;
}
}
- else {
+ else
+#endif
+ {
const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -357,7 +360,8 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
}
}
else {
- if (CHAN_TYPE == GL_UNSIGNED_BYTE && table->Size == 256) {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
/* common case */
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -366,7 +370,9 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c;
}
}
- else {
+ else
+#endif
+ {
const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -391,7 +397,8 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
}
}
else {
- if (CHAN_TYPE == GL_UNSIGNED_BYTE && table->Size == 256) {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
/* common case */
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -399,7 +406,9 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
rgba[i][ACOMP] = lut[rgba[i][ACOMP]];
}
}
- else {
+ else
+#endif
+ {
const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -427,7 +436,8 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
}
}
else {
- if (CHAN_TYPE == GL_UNSIGNED_BYTE && table->Size == 256) {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
/* common case */
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -438,7 +448,9 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
rgba[i][ACOMP] = a;
}
}
- else {
+ else
+#endif
+ {
const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -469,7 +481,8 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
}
}
else {
- if (CHAN_TYPE == GL_UNSIGNED_BYTE && table->Size == 256) {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
/* common case */
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -479,7 +492,9 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 3 + 2];
}
}
- else {
+ else
+#endif
+ {
const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -512,7 +527,8 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
}
}
else {
- if (CHAN_TYPE == GL_UNSIGNED_BYTE && table->Size == 256) {
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
+ if (table->Size == 256) {
/* common case */
const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
@@ -523,7 +539,9 @@ _swrast_texture_table_lookup(const struct gl_color_table *table,
rgba[i][ACOMP] = lut[rgba[i][ACOMP] * 4 + 3];
}
}
- else {
+ else
+#endif
+ {
const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF;
const GLfloat *lut = (const GLfloat *) table->Table;
GLuint i;
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index fc154fa714f..461995e487d 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_tritemp.h,v 1.43 2003/01/20 00:24:22 brianp Exp $ */
+/* $Id: s_tritemp.h,v 1.44 2003/03/04 19:17:34 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -737,10 +737,10 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
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;
+ GLfloat fr = 0.0F, fdrOuter = 0.0F, fdrInner;
+ GLfloat fg = 0.0F, fdgOuter = 0.0F, fdgInner;
+ GLfloat fb = 0.0F, fdbOuter = 0.0F, fdbInner;
+ GLfloat fa = 0.0F, fdaOuter = 0.0F, fdaInner;
#endif
#ifdef INTERP_SPEC
GLfixed fsr=0, fdsrOuter=0, fdsrInner;