diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/attrib.c | 17 | ||||
-rw-r--r-- | src/mesa/main/colortab.c | 98 | ||||
-rw-r--r-- | src/mesa/main/context.c | 19 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 11 | ||||
-rw-r--r-- | src/mesa/main/get.c | 10 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 33 |
6 files changed, 99 insertions, 89 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index c34b80a60d0..7a8f5c7f3b7 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.76 2003/01/22 17:58:52 brianp Exp $ */ +/* $Id: attrib.c,v 1.77 2003/01/26 14:37:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -199,8 +199,8 @@ _mesa_PushAttrib(GLbitfield mask) for (i=0; i<MAX_TEXTURE_UNITS; i++) { attr->Texture[i] = ctx->Texture.Unit[i].Enabled; attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled; + attr->TextureColorTable[i] = ctx->Texture.Unit[i].ColorTableEnabled; } - attr->TextureColorTable = ctx->Texture.ColorTableEnabled; /* GL_NV_vertex_program */ attr->VertexProgram = ctx->VertexProgram.Enabled; attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled; @@ -534,8 +534,6 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert, enable->SampleCoverageInvert, GL_SAMPLE_COVERAGE_INVERT_ARB); - TEST_AND_UPDATE(ctx->Texture.ColorTableEnabled, enable->TextureColorTable, - GL_TEXTURE_COLOR_TABLE_SGI); /* GL_NV_vertex_program */ TEST_AND_UPDATE(ctx->VertexProgram.Enabled, enable->VertexProgram, @@ -596,6 +594,9 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_FALSE); } } + + /* GL_SGI_texture_color_table */ + ctx->Texture.Unit[i].ColorTableEnabled = enable->TextureColorTable[i]; } if (ctx->Driver.ActiveTexture) { @@ -630,13 +631,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) } if (ctx->Extensions.SGI_texture_color_table) { _mesa_set_enable(ctx, GL_TEXTURE_COLOR_TABLE_SGI, - texAttrib->ColorTableEnabled); - _mesa_ColorTableParameterfv(GL_TEXTURE_COLOR_TABLE_SGI, - GL_COLOR_TABLE_SCALE_SGI, - texAttrib->ColorTableScale); - _mesa_ColorTableParameterfv(GL_TEXTURE_COLOR_TABLE_SGI, - GL_COLOR_TABLE_BIAS_SGI, - texAttrib->ColorTableBias); + texAttrib->Unit[i].ColorTableEnabled); } _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode); _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor); diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 04625c6c826..184aa8eff2c 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -1,4 +1,4 @@ -/* $Id: colortab.c,v 1.47 2003/01/21 21:47:45 brianp Exp $ */ +/* $Id: colortab.c,v 1.48 2003/01/26 14:37:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -262,23 +262,23 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); return; } - table = &ctx->TextureColorTable; + table = &(texUnit->ColorTable); 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]; + 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]; 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; + table = &(texUnit->ProxyColorTable); proxy = GL_TRUE; break; case GL_POST_CONVOLUTION_COLOR_TABLE: @@ -515,15 +515,15 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, _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]; + 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]; break; case GL_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->PostConvolutionColorTable; @@ -727,7 +727,7 @@ _mesa_GetColorTable( GLenum target, GLenum format, _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); return; } - table = &ctx->TextureColorTable; + table = &(texUnit->ColorTable); break; case GL_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->PostConvolutionColorTable; @@ -917,16 +917,16 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) 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]; + ctx->Pixel.TextureColorTableScale[0] = params[0]; + ctx->Pixel.TextureColorTableScale[1] = params[1]; + ctx->Pixel.TextureColorTableScale[2] = params[2]; + ctx->Pixel.TextureColorTableScale[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]; + ctx->Pixel.TextureColorTableBias[0] = params[0]; + ctx->Pixel.TextureColorTableBias[1] = params[1]; + ctx->Pixel.TextureColorTableBias[2] = params[2]; + ctx->Pixel.TextureColorTableBias[3] = params[3]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); @@ -1073,19 +1073,19 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); return; } - table = &ctx->TextureColorTable; + table = &(texUnit->ColorTable); 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]; + params[0] = ctx->Pixel.TextureColorTableScale[0]; + params[1] = ctx->Pixel.TextureColorTableScale[1]; + params[2] = ctx->Pixel.TextureColorTableScale[2]; + params[3] = ctx->Pixel.TextureColorTableScale[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]; + params[0] = ctx->Pixel.TextureColorTableBias[0]; + params[1] = ctx->Pixel.TextureColorTableBias[1]; + params[2] = ctx->Pixel.TextureColorTableBias[2]; + params[3] = ctx->Pixel.TextureColorTableBias[3]; return; } break; @@ -1094,7 +1094,7 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); return; } - table = &ctx->ProxyTextureColorTable; + table = &(texUnit->ProxyColorTable); break; case GL_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->PostConvolutionColorTable; @@ -1247,19 +1247,19 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); return; } - table = &ctx->TextureColorTable; + table = &(texUnit->ColorTable); 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]; + params[0] = (GLint) ctx->Pixel.TextureColorTableScale[0]; + params[1] = (GLint) ctx->Pixel.TextureColorTableScale[1]; + params[2] = (GLint) ctx->Pixel.TextureColorTableScale[2]; + params[3] = (GLint) ctx->Pixel.TextureColorTableScale[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]; + params[0] = (GLint) ctx->Pixel.TextureColorTableBias[0]; + params[1] = (GLint) ctx->Pixel.TextureColorTableBias[1]; + params[2] = (GLint) ctx->Pixel.TextureColorTableBias[2]; + params[3] = (GLint) ctx->Pixel.TextureColorTableBias[3]; return; } break; @@ -1268,7 +1268,7 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); return; } - table = &ctx->ProxyTextureColorTable; + table = &(texUnit->ProxyColorTable); break; case GL_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->PostConvolutionColorTable; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 9dac955c8a7..7430d94410f 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.192 2003/01/21 21:47:45 brianp Exp $ */ +/* $Id: context.c,v 1.193 2003/01/26 14:37:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -863,6 +863,11 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) texUnit->Current3D = ctx->Shared->Default3D; texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; texUnit->CurrentRect = ctx->Shared->DefaultRect; + + /* GL_SGI_texture_color_table */ + texUnit->ColorTableEnabled = GL_FALSE; + _mesa_init_colortable(&texUnit->ColorTable); + _mesa_init_colortable(&texUnit->ProxyColorTable); } @@ -1253,6 +1258,9 @@ init_attrib_groups( 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); /* Point group */ ctx->Point.SmoothFlag = GL_FALSE; @@ -1323,9 +1331,6 @@ init_attrib_groups( GLcontext *ctx ) 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; @@ -1465,8 +1470,6 @@ init_attrib_groups( GLcontext *ctx ) _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; @@ -1993,6 +1996,9 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_texture_object( NULL, ctx->Texture.ProxyCubeMap ); _mesa_free_texture_object( NULL, ctx->Texture.ProxyRect ); + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); + /* Free evaluator data */ if (ctx->EvalMap.Map1Vertex3.Points) FREE( ctx->EvalMap.Map1Vertex3.Points ); @@ -2040,7 +2046,6 @@ _mesa_free_context_data( GLcontext *ctx ) _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); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 44c1e14015f..f343c2099a7 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.73 2003/01/21 21:47:49 brianp Exp $ */ +/* $Id: enable.c,v 1.74 2003/01/26 14:37:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -693,10 +693,10 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) break; case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_texture_color_table, cap); - if (ctx->Texture.ColorTableEnabled == state) + if (ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); - ctx->Texture.ColorTableEnabled = state; + ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled = state; break; /* GL_EXT_convolution */ @@ -1161,6 +1161,11 @@ _mesa_IsEnabled( GLenum cap ) CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.PostColorMatrixColorTableEnabled; + /* GL_SGI_texture_color_table */ + case GL_TEXTURE_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_texture_color_table); + return ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled; + /* GL_EXT_convolution */ case GL_CONVOLUTION_1D: CHECK_EXTENSION(EXT_convolution); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 8a0aa50b199..011ec4d64ca 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.104 2003/01/22 00:42:45 brianp Exp $ */ +/* $Id: get.c,v 1.105 2003/01/26 14:37:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1232,7 +1232,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_SGI_texture_color_table */ case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION_B(SGI_texture_color_table, pname); - *params = ctx->Texture.ColorTableEnabled; + *params = textureUnit->ColorTableEnabled; break; /* GL_EXT_secondary_color */ @@ -2631,7 +2631,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_SGI_texture_color_table */ case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION_D(SGI_texture_color_table, pname); - *params = (GLdouble) ctx->Texture.ColorTableEnabled; + *params = (GLdouble) textureUnit->ColorTableEnabled; break; /* GL_EXT_secondary_color */ @@ -4004,7 +4004,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_SGI_texture_color_table */ case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION_F(SGI_texture_color_table, pname); - *params = (GLfloat) ctx->Texture.ColorTableEnabled; + *params = (GLfloat) textureUnit->ColorTableEnabled; break; /* GL_EXT_secondary_color */ @@ -5415,7 +5415,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_SGI_texture_color_table */ case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION_I(SGI_texture_color_table, pname); - *params = (GLint) ctx->Texture.ColorTableEnabled; + *params = (GLint) textureUnit->ColorTableEnabled; break; /* GL_EXT_secondary_color */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ba80d952874..4c3fb3bbd42 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.101 2003/01/22 17:58:52 brianp Exp $ */ +/* $Id: mtypes.h,v 1.102 2003/01/26 14:37:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -438,11 +438,14 @@ struct gl_enable_attrib { GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ GLuint Texture[MAX_TEXTURE_IMAGE_UNITS]; GLuint TexGen[MAX_TEXTURE_COORD_UNITS]; - GLboolean TextureColorTable; /* SGI_texture_color_table */ - GLboolean VertexProgram; /* GL_NV_vertex_program */ - GLboolean VertexProgramPointSize; /* GL_NV_vertex_program */ - GLboolean VertexProgramTwoSide; /* GL_NV_vertex_program */ - GLboolean PointSprite; /* GL_NV_point_sprite */ + /* SGI_texture_color_table */ + GLboolean TextureColorTable[MAX_TEXTURE_IMAGE_UNITS]; + /* GL_NV_vertex_program */ + GLboolean VertexProgram; + GLboolean VertexProgramPointSize; + GLboolean VertexProgramTwoSide; + /* GL_NV_point_sprite */ + GLboolean PointSprite; }; @@ -661,6 +664,9 @@ struct gl_pixel_attrib { GLfloat PCMCTscale[4]; GLfloat PCMCTbias[4]; GLboolean PostColorMatrixColorTableEnabled; + /* GL_SGI_texture_color_table */ + GLfloat TextureColorTableScale[4]; + GLfloat TextureColorTableBias[4]; /* Convolution */ GLboolean Convolution1DEnabled; GLboolean Convolution2DEnabled; @@ -955,16 +961,21 @@ struct gl_texture_unit { struct gl_texture_object Saved3D; struct gl_texture_object SavedCubeMap; struct gl_texture_object SavedRect; + + /* GL_SGI_texture_color_table */ + struct gl_color_table ColorTable; + struct gl_color_table ProxyColorTable; + GLboolean ColorTableEnabled; }; /* The texture attribute group */ struct gl_texture_attrib { /* multitexture */ - GLuint CurrentUnit; /* Active texture unit */ + GLuint CurrentUnit; /* Active texture unit */ GLuint _EnabledUnits; /* one bit set for each really-enabled unit */ - GLuint _GenFlags; /* for texgen */ + GLuint _GenFlags; /* for texgen */ GLuint _TexGenEnabled; GLuint _TexMatEnabled; @@ -979,10 +990,6 @@ struct gl_texture_attrib { /* 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; }; @@ -1724,8 +1731,6 @@ struct __GLcontextRec { 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 */ |