summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-16 09:36:12 -0600
committerBrian <brian@yutani.localnet.net>2007-03-16 09:36:12 -0600
commit7573b58db659b32f3589fc955959710d44353239 (patch)
treefc7519d69026218e0a61707b71763cc68667c40d /src/mesa/main
parentd7049431a09a71a51768fc8cea292653557fc261 (diff)
Colortable re-org.
The pixel transfer path has three color table lookups. Use an array [3] to store that info, rather than separate variables.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/attrib.c19
-rw-r--r--src/mesa/main/colortab.c313
-rw-r--r--src/mesa/main/enable.c18
-rw-r--r--src/mesa/main/get.c18
-rw-r--r--src/mesa/main/get_gen.py6
-rw-r--r--src/mesa/main/image.c6
-rw-r--r--src/mesa/main/mtypes.h38
-rw-r--r--src/mesa/main/pixel.c20
8 files changed, 170 insertions, 268 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 2b1a35f3de..0df8d23050 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -138,9 +138,9 @@ _mesa_PushAttrib(GLbitfield mask)
attr->Blend = ctx->Color.BlendEnabled;
attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled;
attr->ColorMaterial = ctx->Light.ColorMaterialEnabled;
- attr->ColorTable = ctx->Pixel.ColorTableEnabled;
- attr->PostColorMatrixColorTable = ctx->Pixel.PostColorMatrixColorTableEnabled;
- attr->PostConvolutionColorTable = ctx->Pixel.PostConvolutionColorTableEnabled;
+ for (i = 0; i < COLORTABLE_MAX; i++) {
+ attr->ColorTable[i] = ctx->Pixel.ColorTableEnabled[i];
+ }
attr->Convolution1D = ctx->Pixel.Convolution1DEnabled;
attr->Convolution2D = ctx->Pixel.Convolution2DEnabled;
attr->Separable2D = ctx->Pixel.Separable2DEnabled;
@@ -432,14 +432,15 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial,
GL_COLOR_MATERIAL);
- TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled, enable->ColorTable,
+ TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION],
+ enable->ColorTable[COLORTABLE_PRECONVOLUTION],
GL_COLOR_TABLE);
- TEST_AND_UPDATE(ctx->Pixel.PostColorMatrixColorTableEnabled,
- enable->PostColorMatrixColorTable,
- GL_POST_COLOR_MATRIX_COLOR_TABLE);
- TEST_AND_UPDATE(ctx->Pixel.PostConvolutionColorTableEnabled,
- enable->PostConvolutionColorTable,
+ TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION],
+ enable->ColorTable[COLORTABLE_POSTCONVOLUTION],
GL_POST_CONVOLUTION_COLOR_TABLE);
+ TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX],
+ enable->ColorTable[COLORTABLE_POSTCOLORMATRIX],
+ GL_POST_COLOR_MATRIX_COLOR_TABLE);
TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index 9fb0baf4a7..d8c4136f49 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -291,15 +291,17 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
GLsizei width, GLenum format, GLenum type,
const GLvoid *data )
{
+ static const GLfloat one[4] = { 1.0, 1.0, 1.0, 1.0 };
+ static const GLfloat zero[4] = { 0.0, 0.0, 0.0, 0.0 };
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj = NULL;
struct gl_color_table *table = NULL;
GLboolean proxy = GL_FALSE;
GLint baseFormat;
- GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0;
- GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0;
+ const GLfloat *scale = one, *bias = zero;
GLint comps;
+
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
switch (target) {
@@ -350,18 +352,12 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
- rScale = ctx->Pixel.ColorTableScale[0];
- gScale = ctx->Pixel.ColorTableScale[1];
- bScale = ctx->Pixel.ColorTableScale[2];
- aScale = ctx->Pixel.ColorTableScale[3];
- rBias = ctx->Pixel.ColorTableBias[0];
- gBias = ctx->Pixel.ColorTableBias[1];
- bBias = ctx->Pixel.ColorTableBias[2];
- aBias = ctx->Pixel.ColorTableBias[3];
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION];
break;
case GL_PROXY_COLOR_TABLE:
- table = &ctx->ProxyColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION];
proxy = GL_TRUE;
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
@@ -370,14 +366,8 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
return;
}
table = &(texUnit->ColorTable);
- rScale = ctx->Pixel.TextureColorTableScale[0];
- gScale = ctx->Pixel.TextureColorTableScale[1];
- bScale = ctx->Pixel.TextureColorTableScale[2];
- aScale = ctx->Pixel.TextureColorTableScale[3];
- rBias = ctx->Pixel.TextureColorTableBias[0];
- gBias = ctx->Pixel.TextureColorTableBias[1];
- bBias = ctx->Pixel.TextureColorTableBias[2];
- aBias = ctx->Pixel.TextureColorTableBias[3];
+ scale = ctx->Pixel.TextureColorTableScale;
+ bias = ctx->Pixel.TextureColorTableBias;
break;
case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -388,33 +378,21 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
proxy = GL_TRUE;
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
- rScale = ctx->Pixel.PCCTscale[0];
- gScale = ctx->Pixel.PCCTscale[1];
- bScale = ctx->Pixel.PCCTscale[2];
- aScale = ctx->Pixel.PCCTscale[3];
- rBias = ctx->Pixel.PCCTbias[0];
- gBias = ctx->Pixel.PCCTbias[1];
- bBias = ctx->Pixel.PCCTbias[2];
- aBias = ctx->Pixel.PCCTbias[3];
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION];
break;
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->ProxyPostConvolutionColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION];
proxy = GL_TRUE;
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
- rScale = ctx->Pixel.PCMCTscale[0];
- gScale = ctx->Pixel.PCMCTscale[1];
- bScale = ctx->Pixel.PCMCTscale[2];
- aScale = ctx->Pixel.PCMCTscale[3];
- rBias = ctx->Pixel.PCMCTbias[0];
- gBias = ctx->Pixel.PCMCTbias[1];
- bBias = ctx->Pixel.PCMCTbias[2];
- aBias = ctx->Pixel.PCMCTbias[3];
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX];
break;
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->ProxyPostColorMatrixColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX];
proxy = GL_TRUE;
break;
default:
@@ -483,10 +461,10 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
store_colortable_entries(ctx, table,
0, width, /* start, count */
format, type, data,
- rScale, rBias,
- gScale, gBias,
- bScale, bBias,
- aScale, aBias);
+ scale[0], bias[0],
+ scale[1], bias[1],
+ scale[2], bias[2],
+ scale[3], bias[3]);
}
} /* proxy */
@@ -510,12 +488,14 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
GLsizei count, GLenum format, GLenum type,
const GLvoid *data )
{
+ static const GLfloat one[4] = { 1.0, 1.0, 1.0, 1.0 };
+ static const GLfloat zero[4] = { 0.0, 0.0, 0.0, 0.0 };
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj = NULL;
struct gl_color_table *table = NULL;
- GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0;
- GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0;
+ const GLfloat *scale = one, *bias = zero;
+
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
@@ -543,15 +523,9 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
- rScale = ctx->Pixel.ColorTableScale[0];
- gScale = ctx->Pixel.ColorTableScale[1];
- bScale = ctx->Pixel.ColorTableScale[2];
- aScale = ctx->Pixel.ColorTableScale[3];
- rBias = ctx->Pixel.ColorTableBias[0];
- gBias = ctx->Pixel.ColorTableBias[1];
- bBias = ctx->Pixel.ColorTableBias[2];
- aBias = ctx->Pixel.ColorTableBias[3];
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -559,36 +533,18 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
return;
}
table = &(texUnit->ColorTable);
- rScale = ctx->Pixel.TextureColorTableScale[0];
- gScale = ctx->Pixel.TextureColorTableScale[1];
- bScale = ctx->Pixel.TextureColorTableScale[2];
- aScale = ctx->Pixel.TextureColorTableScale[3];
- rBias = ctx->Pixel.TextureColorTableBias[0];
- gBias = ctx->Pixel.TextureColorTableBias[1];
- bBias = ctx->Pixel.TextureColorTableBias[2];
- aBias = ctx->Pixel.TextureColorTableBias[3];
+ scale = ctx->Pixel.TextureColorTableScale;
+ bias = ctx->Pixel.TextureColorTableBias;
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
- rScale = ctx->Pixel.PCCTscale[0];
- gScale = ctx->Pixel.PCCTscale[1];
- bScale = ctx->Pixel.PCCTscale[2];
- aScale = ctx->Pixel.PCCTscale[3];
- rBias = ctx->Pixel.PCCTbias[0];
- gBias = ctx->Pixel.PCCTbias[1];
- bBias = ctx->Pixel.PCCTbias[2];
- aBias = ctx->Pixel.PCCTbias[3];
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
- rScale = ctx->Pixel.PCMCTscale[0];
- gScale = ctx->Pixel.PCMCTscale[1];
- bScale = ctx->Pixel.PCMCTscale[2];
- aScale = ctx->Pixel.PCMCTscale[3];
- rBias = ctx->Pixel.PCMCTbias[0];
- gBias = ctx->Pixel.PCMCTbias[1];
- bBias = ctx->Pixel.PCMCTbias[2];
- aBias = ctx->Pixel.PCMCTbias[3];
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX];
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
@@ -623,10 +579,10 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
store_colortable_entries(ctx, table, start, count,
format, type, data,
- rScale, rBias,
- gScale, gBias,
- bScale, bBias,
- aScale, aBias);
+ scale[0], bias[0],
+ scale[1], bias[1],
+ scale[2], bias[2],
+ scale[3], bias[3]);
if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) {
/* per-texture object palette */
@@ -700,7 +656,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -710,10 +666,10 @@ _mesa_GetColorTable( GLenum target, GLenum format,
table = &(texUnit->ColorTable);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
@@ -827,16 +783,10 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
switch (target) {
case GL_COLOR_TABLE_SGI:
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- ctx->Pixel.ColorTableScale[0] = params[0];
- ctx->Pixel.ColorTableScale[1] = params[1];
- ctx->Pixel.ColorTableScale[2] = params[2];
- ctx->Pixel.ColorTableScale[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION], params);
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- ctx->Pixel.ColorTableBias[0] = params[0];
- ctx->Pixel.ColorTableBias[1] = params[1];
- ctx->Pixel.ColorTableBias[2] = params[2];
- ctx->Pixel.ColorTableBias[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION], params);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
@@ -849,16 +799,10 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
return;
}
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- ctx->Pixel.TextureColorTableScale[0] = params[0];
- ctx->Pixel.TextureColorTableScale[1] = params[1];
- ctx->Pixel.TextureColorTableScale[2] = params[2];
- ctx->Pixel.TextureColorTableScale[3] = params[3];
+ COPY_4V(ctx->Pixel.TextureColorTableScale, params);
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- ctx->Pixel.TextureColorTableBias[0] = params[0];
- ctx->Pixel.TextureColorTableBias[1] = params[1];
- ctx->Pixel.TextureColorTableBias[2] = params[2];
- ctx->Pixel.TextureColorTableBias[3] = params[3];
+ COPY_4V(ctx->Pixel.TextureColorTableBias, params);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
@@ -867,16 +811,10 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- ctx->Pixel.PCCTscale[0] = params[0];
- ctx->Pixel.PCCTscale[1] = params[1];
- ctx->Pixel.PCCTscale[2] = params[2];
- ctx->Pixel.PCCTscale[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION], params);
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- ctx->Pixel.PCCTbias[0] = params[0];
- ctx->Pixel.PCCTbias[1] = params[1];
- ctx->Pixel.PCCTbias[2] = params[2];
- ctx->Pixel.PCCTbias[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION], params);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
@@ -885,16 +823,10 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- ctx->Pixel.PCMCTscale[0] = params[0];
- ctx->Pixel.PCMCTscale[1] = params[1];
- ctx->Pixel.PCMCTscale[2] = params[2];
- ctx->Pixel.PCMCTscale[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX], params);
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- ctx->Pixel.PCMCTbias[0] = params[0];
- ctx->Pixel.PCMCTbias[1] = params[1];
- ctx->Pixel.PCMCTbias[2] = params[2];
- ctx->Pixel.PCMCTbias[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX], params);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
@@ -981,24 +913,18 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = ctx->Pixel.ColorTableScale[0];
- params[1] = ctx->Pixel.ColorTableScale[1];
- params[2] = ctx->Pixel.ColorTableScale[2];
- params[3] = ctx->Pixel.ColorTableScale[3];
+ COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION]);
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = ctx->Pixel.ColorTableBias[0];
- params[1] = ctx->Pixel.ColorTableBias[1];
- params[2] = ctx->Pixel.ColorTableBias[2];
- params[3] = ctx->Pixel.ColorTableBias[3];
+ COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION]);
return;
}
break;
case GL_PROXY_COLOR_TABLE:
- table = &ctx->ProxyColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -1007,17 +933,11 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
}
table = &(texUnit->ColorTable);
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = ctx->Pixel.TextureColorTableScale[0];
- params[1] = ctx->Pixel.TextureColorTableScale[1];
- params[2] = ctx->Pixel.TextureColorTableScale[2];
- params[3] = ctx->Pixel.TextureColorTableScale[3];
+ COPY_4V(params, ctx->Pixel.TextureColorTableScale);
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = ctx->Pixel.TextureColorTableBias[0];
- params[1] = ctx->Pixel.TextureColorTableBias[1];
- params[2] = ctx->Pixel.TextureColorTableBias[2];
- params[3] = ctx->Pixel.TextureColorTableBias[3];
+ COPY_4V(params, ctx->Pixel.TextureColorTableBias);
return;
}
break;
@@ -1029,44 +949,32 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
table = &(texUnit->ProxyColorTable);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = ctx->Pixel.PCCTscale[0];
- params[1] = ctx->Pixel.PCCTscale[1];
- params[2] = ctx->Pixel.PCCTscale[2];
- params[3] = ctx->Pixel.PCCTscale[3];
+ COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION]);
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = ctx->Pixel.PCCTbias[0];
- params[1] = ctx->Pixel.PCCTbias[1];
- params[2] = ctx->Pixel.PCCTbias[2];
- params[3] = ctx->Pixel.PCCTbias[3];
+ COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION]);
return;
}
break;
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->ProxyPostConvolutionColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = ctx->Pixel.PCMCTscale[0];
- params[1] = ctx->Pixel.PCMCTscale[1];
- params[2] = ctx->Pixel.PCMCTscale[2];
- params[3] = ctx->Pixel.PCMCTscale[3];
+ COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]);
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = ctx->Pixel.PCMCTbias[0];
- params[1] = ctx->Pixel.PCMCTbias[1];
- params[2] = ctx->Pixel.PCMCTbias[2];
- params[3] = ctx->Pixel.PCMCTbias[3];
+ COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX]);
return;
}
break;
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->ProxyPostColorMatrixColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX];
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)");
@@ -1155,24 +1063,26 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = (GLint) ctx->Pixel.ColorTableScale[0];
- params[1] = (GLint) ctx->Pixel.ColorTableScale[1];
- params[2] = (GLint) ctx->Pixel.ColorTableScale[2];
- params[3] = (GLint) ctx->Pixel.ColorTableScale[3];
+ GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION];
+ params[0] = (GLint) scale[0];
+ params[1] = (GLint) scale[1];
+ params[2] = (GLint) scale[2];
+ params[3] = (GLint) scale[3];
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = (GLint) ctx->Pixel.ColorTableBias[0];
- params[1] = (GLint) ctx->Pixel.ColorTableBias[1];
- params[2] = (GLint) ctx->Pixel.ColorTableBias[2];
- params[3] = (GLint) ctx->Pixel.ColorTableBias[3];
+ GLfloat *bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION];
+ params[0] = (GLint) bias[0];
+ params[1] = (GLint) bias[1];
+ params[2] = (GLint) bias[2];
+ params[3] = (GLint) bias[3];
return;
}
break;
case GL_PROXY_COLOR_TABLE:
- table = &ctx->ProxyColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -1203,44 +1113,48 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
table = &(texUnit->ProxyColorTable);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = (GLint) ctx->Pixel.PCCTscale[0];
- params[1] = (GLint) ctx->Pixel.PCCTscale[1];
- params[2] = (GLint) ctx->Pixel.PCCTscale[2];
- params[3] = (GLint) ctx->Pixel.PCCTscale[3];
+ GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION];
+ params[0] = (GLint) scale[0];
+ params[1] = (GLint) scale[1];
+ params[2] = (GLint) scale[2];
+ params[3] = (GLint) scale[3];
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = (GLint) ctx->Pixel.PCCTbias[0];
- params[1] = (GLint) ctx->Pixel.PCCTbias[1];
- params[2] = (GLint) ctx->Pixel.PCCTbias[2];
- params[3] = (GLint) ctx->Pixel.PCCTbias[3];
+ GLfloat *bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION];
+ params[0] = (GLint) bias[0];
+ params[1] = (GLint) bias[1];
+ params[2] = (GLint) bias[2];
+ params[3] = (GLint) bias[3];
return;
}
break;
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->ProxyPostConvolutionColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = (GLint) ctx->Pixel.PCMCTscale[0];
- params[1] = (GLint) ctx->Pixel.PCMCTscale[1];
- params[2] = (GLint) ctx->Pixel.PCMCTscale[2];
- params[3] = (GLint) ctx->Pixel.PCMCTscale[3];
+ GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];
+ params[0] = (GLint) scale[0];
+ params[0] = (GLint) scale[1];
+ params[0] = (GLint) scale[2];
+ params[0] = (GLint) scale[3];
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = (GLint) ctx->Pixel.PCMCTbias[0];
- params[1] = (GLint) ctx->Pixel.PCMCTbias[1];
- params[2] = (GLint) ctx->Pixel.PCMCTbias[2];
- params[3] = (GLint) ctx->Pixel.PCMCTbias[3];
+ GLfloat *bias = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];
+ params[0] = (GLint) bias[0];
+ params[1] = (GLint) bias[1];
+ params[2] = (GLint) bias[2];
+ params[3] = (GLint) bias[3];
return;
}
break;
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->ProxyPostColorMatrixColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX];
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)");
@@ -1316,13 +1230,11 @@ _mesa_free_colortable_data( struct gl_color_table *p )
void
_mesa_init_colortables( GLcontext * ctx )
{
- /* Color tables */
- _mesa_init_colortable(&ctx->ColorTable);
- _mesa_init_colortable(&ctx->ProxyColorTable);
- _mesa_init_colortable(&ctx->PostConvolutionColorTable);
- _mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable);
- _mesa_init_colortable(&ctx->PostColorMatrixColorTable);
- _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable);
+ GLuint i;
+ for (i = 0; i < COLORTABLE_MAX; i++) {
+ _mesa_init_colortable(&ctx->ColorTable[i]);
+ _mesa_init_colortable(&ctx->ProxyColorTable[i]);
+ }
}
@@ -1332,10 +1244,9 @@ _mesa_init_colortables( GLcontext * ctx )
void
_mesa_free_colortables_data( GLcontext *ctx )
{
- _mesa_free_colortable_data(&ctx->ColorTable);
- _mesa_free_colortable_data(&ctx->ProxyColorTable);
- _mesa_free_colortable_data(&ctx->PostConvolutionColorTable);
- _mesa_free_colortable_data(&ctx->ProxyPostConvolutionColorTable);
- _mesa_free_colortable_data(&ctx->PostColorMatrixColorTable);
- _mesa_free_colortable_data(&ctx->ProxyPostColorMatrixColorTable);
+ GLuint i;
+ for (i = 0; i < COLORTABLE_MAX; i++) {
+ _mesa_free_colortable_data(&ctx->ColorTable[i]);
+ _mesa_free_colortable_data(&ctx->ProxyColorTable[i]);
+ }
}
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 0d54c29949..11b4ad6400 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -663,24 +663,24 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
/* GL_SGI_color_table */
case GL_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table, cap);
- if (ctx->Pixel.ColorTableEnabled == state)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION] == state)
return;
FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.ColorTableEnabled = state;
+ ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION] = state;
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table, cap);
- if (ctx->Pixel.PostConvolutionColorTableEnabled == state)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION] == state)
return;
FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionColorTableEnabled = state;
+ ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION] = state;
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table, cap);
- if (ctx->Pixel.PostColorMatrixColorTableEnabled == state)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX] == state)
return;
FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixColorTableEnabled = state;
+ ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX] = state;
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_texture_color_table, cap);
@@ -1192,13 +1192,13 @@ _mesa_IsEnabled( GLenum cap )
/* GL_SGI_color_table */
case GL_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table);
- return ctx->Pixel.ColorTableEnabled;
+ return ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION];
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table);
- return ctx->Pixel.PostConvolutionColorTableEnabled;
+ return ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION];
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table);
- return ctx->Pixel.PostColorMatrixColorTableEnabled;
+ return ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX];
/* GL_SGI_texture_color_table */
case GL_TEXTURE_COLOR_TABLE_SGI:
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 7601f32069..4eda349134 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1283,15 +1283,15 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetBooleanv");
- params[0] = ctx->Pixel.ColorTableEnabled;
+ params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION];
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetBooleanv");
- params[0] = ctx->Pixel.PostConvolutionColorTableEnabled;
+ params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetBooleanv");
- params[0] = ctx->Pixel.PostColorMatrixColorTableEnabled;
+ params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_texture_color_table, "GetBooleanv");
@@ -3110,15 +3110,15 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetFloatv");
- params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled);
+ params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetFloatv");
- params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostConvolutionColorTableEnabled);
+ params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]);
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetFloatv");
- params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostColorMatrixColorTableEnabled);
+ params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]);
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_texture_color_table, "GetFloatv");
@@ -4937,15 +4937,15 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetIntegerv");
- params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled);
+ params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetIntegerv");
- params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostConvolutionColorTableEnabled);
+ params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]);
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetIntegerv");
- params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostColorMatrixColorTableEnabled);
+ params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]);
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_texture_color_table, "GetIntegerv");
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 76417d2899..0b6cd3e5c5 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -624,11 +624,11 @@ StateVars = [
# GL_SGI_color_table / GL_ARB_imaging
( "GL_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.ColorTableEnabled"], "", ["SGI_color_table"] ),
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]"], "", ["SGI_color_table"] ),
( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.PostConvolutionColorTableEnabled"], "", ["SGI_color_table"] ),
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]"], "", ["SGI_color_table"] ),
( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.PostColorMatrixColorTableEnabled"], "", ["SGI_color_table"] ),
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]"], "", ["SGI_color_table"] ),
# GL_SGI_texture_color_table
( "GL_TEXTURE_COLOR_TABLE_SGI", GLboolean,
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index f53730cbcf..cad9736b30 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1036,7 +1036,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
}
/* GL_COLOR_TABLE lookup */
if (transferOps & IMAGE_COLOR_TABLE_BIT) {
- _mesa_lookup_rgba_float(&ctx->ColorTable, n, rgba);
+ _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_PRECONVOLUTION], n, rgba);
}
/* convolution */
if (transferOps & IMAGE_CONVOLUTION_BIT) {
@@ -1057,7 +1057,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
}
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) {
- _mesa_lookup_rgba_float(&ctx->PostConvolutionColorTable, n, rgba);
+ _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_POSTCONVOLUTION], n, rgba);
}
/* color matrix transform */
if (transferOps & IMAGE_COLOR_MATRIX_BIT) {
@@ -1065,7 +1065,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
}
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */
if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) {
- _mesa_lookup_rgba_float(&ctx->PostColorMatrixColorTable, n, rgba);
+ _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX], n, rgba);
}
/* update histogram count */
if (transferOps & IMAGE_HISTOGRAM_BIT) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 321adfe615..65246eb116 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -383,6 +383,13 @@ enum {
BUFFER_BIT_COLOR7)
+/** The pixel transfer path has three color tables: */
+/*@{*/
+#define COLORTABLE_PRECONVOLUTION 0
+#define COLORTABLE_POSTCONVOLUTION 1
+#define COLORTABLE_POSTCOLORMATRIX 2
+#define COLORTABLE_MAX 3
+/*@}*/
/**
@@ -663,9 +670,7 @@ struct gl_enable_attrib
GLboolean Blend;
GLbitfield ClipPlanes;
GLboolean ColorMaterial;
- GLboolean ColorTable; /* SGI_color_table */
- GLboolean PostColorMatrixColorTable; /* SGI_color_table */
- GLboolean PostConvolutionColorTable; /* SGI_color_table */
+ GLboolean ColorTable[COLORTABLE_MAX];
GLboolean Convolution1D;
GLboolean Convolution2D;
GLboolean Separable2D;
@@ -1016,11 +1021,10 @@ struct gl_pixel_attrib
GLboolean MapColorFlag;
GLboolean MapStencilFlag;
- /* Color table lookup (GL_SGI_color_table) */
- /* Note: actual table is not part of this attrib group */
- GLfloat ColorTableScale[4];
- GLfloat ColorTableBias[4];
- GLboolean ColorTableEnabled;
+ /* There are multiple color table stages: */
+ GLboolean ColorTableEnabled[COLORTABLE_MAX];
+ GLfloat ColorTableScale[COLORTABLE_MAX][4]; /**< RGBA */
+ GLfloat ColorTableBias[COLORTABLE_MAX][4]; /**< RGBA */
/* Convolution (GL_EXT_convolution) */
GLboolean Convolution1DEnabled;
@@ -1033,23 +1037,11 @@ struct gl_pixel_attrib
GLfloat PostConvolutionScale[4]; /**< RGBA */
GLfloat PostConvolutionBias[4]; /**< RGBA */
- /* Post-convolution color table */
- /* Note: actual table is not part of this attrib group */
- GLboolean PostConvolutionColorTableEnabled;
- GLfloat PCCTscale[4]; /** Post Convolution Color Table scale */
- GLfloat PCCTbias[4]; /** Post Convolution Color Table bias */
-
/* Color matrix (GL_SGI_color_matrix) */
/* Note: the color matrix is not part of this attrib group */
GLfloat PostColorMatrixScale[4]; /**< RGBA */
GLfloat PostColorMatrixBias[4]; /**< RGBA */
- /* Post color matrix color table */
- /* Note: actual table is not part of this attrib group */
- GLboolean PostColorMatrixColorTableEnabled;
- GLfloat PCMCTscale[4]; /** Post Color Matrix Color Table scale */
- GLfloat PCMCTbias[4]; /** Post Color Matrix Color Table bias */
-
/* Histogram & minmax (GL_EXT_histogram) */
/* Note: histogram and minmax data are not part of this attrib group */
GLboolean HistogramEnabled;
@@ -2934,12 +2926,14 @@ struct __GLcontextRec
struct gl_feedback Feedback; /**< Feedback */
struct gl_selection Select; /**< Selection */
- struct gl_color_table ColorTable; /**< Pre-convolution */
- struct gl_color_table ProxyColorTable; /**< Pre-convolution */
+ struct gl_color_table ColorTable[COLORTABLE_MAX];
+ struct gl_color_table ProxyColorTable[COLORTABLE_MAX];
+#if 0
struct gl_color_table PostConvolutionColorTable;
struct gl_color_table ProxyPostConvolutionColorTable;
struct gl_color_table PostColorMatrixColorTable;
struct gl_color_table ProxyPostColorMatrixColorTable;
+#endif
struct gl_program_state Program; /**< for vertex or fragment progs */
struct gl_vertex_program_state VertexProgram; /**< GL_ARB/NV_vertex_program */
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index ae014a23c4..b9e23d80b6 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -1367,7 +1367,7 @@ update_image_transfer_state(GLcontext *ctx)
if (ctx->Pixel.MapColorFlag)
mask |= IMAGE_MAP_COLOR_BIT;
- if (ctx->Pixel.ColorTableEnabled)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION])
mask |= IMAGE_COLOR_TABLE_BIT;
if (ctx->Pixel.Convolution1DEnabled ||
@@ -1386,7 +1386,7 @@ update_image_transfer_state(GLcontext *ctx)
}
}
- if (ctx->Pixel.PostConvolutionColorTableEnabled)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION])
mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY ||
@@ -1400,7 +1400,7 @@ update_image_transfer_state(GLcontext *ctx)
ctx->Pixel.PostColorMatrixBias[3] != 0.0F)
mask |= IMAGE_COLOR_MATRIX_BIT;
- if (ctx->Pixel.PostColorMatrixColorTableEnabled)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX])
mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
if (ctx->Pixel.HistogramEnabled)
@@ -1477,15 +1477,11 @@ _mesa_init_pixel( GLcontext *ctx )
ctx->Pixel.MinMaxEnabled = GL_FALSE;
ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0);
ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0);
- ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0);
- ASSIGN_4V(ctx->Pixel.ColorTableBias, 0.0, 0.0, 0.0, 0.0);
- ASSIGN_4V(ctx->Pixel.PCCTscale, 1.0, 1.0, 1.0, 1.0);
- ASSIGN_4V(ctx->Pixel.PCCTbias, 0.0, 0.0, 0.0, 0.0);
- ASSIGN_4V(ctx->Pixel.PCMCTscale, 1.0, 1.0, 1.0, 1.0);
- ASSIGN_4V(ctx->Pixel.PCMCTbias, 0.0, 0.0, 0.0, 0.0);
- ctx->Pixel.ColorTableEnabled = GL_FALSE;
- ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE;
- ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE;
+ for (i = 0; i < COLORTABLE_MAX; i++) {
+ ASSIGN_4V(ctx->Pixel.ColorTableScale[i], 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.ColorTableBias[i], 0.0, 0.0, 0.0, 0.0);
+ ctx->Pixel.ColorTableEnabled[i] = GL_FALSE;
+ }
ctx->Pixel.Convolution1DEnabled = GL_FALSE;
ctx->Pixel.Convolution2DEnabled = GL_FALSE;
ctx->Pixel.Separable2DEnabled = GL_FALSE;