From 9f9bed9c8ea8a1baa922320debbf04128b2b58de Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Jul 2003 17:13:48 +0000 Subject: [PATCH] fix GL_SGI_texture_colortable bugs --- src/mesa/main/pixel.c | 3 +++ src/mesa/swrast/s_texture.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index ce4be7eadc8..31ab8d7a72c 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1489,6 +1489,9 @@ void _mesa_init_pixel( GLcontext * ctx ) } ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0); + /* GL_SGI_texture_color_table */ + ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0); /* Pixel transfer */ ctx->Pack.Alignment = 4; diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 1343b289fbd..cb124724624 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -533,19 +533,19 @@ _swrast_texture_table_lookup(const struct gl_color_table *table, break; case GL_RGBA: /* replace RGBA with RGBA */ - if (!table->FloatTable) { + if (table->FloatTable) { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; - const GLchan *lut = (const GLchan *) table->Table; + const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); - rgba[i][RCOMP] = lut[jR * 4 + 0]; - rgba[i][GCOMP] = lut[jG * 4 + 1]; - rgba[i][BCOMP] = lut[jB * 4 + 2]; - rgba[i][ACOMP] = lut[jA * 4 + 3]; + CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]); } } else { -- 2.30.2