2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #include "bufferobj.h"
36 * Given an internalFormat token passed to glColorTable,
37 * return the corresponding base format.
38 * Return -1 if invalid token.
41 base_colortab_format( GLenum format
)
56 case GL_LUMINANCE_ALPHA
:
57 case GL_LUMINANCE4_ALPHA4
:
58 case GL_LUMINANCE6_ALPHA2
:
59 case GL_LUMINANCE8_ALPHA8
:
60 case GL_LUMINANCE12_ALPHA4
:
61 case GL_LUMINANCE12_ALPHA12
:
62 case GL_LUMINANCE16_ALPHA16
:
63 return GL_LUMINANCE_ALPHA
;
89 return -1; /* error */
96 * Examine table's format and set the component sizes accordingly.
99 set_component_sizes( struct gl_color_table
*table
)
101 /* assuming the ubyte table */
102 const GLubyte sz
= 8;
104 switch (table
->_BaseFormat
) {
107 table
->GreenSize
= 0;
109 table
->AlphaSize
= sz
;
110 table
->IntensitySize
= 0;
111 table
->LuminanceSize
= 0;
115 table
->GreenSize
= 0;
117 table
->AlphaSize
= 0;
118 table
->IntensitySize
= 0;
119 table
->LuminanceSize
= sz
;
121 case GL_LUMINANCE_ALPHA
:
123 table
->GreenSize
= 0;
125 table
->AlphaSize
= sz
;
126 table
->IntensitySize
= 0;
127 table
->LuminanceSize
= sz
;
131 table
->GreenSize
= 0;
133 table
->AlphaSize
= 0;
134 table
->IntensitySize
= sz
;
135 table
->LuminanceSize
= 0;
139 table
->GreenSize
= sz
;
140 table
->BlueSize
= sz
;
141 table
->AlphaSize
= 0;
142 table
->IntensitySize
= 0;
143 table
->LuminanceSize
= 0;
147 table
->GreenSize
= sz
;
148 table
->BlueSize
= sz
;
149 table
->AlphaSize
= sz
;
150 table
->IntensitySize
= 0;
151 table
->LuminanceSize
= 0;
154 _mesa_problem(NULL
, "unexpected format in set_component_sizes");
161 * Update/replace all or part of a color table. Helper function
162 * used by _mesa_ColorTable() and _mesa_ColorSubTable().
163 * The table->Table buffer should already be allocated.
164 * \param start first entry to update
165 * \param count number of entries to update
166 * \param format format of user-provided table data
167 * \param type datatype of user-provided table data
168 * \param data user-provided table data
169 * \param [rgba]Scale - RGBA scale factors
170 * \param [rgba]Bias - RGBA bias factors
173 store_colortable_entries(GLcontext
*ctx
, struct gl_color_table
*table
,
174 GLsizei start
, GLsizei count
,
175 GLenum format
, GLenum type
, const GLvoid
*data
,
176 GLfloat rScale
, GLfloat rBias
,
177 GLfloat gScale
, GLfloat gBias
,
178 GLfloat bScale
, GLfloat bBias
,
179 GLfloat aScale
, GLfloat aBias
)
181 if (ctx
->Unpack
.BufferObj
->Name
) {
182 /* Get/unpack the color table data from a PBO */
184 if (!_mesa_validate_pbo_access(1, &ctx
->Unpack
, count
, 1, 1,
185 format
, type
, data
)) {
186 _mesa_error(ctx
, GL_INVALID_OPERATION
,
187 "glColor[Sub]Table(bad PBO access)");
190 buf
= (GLubyte
*) ctx
->Driver
.MapBuffer(ctx
, GL_PIXEL_UNPACK_BUFFER_EXT
,
192 ctx
->Unpack
.BufferObj
);
194 _mesa_error(ctx
, GL_INVALID_OPERATION
,
195 "glColor[Sub]Table(PBO mapped)");
198 data
= ADD_POINTERS(buf
, data
);
203 /* convert user-provided data to GLfloat values */
204 GLfloat tempTab
[MAX_COLOR_TABLE_SIZE
* 4];
208 _mesa_unpack_color_span_float(ctx
,
209 count
, /* number of pixels */
210 table
->_BaseFormat
, /* dest format */
211 tempTab
, /* dest address */
212 format
, type
, /* src format/type */
215 IMAGE_CLAMP_BIT
); /* transfer ops */
217 /* the destination */
218 tableF
= table
->TableF
;
220 /* Apply scale & bias & clamp now */
221 switch (table
->_BaseFormat
) {
223 for (i
= 0; i
< count
; i
++) {
224 GLuint j
= start
+ i
;
225 tableF
[j
] = CLAMP(tempTab
[i
] * rScale
+ rBias
, 0.0F
, 1.0F
);
229 for (i
= 0; i
< count
; i
++) {
230 GLuint j
= start
+ i
;
231 tableF
[j
] = CLAMP(tempTab
[i
] * rScale
+ rBias
, 0.0F
, 1.0F
);
235 for (i
= 0; i
< count
; i
++) {
236 GLuint j
= start
+ i
;
237 tableF
[j
] = CLAMP(tempTab
[i
] * aScale
+ aBias
, 0.0F
, 1.0F
);
240 case GL_LUMINANCE_ALPHA
:
241 for (i
= 0; i
< count
; i
++) {
242 GLuint j
= start
+ i
;
243 tableF
[j
*2+0] = CLAMP(tempTab
[i
*2+0] * rScale
+ rBias
, 0.0F
, 1.0F
);
244 tableF
[j
*2+1] = CLAMP(tempTab
[i
*2+1] * aScale
+ aBias
, 0.0F
, 1.0F
);
248 for (i
= 0; i
< count
; i
++) {
249 GLuint j
= start
+ i
;
250 tableF
[j
*3+0] = CLAMP(tempTab
[i
*3+0] * rScale
+ rBias
, 0.0F
, 1.0F
);
251 tableF
[j
*3+1] = CLAMP(tempTab
[i
*3+1] * gScale
+ gBias
, 0.0F
, 1.0F
);
252 tableF
[j
*3+2] = CLAMP(tempTab
[i
*3+2] * bScale
+ bBias
, 0.0F
, 1.0F
);
256 for (i
= 0; i
< count
; i
++) {
257 GLuint j
= start
+ i
;
258 tableF
[j
*4+0] = CLAMP(tempTab
[i
*4+0] * rScale
+ rBias
, 0.0F
, 1.0F
);
259 tableF
[j
*4+1] = CLAMP(tempTab
[i
*4+1] * gScale
+ gBias
, 0.0F
, 1.0F
);
260 tableF
[j
*4+2] = CLAMP(tempTab
[i
*4+2] * bScale
+ bBias
, 0.0F
, 1.0F
);
261 tableF
[j
*4+3] = CLAMP(tempTab
[i
*4+3] * aScale
+ aBias
, 0.0F
, 1.0F
);
265 _mesa_problem(ctx
, "Bad format in store_colortable_entries");
270 /* update the ubyte table */
272 const GLint comps
= _mesa_components_in_format(table
->_BaseFormat
);
273 const GLfloat
*tableF
= table
->TableF
+ start
* comps
;
274 GLubyte
*tableUB
= table
->TableUB
+ start
* comps
;
276 for (i
= 0; i
< count
* comps
; i
++) {
277 CLAMPED_FLOAT_TO_UBYTE(tableUB
[i
], tableF
[i
]);
281 if (ctx
->Unpack
.BufferObj
->Name
) {
282 ctx
->Driver
.UnmapBuffer(ctx
, GL_PIXEL_UNPACK_BUFFER_EXT
,
283 ctx
->Unpack
.BufferObj
);
290 _mesa_ColorTable( GLenum target
, GLenum internalFormat
,
291 GLsizei width
, GLenum format
, GLenum type
,
294 GET_CURRENT_CONTEXT(ctx
);
295 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
296 struct gl_texture_object
*texObj
= NULL
;
297 struct gl_color_table
*table
= NULL
;
298 GLboolean proxy
= GL_FALSE
;
300 GLfloat rScale
= 1.0, gScale
= 1.0, bScale
= 1.0, aScale
= 1.0;
301 GLfloat rBias
= 0.0, gBias
= 0.0, bBias
= 0.0, aBias
= 0.0;
303 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
); /* too complex */
307 texObj
= texUnit
->Current1D
;
308 table
= &texObj
->Palette
;
311 texObj
= texUnit
->Current2D
;
312 table
= &texObj
->Palette
;
315 texObj
= texUnit
->Current3D
;
316 table
= &texObj
->Palette
;
318 case GL_TEXTURE_CUBE_MAP_ARB
:
319 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
320 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTable(target)");
323 texObj
= texUnit
->CurrentCubeMap
;
324 table
= &texObj
->Palette
;
326 case GL_PROXY_TEXTURE_1D
:
327 texObj
= ctx
->Texture
.Proxy1D
;
328 table
= &texObj
->Palette
;
331 case GL_PROXY_TEXTURE_2D
:
332 texObj
= ctx
->Texture
.Proxy2D
;
333 table
= &texObj
->Palette
;
336 case GL_PROXY_TEXTURE_3D
:
337 texObj
= ctx
->Texture
.Proxy3D
;
338 table
= &texObj
->Palette
;
341 case GL_PROXY_TEXTURE_CUBE_MAP_ARB
:
342 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
343 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTable(target)");
346 texObj
= ctx
->Texture
.ProxyCubeMap
;
347 table
= &texObj
->Palette
;
349 case GL_SHARED_TEXTURE_PALETTE_EXT
:
350 table
= &ctx
->Texture
.Palette
;
353 table
= &ctx
->ColorTable
;
354 rScale
= ctx
->Pixel
.ColorTableScale
[0];
355 gScale
= ctx
->Pixel
.ColorTableScale
[1];
356 bScale
= ctx
->Pixel
.ColorTableScale
[2];
357 aScale
= ctx
->Pixel
.ColorTableScale
[3];
358 rBias
= ctx
->Pixel
.ColorTableBias
[0];
359 gBias
= ctx
->Pixel
.ColorTableBias
[1];
360 bBias
= ctx
->Pixel
.ColorTableBias
[2];
361 aBias
= ctx
->Pixel
.ColorTableBias
[3];
363 case GL_PROXY_COLOR_TABLE
:
364 table
= &ctx
->ProxyColorTable
;
367 case GL_TEXTURE_COLOR_TABLE_SGI
:
368 if (!ctx
->Extensions
.SGI_texture_color_table
) {
369 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTable(target)");
372 table
= &(texUnit
->ColorTable
);
373 rScale
= ctx
->Pixel
.TextureColorTableScale
[0];
374 gScale
= ctx
->Pixel
.TextureColorTableScale
[1];
375 bScale
= ctx
->Pixel
.TextureColorTableScale
[2];
376 aScale
= ctx
->Pixel
.TextureColorTableScale
[3];
377 rBias
= ctx
->Pixel
.TextureColorTableBias
[0];
378 gBias
= ctx
->Pixel
.TextureColorTableBias
[1];
379 bBias
= ctx
->Pixel
.TextureColorTableBias
[2];
380 aBias
= ctx
->Pixel
.TextureColorTableBias
[3];
382 case GL_PROXY_TEXTURE_COLOR_TABLE_SGI
:
383 if (!ctx
->Extensions
.SGI_texture_color_table
) {
384 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTable(target)");
387 table
= &(texUnit
->ProxyColorTable
);
390 case GL_POST_CONVOLUTION_COLOR_TABLE
:
391 table
= &ctx
->PostConvolutionColorTable
;
392 rScale
= ctx
->Pixel
.PCCTscale
[0];
393 gScale
= ctx
->Pixel
.PCCTscale
[1];
394 bScale
= ctx
->Pixel
.PCCTscale
[2];
395 aScale
= ctx
->Pixel
.PCCTscale
[3];
396 rBias
= ctx
->Pixel
.PCCTbias
[0];
397 gBias
= ctx
->Pixel
.PCCTbias
[1];
398 bBias
= ctx
->Pixel
.PCCTbias
[2];
399 aBias
= ctx
->Pixel
.PCCTbias
[3];
401 case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE
:
402 table
= &ctx
->ProxyPostConvolutionColorTable
;
405 case GL_POST_COLOR_MATRIX_COLOR_TABLE
:
406 table
= &ctx
->PostColorMatrixColorTable
;
407 rScale
= ctx
->Pixel
.PCMCTscale
[0];
408 gScale
= ctx
->Pixel
.PCMCTscale
[1];
409 bScale
= ctx
->Pixel
.PCMCTscale
[2];
410 aScale
= ctx
->Pixel
.PCMCTscale
[3];
411 rBias
= ctx
->Pixel
.PCMCTbias
[0];
412 gBias
= ctx
->Pixel
.PCMCTbias
[1];
413 bBias
= ctx
->Pixel
.PCMCTbias
[2];
414 aBias
= ctx
->Pixel
.PCMCTbias
[3];
416 case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE
:
417 table
= &ctx
->ProxyPostColorMatrixColorTable
;
421 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTable(target)");
427 if (!_mesa_is_legal_format_and_type(ctx
, format
, type
) ||
428 format
== GL_INTENSITY
) {
429 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glColorTable(format or type)");
433 baseFormat
= base_colortab_format(internalFormat
);
434 if (baseFormat
< 0) {
435 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTable(internalFormat)");
439 if (width
< 0 || (width
!= 0 && _mesa_bitcount(width
) != 1)) {
443 table
->InternalFormat
= (GLenum
) 0;
444 table
->_BaseFormat
= (GLenum
) 0;
447 _mesa_error(ctx
, GL_INVALID_VALUE
, "glColorTable(width=%d)", width
);
452 if (width
> (GLsizei
) ctx
->Const
.MaxColorTableSize
) {
455 table
->InternalFormat
= (GLenum
) 0;
456 table
->_BaseFormat
= (GLenum
) 0;
459 _mesa_error(ctx
, GL_TABLE_TOO_LARGE
, "glColorTable(width)");
465 table
->InternalFormat
= internalFormat
;
466 table
->_BaseFormat
= (GLenum
) baseFormat
;
468 comps
= _mesa_components_in_format(table
->_BaseFormat
);
469 assert(comps
> 0); /* error should have been caught sooner */
472 _mesa_free_colortable_data(table
);
475 table
->TableF
= (GLfloat
*) _mesa_malloc(comps
* width
* sizeof(GLfloat
));
476 table
->TableUB
= (GLubyte
*) _mesa_malloc(comps
* width
* sizeof(GLubyte
));
478 if (!table
->TableF
|| !table
->TableUB
) {
479 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glColorTable");
483 store_colortable_entries(ctx
, table
,
484 0, width
, /* start, count */
493 /* do this after the table's Type and Format are set */
494 set_component_sizes(table
);
496 if (texObj
|| target
== GL_SHARED_TEXTURE_PALETTE_EXT
) {
497 /* texture object palette, texObj==NULL means the shared palette */
498 if (ctx
->Driver
.UpdateTexturePalette
) {
499 (*ctx
->Driver
.UpdateTexturePalette
)( ctx
, texObj
);
503 ctx
->NewState
|= _NEW_PIXEL
;
509 _mesa_ColorSubTable( GLenum target
, GLsizei start
,
510 GLsizei count
, GLenum format
, GLenum type
,
513 GET_CURRENT_CONTEXT(ctx
);
514 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
515 struct gl_texture_object
*texObj
= NULL
;
516 struct gl_color_table
*table
= NULL
;
517 GLfloat rScale
= 1.0, gScale
= 1.0, bScale
= 1.0, aScale
= 1.0;
518 GLfloat rBias
= 0.0, gBias
= 0.0, bBias
= 0.0, aBias
= 0.0;
519 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
523 texObj
= texUnit
->Current1D
;
524 table
= &texObj
->Palette
;
527 texObj
= texUnit
->Current2D
;
528 table
= &texObj
->Palette
;
531 texObj
= texUnit
->Current3D
;
532 table
= &texObj
->Palette
;
534 case GL_TEXTURE_CUBE_MAP_ARB
:
535 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
536 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorSubTable(target)");
539 texObj
= texUnit
->CurrentCubeMap
;
540 table
= &texObj
->Palette
;
542 case GL_SHARED_TEXTURE_PALETTE_EXT
:
543 table
= &ctx
->Texture
.Palette
;
546 table
= &ctx
->ColorTable
;
547 rScale
= ctx
->Pixel
.ColorTableScale
[0];
548 gScale
= ctx
->Pixel
.ColorTableScale
[1];
549 bScale
= ctx
->Pixel
.ColorTableScale
[2];
550 aScale
= ctx
->Pixel
.ColorTableScale
[3];
551 rBias
= ctx
->Pixel
.ColorTableBias
[0];
552 gBias
= ctx
->Pixel
.ColorTableBias
[1];
553 bBias
= ctx
->Pixel
.ColorTableBias
[2];
554 aBias
= ctx
->Pixel
.ColorTableBias
[3];
556 case GL_TEXTURE_COLOR_TABLE_SGI
:
557 if (!ctx
->Extensions
.SGI_texture_color_table
) {
558 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorSubTable(target)");
561 table
= &(texUnit
->ColorTable
);
562 rScale
= ctx
->Pixel
.TextureColorTableScale
[0];
563 gScale
= ctx
->Pixel
.TextureColorTableScale
[1];
564 bScale
= ctx
->Pixel
.TextureColorTableScale
[2];
565 aScale
= ctx
->Pixel
.TextureColorTableScale
[3];
566 rBias
= ctx
->Pixel
.TextureColorTableBias
[0];
567 gBias
= ctx
->Pixel
.TextureColorTableBias
[1];
568 bBias
= ctx
->Pixel
.TextureColorTableBias
[2];
569 aBias
= ctx
->Pixel
.TextureColorTableBias
[3];
571 case GL_POST_CONVOLUTION_COLOR_TABLE
:
572 table
= &ctx
->PostConvolutionColorTable
;
573 rScale
= ctx
->Pixel
.PCCTscale
[0];
574 gScale
= ctx
->Pixel
.PCCTscale
[1];
575 bScale
= ctx
->Pixel
.PCCTscale
[2];
576 aScale
= ctx
->Pixel
.PCCTscale
[3];
577 rBias
= ctx
->Pixel
.PCCTbias
[0];
578 gBias
= ctx
->Pixel
.PCCTbias
[1];
579 bBias
= ctx
->Pixel
.PCCTbias
[2];
580 aBias
= ctx
->Pixel
.PCCTbias
[3];
582 case GL_POST_COLOR_MATRIX_COLOR_TABLE
:
583 table
= &ctx
->PostColorMatrixColorTable
;
584 rScale
= ctx
->Pixel
.PCMCTscale
[0];
585 gScale
= ctx
->Pixel
.PCMCTscale
[1];
586 bScale
= ctx
->Pixel
.PCMCTscale
[2];
587 aScale
= ctx
->Pixel
.PCMCTscale
[3];
588 rBias
= ctx
->Pixel
.PCMCTbias
[0];
589 gBias
= ctx
->Pixel
.PCMCTbias
[1];
590 bBias
= ctx
->Pixel
.PCMCTbias
[2];
591 aBias
= ctx
->Pixel
.PCMCTbias
[3];
594 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorSubTable(target)");
600 if (!_mesa_is_legal_format_and_type(ctx
, format
, type
) ||
601 format
== GL_INTENSITY
) {
602 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glColorSubTable(format or type)");
607 _mesa_error(ctx
, GL_INVALID_VALUE
, "glColorSubTable(count)");
611 /* error should have been caught sooner */
612 assert(_mesa_components_in_format(table
->_BaseFormat
) > 0);
614 if (start
+ count
> (GLint
) table
->Size
) {
615 _mesa_error(ctx
, GL_INVALID_VALUE
, "glColorSubTable(count)");
619 if (!table
->TableF
|| !table
->TableUB
) {
620 /* a GL_OUT_OF_MEMORY error would have been recorded previously */
624 store_colortable_entries(ctx
, table
, start
, count
,
631 if (texObj
|| target
== GL_SHARED_TEXTURE_PALETTE_EXT
) {
632 /* per-texture object palette */
633 if (ctx
->Driver
.UpdateTexturePalette
) {
634 (*ctx
->Driver
.UpdateTexturePalette
)( ctx
, texObj
);
638 ctx
->NewState
|= _NEW_PIXEL
;
644 _mesa_CopyColorTable(GLenum target
, GLenum internalformat
,
645 GLint x
, GLint y
, GLsizei width
)
647 GET_CURRENT_CONTEXT(ctx
);
648 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
650 /* Select buffer to read from */
651 ctx
->Driver
.CopyColorTable( ctx
, target
, internalformat
, x
, y
, width
);
657 _mesa_CopyColorSubTable(GLenum target
, GLsizei start
,
658 GLint x
, GLint y
, GLsizei width
)
660 GET_CURRENT_CONTEXT(ctx
);
661 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
663 ctx
->Driver
.CopyColorSubTable( ctx
, target
, start
, x
, y
, width
);
669 _mesa_GetColorTable( GLenum target
, GLenum format
,
670 GLenum type
, GLvoid
*data
)
672 GET_CURRENT_CONTEXT(ctx
);
673 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
674 struct gl_color_table
*table
= NULL
;
675 GLfloat rgba
[MAX_COLOR_TABLE_SIZE
][4];
676 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
679 _mesa_update_state(ctx
);
684 table
= &texUnit
->Current1D
->Palette
;
687 table
= &texUnit
->Current2D
->Palette
;
690 table
= &texUnit
->Current3D
->Palette
;
692 case GL_TEXTURE_CUBE_MAP_ARB
:
693 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
694 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTable(target)");
697 table
= &texUnit
->CurrentCubeMap
->Palette
;
699 case GL_SHARED_TEXTURE_PALETTE_EXT
:
700 table
= &ctx
->Texture
.Palette
;
703 table
= &ctx
->ColorTable
;
705 case GL_TEXTURE_COLOR_TABLE_SGI
:
706 if (!ctx
->Extensions
.SGI_texture_color_table
) {
707 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTable(target)");
710 table
= &(texUnit
->ColorTable
);
712 case GL_POST_CONVOLUTION_COLOR_TABLE
:
713 table
= &ctx
->PostConvolutionColorTable
;
715 case GL_POST_COLOR_MATRIX_COLOR_TABLE
:
716 table
= &ctx
->PostColorMatrixColorTable
;
719 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTable(target)");
725 if (table
->Size
<= 0) {
729 switch (table
->_BaseFormat
) {
733 for (i
= 0; i
< table
->Size
; i
++) {
737 rgba
[i
][ACOMP
] = table
->TableF
[i
];
744 for (i
= 0; i
< table
->Size
; i
++) {
747 rgba
[i
][BCOMP
] = table
->TableF
[i
];
748 rgba
[i
][ACOMP
] = 1.0F
;
752 case GL_LUMINANCE_ALPHA
:
755 for (i
= 0; i
< table
->Size
; i
++) {
758 rgba
[i
][BCOMP
] = table
->TableF
[i
*2+0];
759 rgba
[i
][ACOMP
] = table
->TableF
[i
*2+1];
766 for (i
= 0; i
< table
->Size
; i
++) {
770 rgba
[i
][ACOMP
] = table
->TableF
[i
];
777 for (i
= 0; i
< table
->Size
; i
++) {
778 rgba
[i
][RCOMP
] = table
->TableF
[i
*3+0];
779 rgba
[i
][GCOMP
] = table
->TableF
[i
*3+1];
780 rgba
[i
][BCOMP
] = table
->TableF
[i
*3+2];
781 rgba
[i
][ACOMP
] = 1.0F
;
786 _mesa_memcpy(rgba
, table
->TableF
, 4 * table
->Size
* sizeof(GLfloat
));
789 _mesa_problem(ctx
, "bad table format in glGetColorTable");
793 if (ctx
->Pack
.BufferObj
->Name
) {
794 /* pack color table into PBO */
796 if (!_mesa_validate_pbo_access(1, &ctx
->Pack
, table
->Size
, 1, 1,
797 format
, type
, data
)) {
798 _mesa_error(ctx
, GL_INVALID_OPERATION
,
799 "glGetColorTable(invalid PBO access)");
802 buf
= (GLubyte
*) ctx
->Driver
.MapBuffer(ctx
, GL_PIXEL_PACK_BUFFER_EXT
,
804 ctx
->Pack
.BufferObj
);
806 /* buffer is already mapped - that's an error */
807 _mesa_error(ctx
, GL_INVALID_OPERATION
,
808 "glGetColorTable(PBO is mapped)");
811 data
= ADD_POINTERS(buf
, data
);
814 _mesa_pack_rgba_span_float(ctx
, table
->Size
, rgba
,
815 format
, type
, data
, &ctx
->Pack
, 0x0);
817 if (ctx
->Pack
.BufferObj
->Name
) {
818 ctx
->Driver
.UnmapBuffer(ctx
, GL_PIXEL_PACK_BUFFER_EXT
,
819 ctx
->Pack
.BufferObj
);
826 _mesa_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
828 GET_CURRENT_CONTEXT(ctx
);
829 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
832 case GL_COLOR_TABLE_SGI
:
833 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
834 ctx
->Pixel
.ColorTableScale
[0] = params
[0];
835 ctx
->Pixel
.ColorTableScale
[1] = params
[1];
836 ctx
->Pixel
.ColorTableScale
[2] = params
[2];
837 ctx
->Pixel
.ColorTableScale
[3] = params
[3];
839 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
840 ctx
->Pixel
.ColorTableBias
[0] = params
[0];
841 ctx
->Pixel
.ColorTableBias
[1] = params
[1];
842 ctx
->Pixel
.ColorTableBias
[2] = params
[2];
843 ctx
->Pixel
.ColorTableBias
[3] = params
[3];
846 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameterfv(pname)");
850 case GL_TEXTURE_COLOR_TABLE_SGI
:
851 if (!ctx
->Extensions
.SGI_texture_color_table
) {
852 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameter(target)");
855 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
856 ctx
->Pixel
.TextureColorTableScale
[0] = params
[0];
857 ctx
->Pixel
.TextureColorTableScale
[1] = params
[1];
858 ctx
->Pixel
.TextureColorTableScale
[2] = params
[2];
859 ctx
->Pixel
.TextureColorTableScale
[3] = params
[3];
861 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
862 ctx
->Pixel
.TextureColorTableBias
[0] = params
[0];
863 ctx
->Pixel
.TextureColorTableBias
[1] = params
[1];
864 ctx
->Pixel
.TextureColorTableBias
[2] = params
[2];
865 ctx
->Pixel
.TextureColorTableBias
[3] = params
[3];
868 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameterfv(pname)");
872 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI
:
873 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
874 ctx
->Pixel
.PCCTscale
[0] = params
[0];
875 ctx
->Pixel
.PCCTscale
[1] = params
[1];
876 ctx
->Pixel
.PCCTscale
[2] = params
[2];
877 ctx
->Pixel
.PCCTscale
[3] = params
[3];
879 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
880 ctx
->Pixel
.PCCTbias
[0] = params
[0];
881 ctx
->Pixel
.PCCTbias
[1] = params
[1];
882 ctx
->Pixel
.PCCTbias
[2] = params
[2];
883 ctx
->Pixel
.PCCTbias
[3] = params
[3];
886 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameterfv(pname)");
890 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
:
891 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
892 ctx
->Pixel
.PCMCTscale
[0] = params
[0];
893 ctx
->Pixel
.PCMCTscale
[1] = params
[1];
894 ctx
->Pixel
.PCMCTscale
[2] = params
[2];
895 ctx
->Pixel
.PCMCTscale
[3] = params
[3];
897 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
898 ctx
->Pixel
.PCMCTbias
[0] = params
[0];
899 ctx
->Pixel
.PCMCTbias
[1] = params
[1];
900 ctx
->Pixel
.PCMCTbias
[2] = params
[2];
901 ctx
->Pixel
.PCMCTbias
[3] = params
[3];
904 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameterfv(pname)");
909 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameter(target)");
913 ctx
->NewState
|= _NEW_PIXEL
;
919 _mesa_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
922 if (pname
== GL_COLOR_TABLE_SGI
||
923 pname
== GL_TEXTURE_COLOR_TABLE_SGI
||
924 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
925 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
927 fparams
[0] = (GLfloat
) params
[0];
928 fparams
[1] = (GLfloat
) params
[1];
929 fparams
[2] = (GLfloat
) params
[2];
930 fparams
[3] = (GLfloat
) params
[3];
934 fparams
[0] = (GLfloat
) params
[0];
936 _mesa_ColorTableParameterfv(target
, pname
, fparams
);
942 _mesa_GetColorTableParameterfv( GLenum target
, GLenum pname
, GLfloat
*params
)
944 GET_CURRENT_CONTEXT(ctx
);
945 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
946 struct gl_color_table
*table
= NULL
;
947 ASSERT_OUTSIDE_BEGIN_END(ctx
);
951 table
= &texUnit
->Current1D
->Palette
;
954 table
= &texUnit
->Current2D
->Palette
;
957 table
= &texUnit
->Current3D
->Palette
;
959 case GL_TEXTURE_CUBE_MAP_ARB
:
960 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
961 _mesa_error(ctx
, GL_INVALID_ENUM
,
962 "glGetColorTableParameterfv(target)");
965 table
= &texUnit
->CurrentCubeMap
->Palette
;
967 case GL_PROXY_TEXTURE_1D
:
968 table
= &ctx
->Texture
.Proxy1D
->Palette
;
970 case GL_PROXY_TEXTURE_2D
:
971 table
= &ctx
->Texture
.Proxy2D
->Palette
;
973 case GL_PROXY_TEXTURE_3D
:
974 table
= &ctx
->Texture
.Proxy3D
->Palette
;
976 case GL_PROXY_TEXTURE_CUBE_MAP_ARB
:
977 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
978 _mesa_error(ctx
, GL_INVALID_ENUM
,
979 "glGetColorTableParameterfv(target)");
982 table
= &ctx
->Texture
.ProxyCubeMap
->Palette
;
984 case GL_SHARED_TEXTURE_PALETTE_EXT
:
985 table
= &ctx
->Texture
.Palette
;
988 table
= &ctx
->ColorTable
;
989 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
990 params
[0] = ctx
->Pixel
.ColorTableScale
[0];
991 params
[1] = ctx
->Pixel
.ColorTableScale
[1];
992 params
[2] = ctx
->Pixel
.ColorTableScale
[2];
993 params
[3] = ctx
->Pixel
.ColorTableScale
[3];
996 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
997 params
[0] = ctx
->Pixel
.ColorTableBias
[0];
998 params
[1] = ctx
->Pixel
.ColorTableBias
[1];
999 params
[2] = ctx
->Pixel
.ColorTableBias
[2];
1000 params
[3] = ctx
->Pixel
.ColorTableBias
[3];
1004 case GL_PROXY_COLOR_TABLE
:
1005 table
= &ctx
->ProxyColorTable
;
1007 case GL_TEXTURE_COLOR_TABLE_SGI
:
1008 if (!ctx
->Extensions
.SGI_texture_color_table
) {
1009 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameter(target)");
1012 table
= &(texUnit
->ColorTable
);
1013 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1014 params
[0] = ctx
->Pixel
.TextureColorTableScale
[0];
1015 params
[1] = ctx
->Pixel
.TextureColorTableScale
[1];
1016 params
[2] = ctx
->Pixel
.TextureColorTableScale
[2];
1017 params
[3] = ctx
->Pixel
.TextureColorTableScale
[3];
1020 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1021 params
[0] = ctx
->Pixel
.TextureColorTableBias
[0];
1022 params
[1] = ctx
->Pixel
.TextureColorTableBias
[1];
1023 params
[2] = ctx
->Pixel
.TextureColorTableBias
[2];
1024 params
[3] = ctx
->Pixel
.TextureColorTableBias
[3];
1028 case GL_PROXY_TEXTURE_COLOR_TABLE_SGI
:
1029 if (!ctx
->Extensions
.SGI_texture_color_table
) {
1030 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameter(target)");
1033 table
= &(texUnit
->ProxyColorTable
);
1035 case GL_POST_CONVOLUTION_COLOR_TABLE
:
1036 table
= &ctx
->PostConvolutionColorTable
;
1037 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1038 params
[0] = ctx
->Pixel
.PCCTscale
[0];
1039 params
[1] = ctx
->Pixel
.PCCTscale
[1];
1040 params
[2] = ctx
->Pixel
.PCCTscale
[2];
1041 params
[3] = ctx
->Pixel
.PCCTscale
[3];
1044 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1045 params
[0] = ctx
->Pixel
.PCCTbias
[0];
1046 params
[1] = ctx
->Pixel
.PCCTbias
[1];
1047 params
[2] = ctx
->Pixel
.PCCTbias
[2];
1048 params
[3] = ctx
->Pixel
.PCCTbias
[3];
1052 case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE
:
1053 table
= &ctx
->ProxyPostConvolutionColorTable
;
1055 case GL_POST_COLOR_MATRIX_COLOR_TABLE
:
1056 table
= &ctx
->PostColorMatrixColorTable
;
1057 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1058 params
[0] = ctx
->Pixel
.PCMCTscale
[0];
1059 params
[1] = ctx
->Pixel
.PCMCTscale
[1];
1060 params
[2] = ctx
->Pixel
.PCMCTscale
[2];
1061 params
[3] = ctx
->Pixel
.PCMCTscale
[3];
1064 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1065 params
[0] = ctx
->Pixel
.PCMCTbias
[0];
1066 params
[1] = ctx
->Pixel
.PCMCTbias
[1];
1067 params
[2] = ctx
->Pixel
.PCMCTbias
[2];
1068 params
[3] = ctx
->Pixel
.PCMCTbias
[3];
1072 case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE
:
1073 table
= &ctx
->ProxyPostColorMatrixColorTable
;
1076 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameterfv(target)");
1083 case GL_COLOR_TABLE_FORMAT
:
1084 *params
= (GLfloat
) table
->InternalFormat
;
1086 case GL_COLOR_TABLE_WIDTH
:
1087 *params
= (GLfloat
) table
->Size
;
1089 case GL_COLOR_TABLE_RED_SIZE
:
1090 *params
= (GLfloat
) table
->RedSize
;
1092 case GL_COLOR_TABLE_GREEN_SIZE
:
1093 *params
= (GLfloat
) table
->GreenSize
;
1095 case GL_COLOR_TABLE_BLUE_SIZE
:
1096 *params
= (GLfloat
) table
->BlueSize
;
1098 case GL_COLOR_TABLE_ALPHA_SIZE
:
1099 *params
= (GLfloat
) table
->AlphaSize
;
1101 case GL_COLOR_TABLE_LUMINANCE_SIZE
:
1102 *params
= (GLfloat
) table
->LuminanceSize
;
1104 case GL_COLOR_TABLE_INTENSITY_SIZE
:
1105 *params
= (GLfloat
) table
->IntensitySize
;
1108 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameterfv(pname)" );
1116 _mesa_GetColorTableParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
1118 GET_CURRENT_CONTEXT(ctx
);
1119 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1120 struct gl_color_table
*table
= NULL
;
1121 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1125 table
= &texUnit
->Current1D
->Palette
;
1128 table
= &texUnit
->Current2D
->Palette
;
1131 table
= &texUnit
->Current3D
->Palette
;
1133 case GL_TEXTURE_CUBE_MAP_ARB
:
1134 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
1135 _mesa_error(ctx
, GL_INVALID_ENUM
,
1136 "glGetColorTableParameteriv(target)");
1139 table
= &texUnit
->CurrentCubeMap
->Palette
;
1141 case GL_PROXY_TEXTURE_1D
:
1142 table
= &ctx
->Texture
.Proxy1D
->Palette
;
1144 case GL_PROXY_TEXTURE_2D
:
1145 table
= &ctx
->Texture
.Proxy2D
->Palette
;
1147 case GL_PROXY_TEXTURE_3D
:
1148 table
= &ctx
->Texture
.Proxy3D
->Palette
;
1150 case GL_PROXY_TEXTURE_CUBE_MAP_ARB
:
1151 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
1152 _mesa_error(ctx
, GL_INVALID_ENUM
,
1153 "glGetColorTableParameteriv(target)");
1156 table
= &ctx
->Texture
.ProxyCubeMap
->Palette
;
1158 case GL_SHARED_TEXTURE_PALETTE_EXT
:
1159 table
= &ctx
->Texture
.Palette
;
1161 case GL_COLOR_TABLE
:
1162 table
= &ctx
->ColorTable
;
1163 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1164 params
[0] = (GLint
) ctx
->Pixel
.ColorTableScale
[0];
1165 params
[1] = (GLint
) ctx
->Pixel
.ColorTableScale
[1];
1166 params
[2] = (GLint
) ctx
->Pixel
.ColorTableScale
[2];
1167 params
[3] = (GLint
) ctx
->Pixel
.ColorTableScale
[3];
1170 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1171 params
[0] = (GLint
) ctx
->Pixel
.ColorTableBias
[0];
1172 params
[1] = (GLint
) ctx
->Pixel
.ColorTableBias
[1];
1173 params
[2] = (GLint
) ctx
->Pixel
.ColorTableBias
[2];
1174 params
[3] = (GLint
) ctx
->Pixel
.ColorTableBias
[3];
1178 case GL_PROXY_COLOR_TABLE
:
1179 table
= &ctx
->ProxyColorTable
;
1181 case GL_TEXTURE_COLOR_TABLE_SGI
:
1182 if (!ctx
->Extensions
.SGI_texture_color_table
) {
1183 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameter(target)");
1186 table
= &(texUnit
->ColorTable
);
1187 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1188 params
[0] = (GLint
) ctx
->Pixel
.TextureColorTableScale
[0];
1189 params
[1] = (GLint
) ctx
->Pixel
.TextureColorTableScale
[1];
1190 params
[2] = (GLint
) ctx
->Pixel
.TextureColorTableScale
[2];
1191 params
[3] = (GLint
) ctx
->Pixel
.TextureColorTableScale
[3];
1194 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1195 params
[0] = (GLint
) ctx
->Pixel
.TextureColorTableBias
[0];
1196 params
[1] = (GLint
) ctx
->Pixel
.TextureColorTableBias
[1];
1197 params
[2] = (GLint
) ctx
->Pixel
.TextureColorTableBias
[2];
1198 params
[3] = (GLint
) ctx
->Pixel
.TextureColorTableBias
[3];
1202 case GL_PROXY_TEXTURE_COLOR_TABLE_SGI
:
1203 if (!ctx
->Extensions
.SGI_texture_color_table
) {
1204 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameter(target)");
1207 table
= &(texUnit
->ProxyColorTable
);
1209 case GL_POST_CONVOLUTION_COLOR_TABLE
:
1210 table
= &ctx
->PostConvolutionColorTable
;
1211 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1212 params
[0] = (GLint
) ctx
->Pixel
.PCCTscale
[0];
1213 params
[1] = (GLint
) ctx
->Pixel
.PCCTscale
[1];
1214 params
[2] = (GLint
) ctx
->Pixel
.PCCTscale
[2];
1215 params
[3] = (GLint
) ctx
->Pixel
.PCCTscale
[3];
1218 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1219 params
[0] = (GLint
) ctx
->Pixel
.PCCTbias
[0];
1220 params
[1] = (GLint
) ctx
->Pixel
.PCCTbias
[1];
1221 params
[2] = (GLint
) ctx
->Pixel
.PCCTbias
[2];
1222 params
[3] = (GLint
) ctx
->Pixel
.PCCTbias
[3];
1226 case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE
:
1227 table
= &ctx
->ProxyPostConvolutionColorTable
;
1229 case GL_POST_COLOR_MATRIX_COLOR_TABLE
:
1230 table
= &ctx
->PostColorMatrixColorTable
;
1231 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1232 params
[0] = (GLint
) ctx
->Pixel
.PCMCTscale
[0];
1233 params
[1] = (GLint
) ctx
->Pixel
.PCMCTscale
[1];
1234 params
[2] = (GLint
) ctx
->Pixel
.PCMCTscale
[2];
1235 params
[3] = (GLint
) ctx
->Pixel
.PCMCTscale
[3];
1238 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1239 params
[0] = (GLint
) ctx
->Pixel
.PCMCTbias
[0];
1240 params
[1] = (GLint
) ctx
->Pixel
.PCMCTbias
[1];
1241 params
[2] = (GLint
) ctx
->Pixel
.PCMCTbias
[2];
1242 params
[3] = (GLint
) ctx
->Pixel
.PCMCTbias
[3];
1246 case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE
:
1247 table
= &ctx
->ProxyPostColorMatrixColorTable
;
1250 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameteriv(target)");
1257 case GL_COLOR_TABLE_FORMAT
:
1258 *params
= table
->InternalFormat
;
1260 case GL_COLOR_TABLE_WIDTH
:
1261 *params
= table
->Size
;
1263 case GL_COLOR_TABLE_RED_SIZE
:
1264 *params
= table
->RedSize
;
1266 case GL_COLOR_TABLE_GREEN_SIZE
:
1267 *params
= table
->GreenSize
;
1269 case GL_COLOR_TABLE_BLUE_SIZE
:
1270 *params
= table
->BlueSize
;
1272 case GL_COLOR_TABLE_ALPHA_SIZE
:
1273 *params
= table
->AlphaSize
;
1275 case GL_COLOR_TABLE_LUMINANCE_SIZE
:
1276 *params
= table
->LuminanceSize
;
1278 case GL_COLOR_TABLE_INTENSITY_SIZE
:
1279 *params
= table
->IntensitySize
;
1282 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameteriv(pname)" );
1287 /**********************************************************************/
1288 /***** Initialization *****/
1289 /**********************************************************************/
1293 _mesa_init_colortable( struct gl_color_table
*p
)
1298 p
->InternalFormat
= GL_RGBA
;
1304 _mesa_free_colortable_data( struct gl_color_table
*p
)
1307 _mesa_free(p
->TableF
);
1311 _mesa_free(p
->TableUB
);
1318 * Initialize all colortables for a context.
1321 _mesa_init_colortables( GLcontext
* ctx
)
1324 _mesa_init_colortable(&ctx
->ColorTable
);
1325 _mesa_init_colortable(&ctx
->ProxyColorTable
);
1326 _mesa_init_colortable(&ctx
->PostConvolutionColorTable
);
1327 _mesa_init_colortable(&ctx
->ProxyPostConvolutionColorTable
);
1328 _mesa_init_colortable(&ctx
->PostColorMatrixColorTable
);
1329 _mesa_init_colortable(&ctx
->ProxyPostColorMatrixColorTable
);
1334 * Free all colortable data for a context
1337 _mesa_free_colortables_data( GLcontext
*ctx
)
1339 _mesa_free_colortable_data(&ctx
->ColorTable
);
1340 _mesa_free_colortable_data(&ctx
->ProxyColorTable
);
1341 _mesa_free_colortable_data(&ctx
->PostConvolutionColorTable
);
1342 _mesa_free_colortable_data(&ctx
->ProxyPostConvolutionColorTable
);
1343 _mesa_free_colortable_data(&ctx
->PostColorMatrixColorTable
);
1344 _mesa_free_colortable_data(&ctx
->ProxyPostColorMatrixColorTable
);