-/* $Id: colortab.c,v 1.46 2002/10/24 23:57:19 brianp Exp $ */
+/* $Id: colortab.c,v 1.47 2003/01/21 21:47:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
table = &ctx->ProxyColorTable;
proxy = GL_TRUE;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ floatTable = GL_TRUE;
+ rScale = ctx->Texture.ColorTableScale[0];
+ gScale = ctx->Texture.ColorTableScale[1];
+ bScale = ctx->Texture.ColorTableScale[2];
+ aScale = ctx->Texture.ColorTableScale[3];
+ rBias = ctx->Texture.ColorTableBias[0];
+ gBias = ctx->Texture.ColorTableBias[1];
+ bBias = ctx->Texture.ColorTableBias[2];
+ aBias = ctx->Texture.ColorTableBias[3];
+ break;
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
+ return;
+ }
+ table = &ctx->ProxyTextureColorTable;
+ proxy = GL_TRUE;
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
floatTable = GL_TRUE;
bBias = ctx->Pixel.ColorTableBias[2];
aBias = ctx->Pixel.ColorTableBias[3];
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ rScale = ctx->Texture.ColorTableScale[0];
+ gScale = ctx->Texture.ColorTableScale[1];
+ bScale = ctx->Texture.ColorTableScale[2];
+ aScale = ctx->Texture.ColorTableScale[3];
+ rBias = ctx->Texture.ColorTableBias[0];
+ gBias = ctx->Texture.ColorTableBias[1];
+ bBias = ctx->Texture.ColorTableBias[2];
+ aBias = ctx->Texture.ColorTableBias[3];
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
rScale = ctx->Pixel.PCCTscale[0];
case GL_COLOR_TABLE:
table = &ctx->ColorTable;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
break;
return;
}
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)");
+ return;
+ }
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ ctx->Texture.ColorTableScale[0] = params[0];
+ ctx->Texture.ColorTableScale[1] = params[1];
+ ctx->Texture.ColorTableScale[2] = params[2];
+ ctx->Texture.ColorTableScale[3] = params[3];
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ ctx->Texture.ColorTableBias[0] = params[0];
+ ctx->Texture.ColorTableBias[1] = params[1];
+ ctx->Texture.ColorTableBias[2] = params[2];
+ ctx->Texture.ColorTableBias[3] = params[3];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
+ return;
+ }
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
ctx->Pixel.PCCTscale[0] = params[0];
{
GLfloat fparams[4];
if (pname == GL_COLOR_TABLE_SGI ||
+ pname == GL_TEXTURE_COLOR_TABLE_SGI ||
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) {
/* four values */
case GL_PROXY_COLOR_TABLE:
table = &ctx->ProxyColorTable;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = ctx->Texture.ColorTableScale[0];
+ params[1] = ctx->Texture.ColorTableScale[1];
+ params[2] = ctx->Texture.ColorTableScale[2];
+ params[3] = ctx->Texture.ColorTableScale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = ctx->Texture.ColorTableBias[0];
+ params[1] = ctx->Texture.ColorTableBias[1];
+ params[2] = ctx->Texture.ColorTableBias[2];
+ params[3] = ctx->Texture.ColorTableBias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &ctx->ProxyTextureColorTable;
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
*params = (GLfloat) table->Size;
break;
case GL_COLOR_TABLE_RED_SIZE:
- *params = table->RedSize;
+ *params = (GLfloat) table->RedSize;
break;
case GL_COLOR_TABLE_GREEN_SIZE:
- *params = table->GreenSize;
+ *params = (GLfloat) table->GreenSize;
break;
case GL_COLOR_TABLE_BLUE_SIZE:
- *params = table->BlueSize;
+ *params = (GLfloat) table->BlueSize;
break;
case GL_COLOR_TABLE_ALPHA_SIZE:
- *params = table->AlphaSize;
+ *params = (GLfloat) table->AlphaSize;
break;
case GL_COLOR_TABLE_LUMINANCE_SIZE:
- *params = table->LuminanceSize;
+ *params = (GLfloat) table->LuminanceSize;
break;
case GL_COLOR_TABLE_INTENSITY_SIZE:
- *params = table->IntensitySize;
+ *params = (GLfloat) table->IntensitySize;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" );
case GL_PROXY_COLOR_TABLE:
table = &ctx->ProxyColorTable;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &ctx->TextureColorTable;
+ if (pname == GL_COLOR_TABLE_SCALE_SGI) {
+ params[0] = (GLint) ctx->Texture.ColorTableScale[0];
+ params[1] = (GLint) ctx->Texture.ColorTableScale[1];
+ params[2] = (GLint) ctx->Texture.ColorTableScale[2];
+ params[3] = (GLint) ctx->Texture.ColorTableScale[3];
+ return;
+ }
+ else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
+ params[0] = (GLint) ctx->Texture.ColorTableBias[0];
+ params[1] = (GLint) ctx->Texture.ColorTableBias[1];
+ params[2] = (GLint) ctx->Texture.ColorTableBias[2];
+ params[3] = (GLint) ctx->Texture.ColorTableBias[3];
+ return;
+ }
+ break;
+ case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+ if (!ctx->Extensions.SGI_texture_color_table) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)");
+ return;
+ }
+ table = &ctx->ProxyTextureColorTable;
+ break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
table = &ctx->PostConvolutionColorTable;
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
-/* $Id: context.c,v 1.191 2003/01/14 04:55:45 brianp Exp $ */
+/* $Id: context.c,v 1.192 2003/01/21 21:47:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
init_texture_unit( ctx, i );
ctx->Texture.SharedPalette = GL_FALSE;
_mesa_init_colortable(&ctx->Texture.Palette);
+ ASSIGN_4V(ctx->Texture.ColorTableScale, 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Texture.ColorTableBias, 0.0, 0.0, 0.0, 0.0);
+ ctx->Texture.ColorTableEnabled = GL_FALSE;
/* Transformation group */
ctx->Transform.MatrixMode = GL_MODELVIEW;
_mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable);
_mesa_init_colortable(&ctx->PostColorMatrixColorTable);
_mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable);
+ _mesa_init_colortable(&ctx->TextureColorTable);
+ _mesa_init_colortable(&ctx->ProxyTextureColorTable);
/* Vertex/fragment programs */
ctx->Program.ErrorPos = -1;
_mesa_free_colortable_data( &ctx->PostConvolutionColorTable );
_mesa_free_colortable_data( &ctx->PostColorMatrixColorTable );
_mesa_free_colortable_data( &ctx->Texture.Palette );
+ _mesa_free_colortable_data( &ctx->TextureColorTable );
_math_matrix_dtr(&ctx->Viewport._WindowMap);
-/* $Id: dlist.c,v 1.101 2003/01/14 04:55:45 brianp Exp $ */
+/* $Id: dlist.c,v 1.102 2003/01/21 21:47:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
n[3].f = params[0];
if (pname == GL_COLOR_TABLE_SGI ||
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) {
+ pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI ||
+ pname == GL_TEXTURE_COLOR_TABLE_SGI) {
n[4].f = params[1];
n[5].f = params[2];
n[6].f = params[3];
n[3].i = params[0];
if (pname == GL_COLOR_TABLE_SGI ||
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) {
+ pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI ||
+ pname == GL_TEXTURE_COLOR_TABLE_SGI) {
n[4].i = params[1];
n[5].i = params[2];
n[6].i = params[3];
-/* $Id: enable.c,v 1.72 2003/01/14 04:55:45 brianp Exp $ */
+/* $Id: enable.c,v 1.73 2003/01/21 21:47:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.PostColorMatrixColorTableEnabled = state;
break;
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION(SGI_texture_color_table, cap);
+ if (ctx->Texture.ColorTableEnabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.ColorTableEnabled = state;
+ break;
/* GL_EXT_convolution */
case GL_CONVOLUTION_1D:
-/* $Id: extensions.c,v 1.87 2003/01/21 15:49:14 brianp Exp $ */
+/* $Id: extensions.c,v 1.88 2003/01/21 21:47:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
{ OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) },
{ OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) },
{ OFF, "GL_SGI_color_table", F(SGI_color_table) },
+ { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) },
{ OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) },
{ OFF, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) },
{ OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) },
#endif
"GL_SGI_color_matrix",
"GL_SGI_color_table",
+ "GL_SGI_texture_color_table",
"GL_SGIS_generate_mipmap",
"GL_SGIS_pixel_texture",
"GL_SGIS_texture_edge_clamp",
-/* $Id: get.c,v 1.102 2003/01/21 15:45:39 brianp Exp $ */
+/* $Id: get.c,v 1.103 2003/01/21 21:47:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
*params = ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_B(SGI_texture_color_table, pname);
+ *params = ctx->Texture.ColorTableEnabled;
+ break;
+
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
CHECK_EXTENSION_B(EXT_secondary_color, pname);
*params = (GLdouble) ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_D(SGI_texture_color_table, pname);
+ *params = (GLdouble) ctx->Texture.ColorTableEnabled;
+ break;
+
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
CHECK_EXTENSION_D(EXT_secondary_color, pname);
*params = (GLfloat) ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_F(SGI_texture_color_table, pname);
+ *params = (GLfloat) ctx->Texture.ColorTableEnabled;
+ break;
+
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
CHECK_EXTENSION_F(EXT_secondary_color, pname);
*params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled;
break;
+ /* GL_SGI_texture_color_table */
+ case GL_TEXTURE_COLOR_TABLE_SGI:
+ CHECK_EXTENSION_I(SGI_texture_color_table, pname);
+ *params = (GLint) ctx->Texture.ColorTableEnabled;
+ break;
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
-/* $Id: mtypes.h,v 1.99 2003/01/21 15:49:15 brianp Exp $ */
+/* $Id: mtypes.h,v 1.100 2003/01/21 21:47:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* GL_EXT_shared_texture_palette */
GLboolean SharedPalette;
struct gl_color_table Palette;
+ /* GL_SGI_texture_color_table */
+ GLfloat ColorTableScale[4];
+ GLfloat ColorTableBias[4];
+ GLboolean ColorTableEnabled;
};
GLboolean NV_vertex_program1_1;
GLboolean SGI_color_matrix;
GLboolean SGI_color_table;
+ GLboolean SGI_texture_color_table;
GLboolean SGIS_generate_mipmap;
GLboolean SGIS_pixel_texture;
GLboolean SGIS_texture_edge_clamp;
struct gl_color_table ProxyPostConvolutionColorTable;
struct gl_color_table PostColorMatrixColorTable;
struct gl_color_table ProxyPostColorMatrixColorTable;
+ struct gl_color_table TextureColorTable;
+ struct gl_color_table ProxyTextureColorTable;
struct program_state Program; /* for vertex or fragment progs */
struct vertex_program_state VertexProgram; /* GL_NV_vertex_program */
-/* $Id: s_texture.c,v 1.76 2003/01/21 15:49:19 brianp Exp $ */
+/* $Id: s_texture.c,v 1.77 2003/01/21 21:47:53 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define K1BIT 32
+static void texture_table_lookup(const struct gl_color_table *table,
+ GLuint n, GLchan rgba[][4])
+{
+ ASSERT(table->FloatTable);
+ if (!table->Table || table->Size == 0)
+ return;
+
+ switch (table->Format) {
+ case GL_INTENSITY:
+ /* replace RGBA with I */
+ if (!table->FloatTable) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLchan c = lut[CLAMP(j, 0, 1)];
+ rgba[i][RCOMP] = rgba[i][GCOMP] =
+ rgba[i][BCOMP] = rgba[i][ACOMP] = c;
+ }
+
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLchan c;
+ CLAMPED_FLOAT_TO_CHAN(c, lut[j]);
+ rgba[i][RCOMP] = rgba[i][GCOMP] =
+ rgba[i][BCOMP] = rgba[i][ACOMP] = c;
+ }
+ }
+ break;
+ case GL_LUMINANCE:
+ /* replace RGB with L */
+ if (!table->FloatTable) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLchan c = lut[j];
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c;
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLchan c;
+ CLAMPED_FLOAT_TO_CHAN(c, lut[j]);
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c;
+ }
+ }
+ break;
+ case GL_ALPHA:
+ /* replace A with A */
+ if (!table->FloatTable) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = CHAN_TO_FLOAT(rgba[i][ACOMP])*scale;
+ rgba[i][ACOMP] = lut[j];
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint j = CHAN_TO_FLOAT(rgba[i][ACOMP])*scale;
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[j]);
+ }
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ /* replace RGBA with LLLA */
+ if (!table->FloatTable) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jL = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLint jA = CHAN_TO_FLOAT(rgba[i][ACOMP])*scale;
+ GLchan luminance, alpha;
+ luminance = lut[jL * 2 + 0];
+ alpha = lut[jA * 2 + 1];
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance;
+ rgba[i][ACOMP] = alpha;;
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jL = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLint jA = CHAN_TO_FLOAT(rgba[i][ACOMP])*scale;
+ GLchan luminance, alpha;
+ CLAMPED_FLOAT_TO_CHAN(luminance, lut[jL * 2 + 0]);
+ CLAMPED_FLOAT_TO_CHAN(alpha, lut[jA * 2 + 1]);
+ rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance;
+ rgba[i][ACOMP] = alpha;;
+ }
+ }
+ break;
+ case GL_RGB:
+ /* replace RGB with RGB */
+ if (!table->FloatTable) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLint jG = CHAN_TO_FLOAT(rgba[i][GCOMP])*scale;
+ GLint jB = CHAN_TO_FLOAT(rgba[i][BCOMP])*scale;
+ rgba[i][RCOMP] = lut[jR * 3 + 0];
+ rgba[i][GCOMP] = lut[jG * 3 + 1];
+ rgba[i][BCOMP] = lut[jB * 3 + 2];
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLint jG = CHAN_TO_FLOAT(rgba[i][GCOMP])*scale;
+ GLint jB = CHAN_TO_FLOAT(rgba[i][BCOMP])*scale;
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 3 + 0]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 3 + 1]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 3 + 2]);
+ }
+ }
+ break;
+ case GL_RGBA:
+ /* replace RGBA with RGBA */
+ if (!table->FloatTable) {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLchan *lut = (const GLchan *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLint jG = CHAN_TO_FLOAT(rgba[i][GCOMP])*scale;
+ GLint jB = CHAN_TO_FLOAT(rgba[i][BCOMP])*scale;
+ GLint jA = CHAN_TO_FLOAT(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];
+ }
+ }
+ else {
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = (const GLfloat *) table->Table;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLint jR = CHAN_TO_FLOAT(rgba[i][RCOMP])*scale;
+ GLint jG = CHAN_TO_FLOAT(rgba[i][GCOMP])*scale;
+ GLint jB = CHAN_TO_FLOAT(rgba[i][BCOMP])*scale;
+ GLint jA = CHAN_TO_FLOAT(rgba[i][ACOMP])*scale;
+ 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]);
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba");
+ return;
+ }
+}
+
+
/*
* Get texture palette entry.
for (i=0;i<n;i++) {
sample_1d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
+
}
for (i=0;i<n;i++) {
sample_1d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
return;
}
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
for (i=0;i<n;i++) {
sample_2d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
for (i=0;i<n;i++) {
sample_2d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
_mesa_problem(ctx, "Bad mag filter in sample_lambda_2d");
}
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
for (i=0;i<n;i++) {
sample_3d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
for (i=0;i<n;i++) {
sample_3d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
return;
}
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel],
newCoord, rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
sample_2d_linear(ctx, tObj, images[tObj->BaseLevel],
newCoord, rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
images = choose_cube_face(tObj, texcoord[i], newCoord);
sample_2d_nearest(ctx, tObj, images[level], newCoord, rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
images = choose_cube_face(tObj, texcoord[i], newCoord);
sample_2d_linear(ctx, tObj, images[level], newCoord, rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
}
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
_mesa_problem(ctx, "Bad mag filter in sample_lambda_cube");
}
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
(*img->FetchTexel)(img, col, row, 0, (GLvoid *) rgba[i]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
rgba[i][3] =
(GLchan) (w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]);
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}
texcoords + magStart, NULL, rgba + magStart);
}
}
+ if (ctx->Texture.ColorTableEnabled) {
+ texture_table_lookup(&ctx->TextureColorTable, n, rgba);
+ }
}