replace color table FloatTable boolean with Type enum
[mesa.git] / src / mesa / main / colortab.c
index 04625c6c826d2e77e55b46e72f81883c3fb632b6..d0fa323c39b624c79e1cb9d89f4f8c27ab59e75e 100644 (file)
@@ -1,10 +1,8 @@
-/* $Id: colortab.c,v 1.47 2003/01/21 21:47:45 brianp Exp $ */
-
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  6.1
  *
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2004  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"),
@@ -31,7 +29,6 @@
 #include "context.h"
 #include "image.h"
 #include "macros.h"
-#include "mmath.h"
 #include "state.h"
 
 
@@ -94,26 +91,6 @@ base_colortab_format( GLenum format )
 }
 
 
-void
-_mesa_init_colortable( struct gl_color_table *p )
-{
-   p->FloatTable = GL_FALSE;
-   p->Table = NULL;
-   p->Size = 0;
-   p->IntFormat = GL_RGBA;
-}
-
-
-
-void
-_mesa_free_colortable_data( struct gl_color_table *p )
-{
-   if (p->Table) {
-      FREE(p->Table);
-      p->Table = NULL;
-   }
-}
-
 
 /*
  * Examine table's format and set the component sizes accordingly.
@@ -121,12 +98,29 @@ _mesa_free_colortable_data( struct gl_color_table *p )
 static void
 set_component_sizes( struct gl_color_table *table )
 {
+   GLubyte sz;
+
+   switch (table->Type) {
+   case GL_UNSIGNED_BYTE:
+      sz = sizeof(GLubyte);
+      break;
+   case GL_UNSIGNED_SHORT:
+      sz = sizeof(GLushort);
+      break;
+   case GL_FLOAT:
+      sz = sizeof(GLfloat);
+      break;
+   default:
+      _mesa_problem(NULL, "bad color table type in set_component_sizes 0x%x", table->Type);
+      return;
+   }
+
    switch (table->Format) {
       case GL_ALPHA:
          table->RedSize = 0;
          table->GreenSize = 0;
          table->BlueSize = 0;
-         table->AlphaSize = CHAN_BITS;
+         table->AlphaSize = sz;
          table->IntensitySize = 0;
          table->LuminanceSize = 0;
          break;
@@ -136,37 +130,37 @@ set_component_sizes( struct gl_color_table *table )
          table->BlueSize = 0;
          table->AlphaSize = 0;
          table->IntensitySize = 0;
-         table->LuminanceSize = CHAN_BITS;
+         table->LuminanceSize = sz;
          break;
       case GL_LUMINANCE_ALPHA:
          table->RedSize = 0;
          table->GreenSize = 0;
          table->BlueSize = 0;
-         table->AlphaSize = CHAN_BITS;
+         table->AlphaSize = sz;
          table->IntensitySize = 0;
-         table->LuminanceSize = CHAN_BITS;
+         table->LuminanceSize = sz;
          break;
       case GL_INTENSITY:
          table->RedSize = 0;
          table->GreenSize = 0;
          table->BlueSize = 0;
          table->AlphaSize = 0;
-         table->IntensitySize = CHAN_BITS;
+         table->IntensitySize = sz;
          table->LuminanceSize = 0;
          break;
       case GL_RGB:
-         table->RedSize = CHAN_BITS;
-         table->GreenSize = CHAN_BITS;
-         table->BlueSize = CHAN_BITS;
+         table->RedSize = sz;
+         table->GreenSize = sz;
+         table->BlueSize = sz;
          table->AlphaSize = 0;
          table->IntensitySize = 0;
          table->LuminanceSize = 0;
          break;
       case GL_RGBA:
-         table->RedSize = CHAN_BITS;
-         table->GreenSize = CHAN_BITS;
-         table->BlueSize = CHAN_BITS;
-         table->AlphaSize = CHAN_BITS;
+         table->RedSize = sz;
+         table->GreenSize = sz;
+         table->BlueSize = sz;
+         table->AlphaSize = sz;
          table->IntensitySize = 0;
          table->LuminanceSize = 0;
          break;
@@ -177,7 +171,7 @@ set_component_sizes( struct gl_color_table *table )
 
 
 
-void
+void GLAPIENTRY
 _mesa_ColorTable( GLenum target, GLenum internalFormat,
                   GLsizei width, GLenum format, GLenum type,
                   const GLvoid *data )
@@ -190,7 +184,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
    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;
-   GLboolean floatTable = GL_FALSE;
+   GLenum tableType = CHAN_TYPE;
    GLint comps;
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
 
@@ -243,7 +237,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
          break;
       case GL_COLOR_TABLE:
          table = &ctx->ColorTable;
-         floatTable = GL_TRUE;
+        tableType = GL_FLOAT;
          rScale = ctx->Pixel.ColorTableScale[0];
          gScale = ctx->Pixel.ColorTableScale[1];
          bScale = ctx->Pixel.ColorTableScale[2];
@@ -262,28 +256,28 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
             _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];
+         table = &(texUnit->ColorTable);
+        tableType = GL_FLOAT;
+         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:
          table = &ctx->PostConvolutionColorTable;
-         floatTable = GL_TRUE;
+        tableType = GL_FLOAT;
          rScale = ctx->Pixel.PCCTscale[0];
          gScale = ctx->Pixel.PCCTscale[1];
          bScale = ctx->Pixel.PCCTscale[2];
@@ -299,7 +293,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
          break;
       case GL_POST_COLOR_MATRIX_COLOR_TABLE:
          table = &ctx->PostColorMatrixColorTable;
-         floatTable = GL_TRUE;
+        tableType = GL_FLOAT;
          rScale = ctx->Pixel.PCMCTscale[0];
          gScale = ctx->Pixel.PCMCTscale[1];
          bScale = ctx->Pixel.PCMCTscale[2];
@@ -372,7 +366,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
          table->Table = NULL;
       }
       if (width > 0) {
-         if (floatTable) {
+         if (tableType == GL_FLOAT) {
             GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4];
             GLfloat *tableF;
             GLint i;
@@ -382,7 +376,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
                                           format, type, data, &ctx->Unpack,
                                           0, GL_FALSE);
 
-            table->FloatTable = GL_TRUE;
+           table->Type = GL_FLOAT;
             table->Table = MALLOC(comps * width * sizeof(GLfloat));
             if (!table->Table) {
                _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
@@ -435,7 +429,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
          }
          else {
             /* store GLchan table */
