2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2006 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
= _mesa_malloc(comps
* width
* sizeof(GLfloat
));
476 table
->TableUB
= _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 switch (table
->_BaseFormat
) {
729 for (i
= 0; i
< table
->Size
; i
++) {
733 rgba
[i
][ACOMP
] = table
->TableF
[i
];
740 for (i
= 0; i
< table
->Size
; i
++) {
743 rgba
[i
][BCOMP
] = table
->TableF
[i
];
744 rgba
[i
][ACOMP
] = 1.0F
;
748 case GL_LUMINANCE_ALPHA
:
751 for (i
= 0; i
< table
->Size
; i
++) {
754 rgba
[i
][BCOMP
] = table
->TableF
[i
*2+0];
755 rgba
[i
][ACOMP
] = table
->TableF
[i
*2+1];
762 for (i
= 0; i
< table
->Size
; i
++) {
766 rgba
[i
][ACOMP
] = table
->TableF
[i
];
773 for (i
= 0; i
< table
->Size
; i
++) {
774 rgba
[i
][RCOMP
] = table
->TableF
[i
*3+0];
775 rgba
[i
][GCOMP
] = table
->TableF
[i
*3+1];
776 rgba
[i
][BCOMP
] = table
->TableF
[i
*3+2];
777 rgba
[i
][ACOMP
] = 1.0F
;
782 _mesa_memcpy(rgba
, table
->TableF
, 4 * table
->Size
* sizeof(GLfloat
));
785 _mesa_problem(ctx
, "bad table format in glGetColorTable");
789 if (ctx
->Pack
.BufferObj
->Name
) {
790 /* pack color table into PBO */
792 if (!_mesa_validate_pbo_access(1, &ctx
->Pack
, table
->Size
, 1, 1,
793 format
, type
, data
)) {
794 _mesa_error(ctx
, GL_INVALID_OPERATION
,
795 "glGetColorTable(invalid PBO access)");
798 buf
= (GLubyte
*) ctx
->Driver
.MapBuffer(ctx
, GL_PIXEL_PACK_BUFFER_EXT
,
800 ctx
->Pack
.BufferObj
);
802 /* buffer is already mapped - that's an error */
803 _mesa_error(ctx
, GL_INVALID_OPERATION
,
804 "glGetColorTable(PBO is mapped)");
807 data
= ADD_POINTERS(buf
, data
);
810 _mesa_pack_rgba_span_float(ctx
, table
->Size
, rgba
,
811 format
, type
, data
, &ctx
->Pack
, 0x0);
813 if (ctx
->Pack
.BufferObj
->Name
) {
814 ctx
->Driver
.UnmapBuffer(ctx
, GL_PIXEL_PACK_BUFFER_EXT
,
815 ctx
->Pack
.BufferObj
);
822 _mesa_ColorTableParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
824 GET_CURRENT_CONTEXT(ctx
);
825 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
828 case GL_COLOR_TABLE_SGI
:
829 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
830 ctx
->Pixel
.ColorTableScale
[0] = params
[0];
831 ctx
->Pixel
.ColorTableScale
[1] = params
[1];
832 ctx
->Pixel
.ColorTableScale
[2] = params
[2];
833 ctx
->Pixel
.ColorTableScale
[3] = params
[3];
835 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
836 ctx
->Pixel
.ColorTableBias
[0] = params
[0];
837 ctx
->Pixel
.ColorTableBias
[1] = params
[1];
838 ctx
->Pixel
.ColorTableBias
[2] = params
[2];
839 ctx
->Pixel
.ColorTableBias
[3] = params
[3];
842 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameterfv(pname)");
846 case GL_TEXTURE_COLOR_TABLE_SGI
:
847 if (!ctx
->Extensions
.SGI_texture_color_table
) {
848 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameter(target)");
851 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
852 ctx
->Pixel
.TextureColorTableScale
[0] = params
[0];
853 ctx
->Pixel
.TextureColorTableScale
[1] = params
[1];
854 ctx
->Pixel
.TextureColorTableScale
[2] = params
[2];
855 ctx
->Pixel
.TextureColorTableScale
[3] = params
[3];
857 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
858 ctx
->Pixel
.TextureColorTableBias
[0] = params
[0];
859 ctx
->Pixel
.TextureColorTableBias
[1] = params
[1];
860 ctx
->Pixel
.TextureColorTableBias
[2] = params
[2];
861 ctx
->Pixel
.TextureColorTableBias
[3] = params
[3];
864 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameterfv(pname)");
868 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI
:
869 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
870 ctx
->Pixel
.PCCTscale
[0] = params
[0];
871 ctx
->Pixel
.PCCTscale
[1] = params
[1];
872 ctx
->Pixel
.PCCTscale
[2] = params
[2];
873 ctx
->Pixel
.PCCTscale
[3] = params
[3];
875 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
876 ctx
->Pixel
.PCCTbias
[0] = params
[0];
877 ctx
->Pixel
.PCCTbias
[1] = params
[1];
878 ctx
->Pixel
.PCCTbias
[2] = params
[2];
879 ctx
->Pixel
.PCCTbias
[3] = params
[3];
882 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameterfv(pname)");
886 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
:
887 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
888 ctx
->Pixel
.PCMCTscale
[0] = params
[0];
889 ctx
->Pixel
.PCMCTscale
[1] = params
[1];
890 ctx
->Pixel
.PCMCTscale
[2] = params
[2];
891 ctx
->Pixel
.PCMCTscale
[3] = params
[3];
893 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
894 ctx
->Pixel
.PCMCTbias
[0] = params
[0];
895 ctx
->Pixel
.PCMCTbias
[1] = params
[1];
896 ctx
->Pixel
.PCMCTbias
[2] = params
[2];
897 ctx
->Pixel
.PCMCTbias
[3] = params
[3];
900 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameterfv(pname)");
905 _mesa_error(ctx
, GL_INVALID_ENUM
, "glColorTableParameter(target)");
909 ctx
->NewState
|= _NEW_PIXEL
;
915 _mesa_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
918 if (pname
== GL_COLOR_TABLE_SGI
||
919 pname
== GL_TEXTURE_COLOR_TABLE_SGI
||
920 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
921 pname
== GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
) {
923 fparams
[0] = (GLfloat
) params
[0];
924 fparams
[1] = (GLfloat
) params
[1];
925 fparams
[2] = (GLfloat
) params
[2];
926 fparams
[3] = (GLfloat
) params
[3];
930 fparams
[0] = (GLfloat
) params
[0];
932 _mesa_ColorTableParameterfv(target
, pname
, fparams
);
938 _mesa_GetColorTableParameterfv( GLenum target
, GLenum pname
, GLfloat
*params
)
940 GET_CURRENT_CONTEXT(ctx
);
941 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
942 struct gl_color_table
*table
= NULL
;
943 ASSERT_OUTSIDE_BEGIN_END(ctx
);
947 table
= &texUnit
->Current1D
->Palette
;
950 table
= &texUnit
->Current2D
->Palette
;
953 table
= &texUnit
->Current3D
->Palette
;
955 case GL_TEXTURE_CUBE_MAP_ARB
:
956 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
957 _mesa_error(ctx
, GL_INVALID_ENUM
,
958 "glGetColorTableParameterfv(target)");
961 table
= &texUnit
->CurrentCubeMap
->Palette
;
963 case GL_PROXY_TEXTURE_1D
:
964 table
= &ctx
->Texture
.Proxy1D
->Palette
;
966 case GL_PROXY_TEXTURE_2D
:
967 table
= &ctx
->Texture
.Proxy2D
->Palette
;
969 case GL_PROXY_TEXTURE_3D
:
970 table
= &ctx
->Texture
.Proxy3D
->Palette
;
972 case GL_PROXY_TEXTURE_CUBE_MAP_ARB
:
973 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
974 _mesa_error(ctx
, GL_INVALID_ENUM
,
975 "glGetColorTableParameterfv(target)");
978 table
= &ctx
->Texture
.ProxyCubeMap
->Palette
;
980 case GL_SHARED_TEXTURE_PALETTE_EXT
:
981 table
= &ctx
->Texture
.Palette
;
984 table
= &ctx
->ColorTable
;
985 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
986 params
[0] = ctx
->Pixel
.ColorTableScale
[0];
987 params
[1] = ctx
->Pixel
.ColorTableScale
[1];
988 params
[2] = ctx
->Pixel
.ColorTableScale
[2];
989 params
[3] = ctx
->Pixel
.ColorTableScale
[3];
992 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
993 params
[0] = ctx
->Pixel
.ColorTableBias
[0];
994 params
[1] = ctx
->Pixel
.ColorTableBias
[1];
995 params
[2] = ctx
->Pixel
.ColorTableBias
[2];
996 params
[3] = ctx
->Pixel
.ColorTableBias
[3];
1000 case GL_PROXY_COLOR_TABLE
:
1001 table
= &ctx
->ProxyColorTable
;
1003 case GL_TEXTURE_COLOR_TABLE_SGI
:
1004 if (!ctx
->Extensions
.SGI_texture_color_table
) {
1005 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameter(target)");
1008 table
= &(texUnit
->ColorTable
);
1009 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1010 params
[0] = ctx
->Pixel
.TextureColorTableScale
[0];
1011 params
[1] = ctx
->Pixel
.TextureColorTableScale
[1];
1012 params
[2] = ctx
->Pixel
.TextureColorTableScale
[2];
1013 params
[3] = ctx
->Pixel
.TextureColorTableScale
[3];
1016 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1017 params
[0] = ctx
->Pixel
.TextureColorTableBias
[0];
1018 params
[1] = ctx
->Pixel
.TextureColorTableBias
[1];
1019 params
[2] = ctx
->Pixel
.TextureColorTableBias
[2];
1020 params
[3] = ctx
->Pixel
.TextureColorTableBias
[3];
1024 case GL_PROXY_TEXTURE_COLOR_TABLE_SGI
:
1025 if (!ctx
->Extensions
.SGI_texture_color_table
) {
1026 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameter(target)");
1029 table
= &(texUnit
->ProxyColorTable
);
1031 case GL_POST_CONVOLUTION_COLOR_TABLE
:
1032 table
= &ctx
->PostConvolutionColorTable
;
1033 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1034 params
[0] = ctx
->Pixel
.PCCTscale
[0];
1035 params
[1] = ctx
->Pixel
.PCCTscale
[1];
1036 params
[2] = ctx
->Pixel
.PCCTscale
[2];
1037 params
[3] = ctx
->Pixel
.PCCTscale
[3];
1040 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1041 params
[0] = ctx
->Pixel
.PCCTbias
[0];
1042 params
[1] = ctx
->Pixel
.PCCTbias
[1];
1043 params
[2] = ctx
->Pixel
.PCCTbias
[2];
1044 params
[3] = ctx
->Pixel
.PCCTbias
[3];
1048 case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE
:
1049 table
= &ctx
->ProxyPostConvolutionColorTable
;
1051 case GL_POST_COLOR_MATRIX_COLOR_TABLE
:
1052 table
= &ctx
->PostColorMatrixColorTable
;
1053 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1054 params
[0] = ctx
->Pixel
.PCMCTscale
[0];
1055 params
[1] = ctx
->Pixel
.PCMCTscale
[1];
1056 params
[2] = ctx
->Pixel
.PCMCTscale
[2];
1057 params
[3] = ctx
->Pixel
.PCMCTscale
[3];
1060 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1061 params
[0] = ctx
->Pixel
.PCMCTbias
[0];
1062 params
[1] = ctx
->Pixel
.PCMCTbias
[1];
1063 params
[2] = ctx
->Pixel
.PCMCTbias
[2];
1064 params
[3] = ctx
->Pixel
.PCMCTbias
[3];
1068 case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE
:
1069 table
= &ctx
->ProxyPostColorMatrixColorTable
;
1072 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameterfv(target)");
1079 case GL_COLOR_TABLE_FORMAT
:
1080 *params
= (GLfloat
) table
->InternalFormat
;
1082 case GL_COLOR_TABLE_WIDTH
:
1083 *params
= (GLfloat
) table
->Size
;
1085 case GL_COLOR_TABLE_RED_SIZE
:
1086 *params
= (GLfloat
) table
->RedSize
;
1088 case GL_COLOR_TABLE_GREEN_SIZE
:
1089 *params
= (GLfloat
) table
->GreenSize
;
1091 case GL_COLOR_TABLE_BLUE_SIZE
:
1092 *params
= (GLfloat
) table
->BlueSize
;
1094 case GL_COLOR_TABLE_ALPHA_SIZE
:
1095 *params
= (GLfloat
) table
->AlphaSize
;
1097 case GL_COLOR_TABLE_LUMINANCE_SIZE
:
1098 *params
= (GLfloat
) table
->LuminanceSize
;
1100 case GL_COLOR_TABLE_INTENSITY_SIZE
:
1101 *params
= (GLfloat
) table
->IntensitySize
;
1104 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameterfv(pname)" );
1112 _mesa_GetColorTableParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
1114 GET_CURRENT_CONTEXT(ctx
);
1115 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1116 struct gl_color_table
*table
= NULL
;
1117 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1121 table
= &texUnit
->Current1D
->Palette
;
1124 table
= &texUnit
->Current2D
->Palette
;
1127 table
= &texUnit
->Current3D
->Palette
;
1129 case GL_TEXTURE_CUBE_MAP_ARB
:
1130 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
1131 _mesa_error(ctx
, GL_INVALID_ENUM
,
1132 "glGetColorTableParameteriv(target)");
1135 table
= &texUnit
->CurrentCubeMap
->Palette
;
1137 case GL_PROXY_TEXTURE_1D
:
1138 table
= &ctx
->Texture
.Proxy1D
->Palette
;
1140 case GL_PROXY_TEXTURE_2D
:
1141 table
= &ctx
->Texture
.Proxy2D
->Palette
;
1143 case GL_PROXY_TEXTURE_3D
:
1144 table
= &ctx
->Texture
.Proxy3D
->Palette
;
1146 case GL_PROXY_TEXTURE_CUBE_MAP_ARB
:
1147 if (!ctx
->Extensions
.ARB_texture_cube_map
) {
1148 _mesa_error(ctx
, GL_INVALID_ENUM
,
1149 "glGetColorTableParameteriv(target)");
1152 table
= &ctx
->Texture
.ProxyCubeMap
->Palette
;
1154 case GL_SHARED_TEXTURE_PALETTE_EXT
:
1155 table
= &ctx
->Texture
.Palette
;
1157 case GL_COLOR_TABLE
:
1158 table
= &ctx
->ColorTable
;
1159 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1160 params
[0] = (GLint
) ctx
->Pixel
.ColorTableScale
[0];
1161 params
[1] = (GLint
) ctx
->Pixel
.ColorTableScale
[1];
1162 params
[2] = (GLint
) ctx
->Pixel
.ColorTableScale
[2];
1163 params
[3] = (GLint
) ctx
->Pixel
.ColorTableScale
[3];
1166 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1167 params
[0] = (GLint
) ctx
->Pixel
.ColorTableBias
[0];
1168 params
[1] = (GLint
) ctx
->Pixel
.ColorTableBias
[1];
1169 params
[2] = (GLint
) ctx
->Pixel
.ColorTableBias
[2];
1170 params
[3] = (GLint
) ctx
->Pixel
.ColorTableBias
[3];
1174 case GL_PROXY_COLOR_TABLE
:
1175 table
= &ctx
->ProxyColorTable
;
1177 case GL_TEXTURE_COLOR_TABLE_SGI
:
1178 if (!ctx
->Extensions
.SGI_texture_color_table
) {
1179 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameter(target)");
1182 table
= &(texUnit
->ColorTable
);
1183 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1184 params
[0] = (GLint
) ctx
->Pixel
.TextureColorTableScale
[0];
1185 params
[1] = (GLint
) ctx
->Pixel
.TextureColorTableScale
[1];
1186 params
[2] = (GLint
) ctx
->Pixel
.TextureColorTableScale
[2];
1187 params
[3] = (GLint
) ctx
->Pixel
.TextureColorTableScale
[3];
1190 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1191 params
[0] = (GLint
) ctx
->Pixel
.TextureColorTableBias
[0];
1192 params
[1] = (GLint
) ctx
->Pixel
.TextureColorTableBias
[1];
1193 params
[2] = (GLint
) ctx
->Pixel
.TextureColorTableBias
[2];
1194 params
[3] = (GLint
) ctx
->Pixel
.TextureColorTableBias
[3];
1198 case GL_PROXY_TEXTURE_COLOR_TABLE_SGI
:
1199 if (!ctx
->Extensions
.SGI_texture_color_table
) {
1200 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameter(target)");
1203 table
= &(texUnit
->ProxyColorTable
);
1205 case GL_POST_CONVOLUTION_COLOR_TABLE
:
1206 table
= &ctx
->PostConvolutionColorTable
;
1207 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1208 params
[0] = (GLint
) ctx
->Pixel
.PCCTscale
[0];
1209 params
[1] = (GLint
) ctx
->Pixel
.PCCTscale
[1];
1210 params
[2] = (GLint
) ctx
->Pixel
.PCCTscale
[2];
1211 params
[3] = (GLint
) ctx
->Pixel
.PCCTscale
[3];
1214 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1215 params
[0] = (GLint
) ctx
->Pixel
.PCCTbias
[0];
1216 params
[1] = (GLint
) ctx
->Pixel
.PCCTbias
[1];
1217 params
[2] = (GLint
) ctx
->Pixel
.PCCTbias
[2];
1218 params
[3] = (GLint
) ctx
->Pixel
.PCCTbias
[3];
1222 case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE
:
1223 table
= &ctx
->ProxyPostConvolutionColorTable
;
1225 case GL_POST_COLOR_MATRIX_COLOR_TABLE
:
1226 table
= &ctx
->PostColorMatrixColorTable
;
1227 if (pname
== GL_COLOR_TABLE_SCALE_SGI
) {
1228 params
[0] = (GLint
) ctx
->Pixel
.PCMCTscale
[0];
1229 params
[1] = (GLint
) ctx
->Pixel
.PCMCTscale
[1];
1230 params
[2] = (GLint
) ctx
->Pixel
.PCMCTscale
[2];
1231 params
[3] = (GLint
) ctx
->Pixel
.PCMCTscale
[3];
1234 else if (pname
== GL_COLOR_TABLE_BIAS_SGI
) {
1235 params
[0] = (GLint
) ctx
->Pixel
.PCMCTbias
[0];
1236 params
[1] = (GLint
) ctx
->Pixel
.PCMCTbias
[1];
1237 params
[2] = (GLint
) ctx
->Pixel
.PCMCTbias
[2];
1238 params
[3] = (GLint
) ctx
->Pixel
.PCMCTbias
[3];
1242 case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE
:
1243 table
= &ctx
->ProxyPostColorMatrixColorTable
;
1246 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameteriv(target)");
1253 case GL_COLOR_TABLE_FORMAT
:
1254 *params
= table
->InternalFormat
;
1256 case GL_COLOR_TABLE_WIDTH
:
1257 *params
= table
->Size
;
1259 case GL_COLOR_TABLE_RED_SIZE
:
1260 *params
= table
->RedSize
;
1262 case GL_COLOR_TABLE_GREEN_SIZE
:
1263 *params
= table
->GreenSize
;
1265 case GL_COLOR_TABLE_BLUE_SIZE
:
1266 *params
= table
->BlueSize
;
1268 case GL_COLOR_TABLE_ALPHA_SIZE
:
1269 *params
= table
->AlphaSize
;
1271 case GL_COLOR_TABLE_LUMINANCE_SIZE
:
1272 *params
= table
->LuminanceSize
;
1274 case GL_COLOR_TABLE_INTENSITY_SIZE
:
1275 *params
= table
->IntensitySize
;
1278 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetColorTableParameteriv(pname)" );
1283 /**********************************************************************/
1284 /***** Initialization *****/
1285 /**********************************************************************/
1289 _mesa_init_colortable( struct gl_color_table
*p
)
1294 p
->InternalFormat
= GL_RGBA
;
1300 _mesa_free_colortable_data( struct gl_color_table
*p
)
1303 _mesa_free(p
->TableF
);
1307 _mesa_free(p
->TableUB
);
1314 * Initialize all colortables for a context.
1317 _mesa_init_colortables( GLcontext
* ctx
)
1320 _mesa_init_colortable(&ctx
->ColorTable
);
1321 _mesa_init_colortable(&ctx
->ProxyColorTable
);
1322 _mesa_init_colortable(&ctx
->PostConvolutionColorTable
);
1323 _mesa_init_colortable(&ctx
->ProxyPostConvolutionColorTable
);
1324 _mesa_init_colortable(&ctx
->PostColorMatrixColorTable
);
1325 _mesa_init_colortable(&ctx
->ProxyPostColorMatrixColorTable
);
1330 * Free all colortable data for a context
1333 _mesa_free_colortables_data( GLcontext
*ctx
)
1335 _mesa_free_colortable_data(&ctx
->ColorTable
);
1336 _mesa_free_colortable_data(&ctx
->ProxyColorTable
);
1337 _mesa_free_colortable_data(&ctx
->PostConvolutionColorTable
);
1338 _mesa_free_colortable_data(&ctx
->ProxyPostConvolutionColorTable
);
1339 _mesa_free_colortable_data(&ctx
->PostColorMatrixColorTable
);
1340 _mesa_free_colortable_data(&ctx
->ProxyPostColorMatrixColorTable
);