-            table->FloatTable = GL_FALSE;
+           table->Type = CHAN_TYPE;
             table->Table = MALLOC(comps * width * sizeof(GLchan));
             if (!table->Table) {
                _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
@@ -445,7 +439,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
                                          (GLchan *) table->Table,  /* dest */
                                          format, type, data,
                                          &ctx->Unpack, 0);
-         } /* floatTable */
+         } /* type==GL_FLOAT */
       } /* width > 0 */
    } /* proxy */
 
@@ -461,7 +455,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
 
 
 
-void
+void GLAPIENTRY
 _mesa_ColorSubTable( GLenum target, GLsizei start,
                      GLsizei count, GLenum format, GLenum type,
                      const GLvoid *data )
@@ -515,15 +509,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;
@@ -578,7 +572,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
       return;
    }
 
-   if (!table->FloatTable) {
+   if (table->Type != GL_FLOAT) {
       GLchan *dest = (GLchan *) table->Table + start * comps * sizeof(GLchan);
       _mesa_unpack_chan_color_span(ctx, count, table->Format, dest,
                                    format, type, data, &ctx->Unpack, 0);
@@ -588,7 +582,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
       GLfloat *tableF;
       GLint i;
 
-      ASSERT(table->FloatTable);
+      ASSERT(table->Type == GL_FLOAT);
 
       _mesa_unpack_float_color_span(ctx, count, table->Format,
                                     tempTab,  /* dest */
@@ -659,7 +653,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
 
 
 /* XXX not tested */
-void
+void GLAPIENTRY
 _mesa_CopyColorTable(GLenum target, GLenum internalformat,
                      GLint x, GLint y, GLsizei width)
 {
@@ -673,7 +667,7 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat,
 
 
 /* XXX not tested */
-void
+void GLAPIENTRY
 _mesa_CopyColorSubTable(GLenum target, GLsizei start,
                         GLint x, GLint y, GLsizei width)
 {
@@ -685,7 +679,7 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start,
 
 
 
-void
+void GLAPIENTRY
 _mesa_GetColorTable( GLenum target, GLenum format,
                      GLenum type, GLvoid *data )
 {
@@ -727,7 +721,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;
@@ -740,11 +734,11 @@ _mesa_GetColorTable( GLenum target, GLenum format,
          return;
    }
 
-   assert(table);
+   ASSERT(table);
 
    switch (table->Format) {
       case GL_ALPHA:
-         if (table->FloatTable) {
+         if (table->Type == GL_FLOAT) {
             const GLfloat *tableF = (const GLfloat *) table->Table;
             GLuint i;
             for (i = 0; i < table->Size; i++) {
@@ -766,7 +760,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
          }
          break;
       case GL_LUMINANCE:
-         if (table->FloatTable) {
+         if (table->Type == GL_FLOAT) {
             const GLfloat *tableF = (const GLfloat *) table->Table;
             GLuint i;
             for (i = 0; i < table->Size; i++) {
@@ -788,7 +782,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
          }
          break;
       case GL_LUMINANCE_ALPHA:
-         if (table->FloatTable) {
+         if (table->Type == GL_FLOAT) {
             const GLfloat *tableF = (const GLfloat *) table->Table;
             GLuint i;
             for (i = 0; i < table->Size; i++) {
@@ -810,7 +804,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
          }
          break;
       case GL_INTENSITY:
-         if (table->FloatTable) {
+         if (table->Type == GL_FLOAT) {
             const GLfloat *tableF = (const GLfloat *) table->Table;
             GLuint i;
             for (i = 0; i < table->Size; i++) {
@@ -832,7 +826,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
          }
          break;
       case GL_RGB:
-         if (table->FloatTable) {
+         if (table->Type == GL_FLOAT) {
             const GLfloat *tableF = (const GLfloat *) table->Table;
             GLuint i;
             for (i = 0; i < table->Size; i++) {
@@ -854,7 +848,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
          }
          break;
       case GL_RGBA:
-         if (table->FloatTable) {
+         if (table->Type == GL_FLOAT) {
             const GLfloat *tableF = (const GLfloat *) table->Table;
             GLuint i;
             for (i = 0; i < table->Size; i++) {
@@ -886,7 +880,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
 
 
 
-void
+void GLAPIENTRY
 _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -917,16 +911,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)");
@@ -979,7 +973,7 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 
 
 
-void
+void GLAPIENTRY
 _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
 {
    GLfloat fparams[4];
@@ -1002,7 +996,7 @@ _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
 
 
 
-void
+void GLAPIENTRY
 _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1073,19 +1067,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 +1088,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;
@@ -1176,7 +1170,7 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
 
 
 
-void
+void GLAPIENTRY
 _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1247,19 +1241,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 +1262,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;
@@ -1347,3 +1341,57 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
          return;
    }
 }
+
+/**********************************************************************/
+/*****                      Initialization                        *****/
+/**********************************************************************/
+
+
+void
+_mesa_init_colortable( struct gl_color_table *p )
+{
+   p->Type = CHAN_TYPE;
+   p->Table = NULL;
+   p->Size = 0;
+   p->IntFormat = GL_RGBA;
+}
+
+
+
+void
+_mesa_free_colortable_data( struct gl_color_table *p )
+{
+   if (p->Table) {
+      FREE(p->Table);
+      p->Table = NULL;
+   }
+}
+
+
+/*
+ * Initialize all colortables for a context.
+ */
+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);
+}
+
+
+/*
+ * Free all colortable data for a context
+ */
+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);
+}