1 /* $Id: enable.c,v 1.72 2003/01/14 04:55:45 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 #include "simple_list.h"
37 #include "math/m_matrix.h"
38 #include "math/m_xform.h"
42 #define CHECK_EXTENSION(EXTNAME, CAP) \
43 if (!ctx->Extensions.EXTNAME) { \
44 _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \
45 state ? "Enable" : "Disable", CAP); \
52 client_state( GLcontext
*ctx
, GLenum cap
, GLboolean state
)
59 var
= &ctx
->Array
.Vertex
.Enabled
;
60 flag
= _NEW_ARRAY_VERTEX
;
63 var
= &ctx
->Array
.Normal
.Enabled
;
64 flag
= _NEW_ARRAY_NORMAL
;
67 var
= &ctx
->Array
.Color
.Enabled
;
68 flag
= _NEW_ARRAY_COLOR0
;
71 var
= &ctx
->Array
.Index
.Enabled
;
72 flag
= _NEW_ARRAY_INDEX
;
74 case GL_TEXTURE_COORD_ARRAY
:
75 var
= &ctx
->Array
.TexCoord
[ctx
->Array
.ActiveTexture
].Enabled
;
76 flag
= _NEW_ARRAY_TEXCOORD(ctx
->Array
.ActiveTexture
);
78 case GL_EDGE_FLAG_ARRAY
:
79 var
= &ctx
->Array
.EdgeFlag
.Enabled
;
80 flag
= _NEW_ARRAY_EDGEFLAG
;
82 case GL_FOG_COORDINATE_ARRAY_EXT
:
83 var
= &ctx
->Array
.FogCoord
.Enabled
;
84 flag
= _NEW_ARRAY_FOGCOORD
;
86 case GL_SECONDARY_COLOR_ARRAY_EXT
:
87 var
= &ctx
->Array
.SecondaryColor
.Enabled
;
88 flag
= _NEW_ARRAY_COLOR1
;
91 #if FEATURE_NV_vertex_program
92 case GL_VERTEX_ATTRIB_ARRAY0_NV
:
93 case GL_VERTEX_ATTRIB_ARRAY1_NV
:
94 case GL_VERTEX_ATTRIB_ARRAY2_NV
:
95 case GL_VERTEX_ATTRIB_ARRAY3_NV
:
96 case GL_VERTEX_ATTRIB_ARRAY4_NV
:
97 case GL_VERTEX_ATTRIB_ARRAY5_NV
:
98 case GL_VERTEX_ATTRIB_ARRAY6_NV
:
99 case GL_VERTEX_ATTRIB_ARRAY7_NV
:
100 case GL_VERTEX_ATTRIB_ARRAY8_NV
:
101 case GL_VERTEX_ATTRIB_ARRAY9_NV
:
102 case GL_VERTEX_ATTRIB_ARRAY10_NV
:
103 case GL_VERTEX_ATTRIB_ARRAY11_NV
:
104 case GL_VERTEX_ATTRIB_ARRAY12_NV
:
105 case GL_VERTEX_ATTRIB_ARRAY13_NV
:
106 case GL_VERTEX_ATTRIB_ARRAY14_NV
:
107 case GL_VERTEX_ATTRIB_ARRAY15_NV
:
108 CHECK_EXTENSION(NV_vertex_program
, cap
);
110 GLint n
= (GLint
) cap
- GL_VERTEX_ATTRIB_ARRAY0_NV
;
111 var
= &ctx
->Array
.VertexAttrib
[n
].Enabled
;
112 flag
= _NEW_ARRAY_ATTRIB(n
);
115 #endif /* FEATURE_NV_vertex_program */
118 _mesa_error( ctx
, GL_INVALID_ENUM
,
119 "glEnable/DisableClientState(0x%x)", cap
);
126 FLUSH_VERTICES(ctx
, _NEW_ARRAY
);
127 ctx
->Array
.NewState
|= flag
;
131 ctx
->Array
._Enabled
|= flag
;
133 ctx
->Array
._Enabled
&= ~flag
;
135 if (ctx
->Driver
.Enable
) {
136 (*ctx
->Driver
.Enable
)( ctx
, cap
, state
);
143 _mesa_EnableClientState( GLenum cap
)
145 GET_CURRENT_CONTEXT(ctx
);
146 ASSERT_OUTSIDE_BEGIN_END(ctx
);
147 client_state( ctx
, cap
, GL_TRUE
);
153 _mesa_DisableClientState( GLenum cap
)
155 GET_CURRENT_CONTEXT(ctx
);
156 ASSERT_OUTSIDE_BEGIN_END(ctx
);
157 client_state( ctx
, cap
, GL_FALSE
);
161 #undef CHECK_EXTENSION
162 #define CHECK_EXTENSION(EXTNAME, CAP) \
163 if (!ctx->Extensions.EXTNAME) { \
164 _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \
165 state ? "Enable" : "Disable", CAP); \
171 * Perform glEnable and glDisable calls.
173 void _mesa_set_enable( GLcontext
*ctx
, GLenum cap
, GLboolean state
)
175 if (MESA_VERBOSE
& VERBOSE_API
)
176 _mesa_debug(ctx
, "%s %s (newstate is %x)\n",
177 state
? "glEnable" : "glDisable",
178 _mesa_lookup_enum_by_nr(cap
),
183 if (ctx
->Color
.AlphaEnabled
== state
)
185 FLUSH_VERTICES(ctx
, _NEW_COLOR
);
186 ctx
->Color
.AlphaEnabled
= state
;
189 if (ctx
->Eval
.AutoNormal
== state
)
191 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
192 ctx
->Eval
.AutoNormal
= state
;
195 if (ctx
->Color
.BlendEnabled
== state
)
197 FLUSH_VERTICES(ctx
, _NEW_COLOR
);
198 ctx
->Color
.BlendEnabled
= state
;
199 /* The following needed to accomodate 1.0 RGB logic op blending */
200 ctx
->Color
.ColorLogicOpEnabled
=
201 (ctx
->Color
.BlendEquation
== GL_LOGIC_OP
&& state
);
210 const GLuint p
= cap
- GL_CLIP_PLANE0
;
212 if ((ctx
->Transform
.ClipPlanesEnabled
& (1 << p
)) == ((GLuint
) state
<< p
))
215 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
218 ctx
->Transform
.ClipPlanesEnabled
|= (1 << p
);
220 if (ctx
->ProjectionMatrixStack
.Top
->flags
& MAT_DIRTY
)
221 _math_matrix_analyse( ctx
->ProjectionMatrixStack
.Top
);
223 /* This derived state also calculated in clip.c and
224 * from _mesa_update_state() on changes to EyeUserPlane
225 * and ctx->ProjectionMatrix respectively.
227 _mesa_transform_vector( ctx
->Transform
._ClipUserPlane
[p
],
228 ctx
->Transform
.EyeUserPlane
[p
],
229 ctx
->ProjectionMatrixStack
.Top
->inv
);
232 ctx
->Transform
.ClipPlanesEnabled
&= ~(1 << p
);
236 case GL_COLOR_MATERIAL
:
237 if (ctx
->Light
.ColorMaterialEnabled
== state
)
239 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
240 ctx
->Light
.ColorMaterialEnabled
= state
;
242 FLUSH_CURRENT(ctx
, 0);
243 _mesa_update_color_material( ctx
,
244 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
] );
248 if (ctx
->Polygon
.CullFlag
== state
)
250 FLUSH_VERTICES(ctx
, _NEW_POLYGON
);
251 ctx
->Polygon
.CullFlag
= state
;
254 if (state
&& ctx
->Visual
.depthBits
==0) {
255 _mesa_warning(ctx
,"glEnable(GL_DEPTH_TEST) but no depth buffer");
258 if (ctx
->Depth
.Test
==state
)
260 FLUSH_VERTICES(ctx
, _NEW_DEPTH
);
261 ctx
->Depth
.Test
= state
;
265 state
= GL_FALSE
; /* MESA_NO_DITHER env var */
267 if (ctx
->Color
.DitherFlag
==state
)
269 FLUSH_VERTICES(ctx
, _NEW_COLOR
);
270 ctx
->Color
.DitherFlag
= state
;
273 if (ctx
->Fog
.Enabled
==state
)
275 FLUSH_VERTICES(ctx
, _NEW_FOG
);
276 ctx
->Fog
.Enabled
= state
;
279 CHECK_EXTENSION(EXT_histogram
, cap
);
280 if (ctx
->Pixel
.HistogramEnabled
== state
)
282 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
283 ctx
->Pixel
.HistogramEnabled
= state
;
293 if (ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
== state
)
295 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
296 ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
= state
;
298 insert_at_tail(&ctx
->Light
.EnabledList
,
299 &ctx
->Light
.Light
[cap
-GL_LIGHT0
]);
302 remove_from_list(&ctx
->Light
.Light
[cap
-GL_LIGHT0
]);
306 if (ctx
->Light
.Enabled
== state
)
308 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
309 ctx
->Light
.Enabled
= state
;
311 if (ctx
->Light
.Enabled
&& ctx
->Light
.Model
.TwoSide
)
312 ctx
->_TriangleCaps
|= DD_TRI_LIGHT_TWOSIDE
;
314 ctx
->_TriangleCaps
&= ~DD_TRI_LIGHT_TWOSIDE
;
316 if ((ctx
->Light
.Enabled
&&
317 ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
)
318 || ctx
->Fog
.ColorSumEnabled
)
319 ctx
->_TriangleCaps
|= DD_SEPARATE_SPECULAR
;
321 ctx
->_TriangleCaps
&= ~DD_SEPARATE_SPECULAR
;
325 if (ctx
->Line
.SmoothFlag
== state
)
327 FLUSH_VERTICES(ctx
, _NEW_LINE
);
328 ctx
->Line
.SmoothFlag
= state
;
329 ctx
->_TriangleCaps
^= DD_LINE_SMOOTH
;
331 case GL_LINE_STIPPLE
:
332 if (ctx
->Line
.StippleFlag
== state
)
334 FLUSH_VERTICES(ctx
, _NEW_LINE
);
335 ctx
->Line
.StippleFlag
= state
;
336 ctx
->_TriangleCaps
^= DD_LINE_STIPPLE
;
338 case GL_INDEX_LOGIC_OP
:
339 if (ctx
->Color
.IndexLogicOpEnabled
== state
)
341 FLUSH_VERTICES(ctx
, _NEW_COLOR
);
342 ctx
->Color
.IndexLogicOpEnabled
= state
;
344 case GL_COLOR_LOGIC_OP
:
345 if (ctx
->Color
.ColorLogicOpEnabled
== state
)
347 FLUSH_VERTICES(ctx
, _NEW_COLOR
);
348 ctx
->Color
.ColorLogicOpEnabled
= state
;
350 case GL_MAP1_COLOR_4
:
351 if (ctx
->Eval
.Map1Color4
== state
)
353 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
354 ctx
->Eval
.Map1Color4
= state
;
357 if (ctx
->Eval
.Map1Index
== state
)
359 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
360 ctx
->Eval
.Map1Index
= state
;
363 if (ctx
->Eval
.Map1Normal
== state
)
365 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
366 ctx
->Eval
.Map1Normal
= state
;
368 case GL_MAP1_TEXTURE_COORD_1
:
369 if (ctx
->Eval
.Map1TextureCoord1
== state
)
371 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
372 ctx
->Eval
.Map1TextureCoord1
= state
;
374 case GL_MAP1_TEXTURE_COORD_2
:
375 if (ctx
->Eval
.Map1TextureCoord2
== state
)
377 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
378 ctx
->Eval
.Map1TextureCoord2
= state
;
380 case GL_MAP1_TEXTURE_COORD_3
:
381 if (ctx
->Eval
.Map1TextureCoord3
== state
)
383 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
384 ctx
->Eval
.Map1TextureCoord3
= state
;
386 case GL_MAP1_TEXTURE_COORD_4
:
387 if (ctx
->Eval
.Map1TextureCoord4
== state
)
389 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
390 ctx
->Eval
.Map1TextureCoord4
= state
;
392 case GL_MAP1_VERTEX_3
:
393 if (ctx
->Eval
.Map1Vertex3
== state
)
395 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
396 ctx
->Eval
.Map1Vertex3
= state
;
398 case GL_MAP1_VERTEX_4
:
399 if (ctx
->Eval
.Map1Vertex4
== state
)
401 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
402 ctx
->Eval
.Map1Vertex4
= state
;
404 case GL_MAP2_COLOR_4
:
405 if (ctx
->Eval
.Map2Color4
== state
)
407 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
408 ctx
->Eval
.Map2Color4
= state
;
411 if (ctx
->Eval
.Map2Index
== state
)
413 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
414 ctx
->Eval
.Map2Index
= state
;
417 if (ctx
->Eval
.Map2Normal
== state
)
419 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
420 ctx
->Eval
.Map2Normal
= state
;
422 case GL_MAP2_TEXTURE_COORD_1
:
423 if (ctx
->Eval
.Map2TextureCoord1
== state
)
425 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
426 ctx
->Eval
.Map2TextureCoord1
= state
;
428 case GL_MAP2_TEXTURE_COORD_2
:
429 if (ctx
->Eval
.Map2TextureCoord2
== state
)
431 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
432 ctx
->Eval
.Map2TextureCoord2
= state
;
434 case GL_MAP2_TEXTURE_COORD_3
:
435 if (ctx
->Eval
.Map2TextureCoord3
== state
)
437 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
438 ctx
->Eval
.Map2TextureCoord3
= state
;
440 case GL_MAP2_TEXTURE_COORD_4
:
441 if (ctx
->Eval
.Map2TextureCoord4
== state
)
443 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
444 ctx
->Eval
.Map2TextureCoord4
= state
;
446 case GL_MAP2_VERTEX_3
:
447 if (ctx
->Eval
.Map2Vertex3
== state
)
449 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
450 ctx
->Eval
.Map2Vertex3
= state
;
452 case GL_MAP2_VERTEX_4
:
453 if (ctx
->Eval
.Map2Vertex4
== state
)
455 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
456 ctx
->Eval
.Map2Vertex4
= state
;
459 if (ctx
->Pixel
.MinMaxEnabled
== state
)
461 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
462 ctx
->Pixel
.MinMaxEnabled
= state
;
465 if (ctx
->Transform
.Normalize
== state
)
467 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
468 ctx
->Transform
.Normalize
= state
;
470 case GL_POINT_SMOOTH
:
471 if (ctx
->Point
.SmoothFlag
==state
)
473 FLUSH_VERTICES(ctx
, _NEW_POINT
);
474 ctx
->Point
.SmoothFlag
= state
;
475 ctx
->_TriangleCaps
^= DD_POINT_SMOOTH
;
477 case GL_POLYGON_SMOOTH
:
478 if (ctx
->Polygon
.SmoothFlag
==state
)
480 FLUSH_VERTICES(ctx
, _NEW_POLYGON
);
481 ctx
->Polygon
.SmoothFlag
= state
;
482 ctx
->_TriangleCaps
^= DD_TRI_SMOOTH
;
484 case GL_POLYGON_STIPPLE
:
485 if (ctx
->Polygon
.StippleFlag
==state
)
487 FLUSH_VERTICES(ctx
, _NEW_POLYGON
);
488 ctx
->Polygon
.StippleFlag
= state
;
489 ctx
->_TriangleCaps
^= DD_TRI_STIPPLE
;
491 case GL_POLYGON_OFFSET_POINT
:
492 if (ctx
->Polygon
.OffsetPoint
==state
)
494 FLUSH_VERTICES(ctx
, _NEW_POLYGON
);
495 ctx
->Polygon
.OffsetPoint
= state
;
497 case GL_POLYGON_OFFSET_LINE
:
498 if (ctx
->Polygon
.OffsetLine
==state
)
500 FLUSH_VERTICES(ctx
, _NEW_POLYGON
);
501 ctx
->Polygon
.OffsetLine
= state
;
503 case GL_POLYGON_OFFSET_FILL
:
504 /*case GL_POLYGON_OFFSET_EXT:*/
505 if (ctx
->Polygon
.OffsetFill
==state
)
507 FLUSH_VERTICES(ctx
, _NEW_POLYGON
);
508 ctx
->Polygon
.OffsetFill
= state
;
510 case GL_RESCALE_NORMAL_EXT
:
511 if (ctx
->Transform
.RescaleNormals
== state
)
513 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
514 ctx
->Transform
.RescaleNormals
= state
;
516 case GL_SCISSOR_TEST
:
517 if (ctx
->Scissor
.Enabled
==state
)
519 FLUSH_VERTICES(ctx
, _NEW_SCISSOR
);
520 ctx
->Scissor
.Enabled
= state
;
522 case GL_SHARED_TEXTURE_PALETTE_EXT
:
523 if (ctx
->Texture
.SharedPalette
== state
)
525 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
526 ctx
->Texture
.SharedPalette
= state
;
528 case GL_STENCIL_TEST
:
529 if (state
&& ctx
->Visual
.stencilBits
==0) {
531 "glEnable(GL_STENCIL_TEST) but no stencil buffer");
534 if (ctx
->Stencil
.Enabled
==state
)
536 FLUSH_VERTICES(ctx
, _NEW_STENCIL
);
537 ctx
->Stencil
.Enabled
= state
;
539 case GL_TEXTURE_1D
: {
540 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
541 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
542 GLuint newenabled
= texUnit
->Enabled
& ~TEXTURE_1D_BIT
;
544 newenabled
|= TEXTURE_1D_BIT
;
545 if (!ctx
->Visual
.rgbMode
|| texUnit
->Enabled
== newenabled
)
547 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
548 texUnit
->Enabled
= newenabled
;
551 case GL_TEXTURE_2D
: {
552 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
553 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
554 GLuint newenabled
= texUnit
->Enabled
& ~TEXTURE_2D_BIT
;
556 newenabled
|= TEXTURE_2D_BIT
;
557 if (!ctx
->Visual
.rgbMode
|| texUnit
->Enabled
== newenabled
)
559 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
560 texUnit
->Enabled
= newenabled
;
563 case GL_TEXTURE_3D
: {
564 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
565 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
566 GLuint newenabled
= texUnit
->Enabled
& ~TEXTURE_3D_BIT
;
568 newenabled
|= TEXTURE_3D_BIT
;
569 if (!ctx
->Visual
.rgbMode
|| texUnit
->Enabled
== newenabled
)
571 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
572 texUnit
->Enabled
= newenabled
;
575 case GL_TEXTURE_GEN_Q
: {
576 GLuint unit
= ctx
->Texture
.CurrentUnit
;
577 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[unit
];
578 GLuint newenabled
= texUnit
->TexGenEnabled
& ~Q_BIT
;
581 if (texUnit
->TexGenEnabled
== newenabled
)
583 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
584 texUnit
->TexGenEnabled
= newenabled
;
587 case GL_TEXTURE_GEN_R
: {
588 GLuint unit
= ctx
->Texture
.CurrentUnit
;
589 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[unit
];
590 GLuint newenabled
= texUnit
->TexGenEnabled
& ~R_BIT
;
593 if (texUnit
->TexGenEnabled
== newenabled
)
595 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
596 texUnit
->TexGenEnabled
= newenabled
;
600 case GL_TEXTURE_GEN_S
: {
601 GLuint unit
= ctx
->Texture
.CurrentUnit
;
602 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[unit
];
603 GLuint newenabled
= texUnit
->TexGenEnabled
& ~S_BIT
;
606 if (texUnit
->TexGenEnabled
== newenabled
)
608 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
609 texUnit
->TexGenEnabled
= newenabled
;
613 case GL_TEXTURE_GEN_T
: {
614 GLuint unit
= ctx
->Texture
.CurrentUnit
;
615 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[unit
];
616 GLuint newenabled
= texUnit
->TexGenEnabled
& ~T_BIT
;
619 if (texUnit
->TexGenEnabled
== newenabled
)
621 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
622 texUnit
->TexGenEnabled
= newenabled
;
630 case GL_VERTEX_ARRAY
:
631 case GL_NORMAL_ARRAY
:
634 case GL_TEXTURE_COORD_ARRAY
:
635 case GL_EDGE_FLAG_ARRAY
:
636 case GL_FOG_COORDINATE_ARRAY_EXT
:
637 case GL_SECONDARY_COLOR_ARRAY_EXT
:
638 client_state( ctx
, cap
, state
);
641 /* GL_HP_occlusion_test */
642 case GL_OCCLUSION_TEST_HP
:
643 CHECK_EXTENSION(HP_occlusion_test
, cap
);
644 if (ctx
->Depth
.OcclusionTest
== state
)
646 FLUSH_VERTICES(ctx
, _NEW_DEPTH
);
647 ctx
->Depth
.OcclusionTest
= state
;
649 ctx
->OcclusionResult
= ctx
->OcclusionResultSaved
;
651 ctx
->OcclusionResultSaved
= ctx
->OcclusionResult
;
654 /* GL_SGIS_pixel_texture */
655 case GL_PIXEL_TEXTURE_SGIS
:
656 CHECK_EXTENSION(SGIS_pixel_texture
, cap
);
657 if (ctx
->Pixel
.PixelTextureEnabled
== state
)
659 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
660 ctx
->Pixel
.PixelTextureEnabled
= state
;
663 /* GL_SGIX_pixel_texture */
664 case GL_PIXEL_TEX_GEN_SGIX
:
665 CHECK_EXTENSION(SGIX_pixel_texture
, cap
);
666 if (ctx
->Pixel
.PixelTextureEnabled
== state
)
668 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
669 ctx
->Pixel
.PixelTextureEnabled
= state
;
672 /* GL_SGI_color_table */
673 case GL_COLOR_TABLE_SGI
:
674 CHECK_EXTENSION(SGI_color_table
, cap
);
675 if (ctx
->Pixel
.ColorTableEnabled
== state
)
677 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
678 ctx
->Pixel
.ColorTableEnabled
= state
;
680 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI
:
681 CHECK_EXTENSION(SGI_color_table
, cap
);
682 if (ctx
->Pixel
.PostConvolutionColorTableEnabled
== state
)
684 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
685 ctx
->Pixel
.PostConvolutionColorTableEnabled
= state
;
687 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
:
688 CHECK_EXTENSION(SGI_color_table
, cap
);
689 if (ctx
->Pixel
.PostColorMatrixColorTableEnabled
== state
)
691 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
692 ctx
->Pixel
.PostColorMatrixColorTableEnabled
= state
;
695 /* GL_EXT_convolution */
696 case GL_CONVOLUTION_1D
:
697 CHECK_EXTENSION(EXT_convolution
, cap
);
698 if (ctx
->Pixel
.Convolution1DEnabled
== state
)
700 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
701 ctx
->Pixel
.Convolution1DEnabled
= state
;
703 case GL_CONVOLUTION_2D
:
704 CHECK_EXTENSION(EXT_convolution
, cap
);
705 if (ctx
->Pixel
.Convolution2DEnabled
== state
)
707 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
708 ctx
->Pixel
.Convolution2DEnabled
= state
;
710 case GL_SEPARABLE_2D
:
711 CHECK_EXTENSION(EXT_convolution
, cap
);
712 if (ctx
->Pixel
.Separable2DEnabled
== state
)
714 FLUSH_VERTICES(ctx
, _NEW_PIXEL
);
715 ctx
->Pixel
.Separable2DEnabled
= state
;
718 /* GL_ARB_texture_cube_map */
719 case GL_TEXTURE_CUBE_MAP_ARB
:
721 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
722 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
723 GLuint newenabled
= texUnit
->Enabled
& ~TEXTURE_CUBE_BIT
;
724 CHECK_EXTENSION(ARB_texture_cube_map
, cap
);
726 newenabled
|= TEXTURE_CUBE_BIT
;
727 if (!ctx
->Visual
.rgbMode
|| texUnit
->Enabled
== newenabled
)
729 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
730 texUnit
->Enabled
= newenabled
;
734 /* GL_EXT_secondary_color */
735 case GL_COLOR_SUM_EXT
:
736 CHECK_EXTENSION(EXT_secondary_color
, cap
);
737 if (ctx
->Fog
.ColorSumEnabled
== state
)
739 FLUSH_VERTICES(ctx
, _NEW_FOG
);
740 ctx
->Fog
.ColorSumEnabled
= state
;
742 if ((ctx
->Light
.Enabled
&&
743 ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
)
744 || ctx
->Fog
.ColorSumEnabled
)
745 ctx
->_TriangleCaps
|= DD_SEPARATE_SPECULAR
;
747 ctx
->_TriangleCaps
&= ~DD_SEPARATE_SPECULAR
;
751 /* GL_ARB_multisample */
752 case GL_MULTISAMPLE_ARB
:
753 CHECK_EXTENSION(ARB_multisample
, cap
);
754 if (ctx
->Multisample
.Enabled
== state
)
756 FLUSH_VERTICES(ctx
, _NEW_MULTISAMPLE
);
757 ctx
->Multisample
.Enabled
= state
;
759 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
:
760 CHECK_EXTENSION(ARB_multisample
, cap
);
761 if (ctx
->Multisample
.SampleAlphaToCoverage
== state
)
763 FLUSH_VERTICES(ctx
, _NEW_MULTISAMPLE
);
764 ctx
->Multisample
.SampleAlphaToCoverage
= state
;
766 case GL_SAMPLE_ALPHA_TO_ONE_ARB
:
767 CHECK_EXTENSION(ARB_multisample
, cap
);
768 if (ctx
->Multisample
.SampleAlphaToOne
== state
)
770 FLUSH_VERTICES(ctx
, _NEW_MULTISAMPLE
);
771 ctx
->Multisample
.SampleAlphaToOne
= state
;
773 case GL_SAMPLE_COVERAGE_ARB
:
774 CHECK_EXTENSION(ARB_multisample
, cap
);
775 if (ctx
->Multisample
.SampleCoverage
== state
)
777 FLUSH_VERTICES(ctx
, _NEW_MULTISAMPLE
);
778 ctx
->Multisample
.SampleCoverage
= state
;
780 case GL_SAMPLE_COVERAGE_INVERT_ARB
:
781 CHECK_EXTENSION(ARB_multisample
, cap
);
782 if (ctx
->Multisample
.SampleCoverageInvert
== state
)
784 FLUSH_VERTICES(ctx
, _NEW_MULTISAMPLE
);
785 ctx
->Multisample
.SampleCoverageInvert
= state
;
788 /* GL_IBM_rasterpos_clip */
789 case GL_RASTER_POSITION_UNCLIPPED_IBM
:
790 CHECK_EXTENSION(IBM_rasterpos_clip
, cap
);
791 if (ctx
->Transform
.RasterPositionUnclipped
== state
)
793 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
794 ctx
->Transform
.RasterPositionUnclipped
= state
;
797 /* GL_NV_point_sprite */
798 case GL_POINT_SPRITE_NV
:
799 CHECK_EXTENSION(NV_point_sprite
, cap
);
800 if (ctx
->Point
.PointSprite
== state
)
802 FLUSH_VERTICES(ctx
, _NEW_POINT
);
803 ctx
->Point
.PointSprite
= state
;
806 #if FEATURE_NV_vertex_program
807 case GL_VERTEX_PROGRAM_NV
:
808 CHECK_EXTENSION(NV_vertex_program
, cap
);
809 if (ctx
->VertexProgram
.Enabled
== state
)
811 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
| _NEW_PROGRAM
); /* XXX OK? */
812 ctx
->VertexProgram
.Enabled
= state
;
814 case GL_VERTEX_PROGRAM_POINT_SIZE_NV
:
815 CHECK_EXTENSION(NV_vertex_program
, cap
);
816 if (ctx
->VertexProgram
.PointSizeEnabled
== state
)
818 FLUSH_VERTICES(ctx
, _NEW_POINT
| _NEW_PROGRAM
);
819 ctx
->VertexProgram
.PointSizeEnabled
= state
;
821 case GL_VERTEX_PROGRAM_TWO_SIDE_NV
:
822 CHECK_EXTENSION(NV_vertex_program
, cap
);
823 if (ctx
->VertexProgram
.TwoSideEnabled
== state
)
825 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
); /* XXX OK? */
826 ctx
->VertexProgram
.TwoSideEnabled
= state
;
828 case GL_MAP1_VERTEX_ATTRIB0_4_NV
:
829 case GL_MAP1_VERTEX_ATTRIB1_4_NV
:
830 case GL_MAP1_VERTEX_ATTRIB2_4_NV
:
831 case GL_MAP1_VERTEX_ATTRIB3_4_NV
:
832 case GL_MAP1_VERTEX_ATTRIB4_4_NV
:
833 case GL_MAP1_VERTEX_ATTRIB5_4_NV
:
834 case GL_MAP1_VERTEX_ATTRIB6_4_NV
:
835 case GL_MAP1_VERTEX_ATTRIB7_4_NV
:
836 case GL_MAP1_VERTEX_ATTRIB8_4_NV
:
837 case GL_MAP1_VERTEX_ATTRIB9_4_NV
:
838 case GL_MAP1_VERTEX_ATTRIB10_4_NV
:
839 case GL_MAP1_VERTEX_ATTRIB11_4_NV
:
840 case GL_MAP1_VERTEX_ATTRIB12_4_NV
:
841 case GL_MAP1_VERTEX_ATTRIB13_4_NV
:
842 case GL_MAP1_VERTEX_ATTRIB14_4_NV
:
843 case GL_MAP1_VERTEX_ATTRIB15_4_NV
:
844 CHECK_EXTENSION(NV_vertex_program
, cap
);
846 const GLuint map
= (GLuint
) (cap
- GL_MAP1_VERTEX_ATTRIB0_4_NV
);
847 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
848 ctx
->Eval
.Map1Attrib
[map
] = state
;
851 case GL_MAP2_VERTEX_ATTRIB0_4_NV
:
852 case GL_MAP2_VERTEX_ATTRIB1_4_NV
:
853 case GL_MAP2_VERTEX_ATTRIB2_4_NV
:
854 case GL_MAP2_VERTEX_ATTRIB3_4_NV
:
855 case GL_MAP2_VERTEX_ATTRIB4_4_NV
:
856 case GL_MAP2_VERTEX_ATTRIB5_4_NV
:
857 case GL_MAP2_VERTEX_ATTRIB6_4_NV
:
858 case GL_MAP2_VERTEX_ATTRIB7_4_NV
:
859 case GL_MAP2_VERTEX_ATTRIB8_4_NV
:
860 case GL_MAP2_VERTEX_ATTRIB9_4_NV
:
861 case GL_MAP2_VERTEX_ATTRIB10_4_NV
:
862 case GL_MAP2_VERTEX_ATTRIB11_4_NV
:
863 case GL_MAP2_VERTEX_ATTRIB12_4_NV
:
864 case GL_MAP2_VERTEX_ATTRIB13_4_NV
:
865 case GL_MAP2_VERTEX_ATTRIB14_4_NV
:
866 case GL_MAP2_VERTEX_ATTRIB15_4_NV
:
867 CHECK_EXTENSION(NV_vertex_program
, cap
);
869 const GLuint map
= (GLuint
) (cap
- GL_MAP2_VERTEX_ATTRIB0_4_NV
);
870 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
871 ctx
->Eval
.Map2Attrib
[map
] = state
;
874 #endif /* FEATURE_NV_vertex_program */
876 #if FEATURE_NV_fragment_program
877 case GL_FRAGMENT_PROGRAM_NV
:
878 CHECK_EXTENSION(NV_fragment_program
, cap
);
879 if (ctx
->FragmentProgram
.Enabled
== state
)
881 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
882 ctx
->FragmentProgram
.Enabled
= state
;
884 #endif /* FEATURE_NV_fragment_program */
886 /* GL_NV_texture_rectangle */
887 case GL_TEXTURE_RECTANGLE_NV
:
888 CHECK_EXTENSION(NV_texture_rectangle
, cap
);
890 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
891 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
892 GLuint newenabled
= texUnit
->Enabled
& ~TEXTURE_RECT_BIT
;
893 CHECK_EXTENSION(NV_texture_rectangle
, cap
);
895 newenabled
|= TEXTURE_RECT_BIT
;
896 if (!ctx
->Visual
.rgbMode
|| texUnit
->Enabled
== newenabled
)
898 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
899 texUnit
->Enabled
= newenabled
;
903 /* GL_EXT_stencil_two_side */
904 case GL_STENCIL_TEST_TWO_SIDE_EXT
:
905 CHECK_EXTENSION(EXT_stencil_two_side
, cap
);
906 if (ctx
->Stencil
.TestTwoSide
== state
)
908 FLUSH_VERTICES(ctx
, _NEW_STENCIL
);
909 ctx
->Stencil
.TestTwoSide
= state
;
913 _mesa_error(ctx
, GL_INVALID_ENUM
,
914 "%s(0x%x)", state
? "glEnable" : "glDisable", cap
);
918 if (ctx
->Driver
.Enable
) {
919 (*ctx
->Driver
.Enable
)( ctx
, cap
, state
);
925 _mesa_Enable( GLenum cap
)
927 GET_CURRENT_CONTEXT(ctx
);
928 ASSERT_OUTSIDE_BEGIN_END(ctx
);
930 _mesa_set_enable( ctx
, cap
, GL_TRUE
);
935 _mesa_Disable( GLenum cap
)
937 GET_CURRENT_CONTEXT(ctx
);
938 ASSERT_OUTSIDE_BEGIN_END(ctx
);
940 _mesa_set_enable( ctx
, cap
, GL_FALSE
);
944 #undef CHECK_EXTENSION
945 #define CHECK_EXTENSION(EXTNAME) \
946 if (!ctx->Extensions.EXTNAME) { \
947 _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \
953 _mesa_IsEnabled( GLenum cap
)
955 GET_CURRENT_CONTEXT(ctx
);
958 return ctx
->Color
.AlphaEnabled
;
960 return ctx
->Eval
.AutoNormal
;
962 return ctx
->Color
.BlendEnabled
;
969 return (ctx
->Transform
.ClipPlanesEnabled
>> (cap
- GL_CLIP_PLANE0
)) & 1;
970 case GL_COLOR_MATERIAL
:
971 return ctx
->Light
.ColorMaterialEnabled
;
973 return ctx
->Polygon
.CullFlag
;
975 return ctx
->Depth
.Test
;
977 return ctx
->Color
.DitherFlag
;
979 return ctx
->Fog
.Enabled
;
981 return ctx
->Light
.Enabled
;
990 return ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
;
992 return ctx
->Line
.SmoothFlag
;
993 case GL_LINE_STIPPLE
:
994 return ctx
->Line
.StippleFlag
;
995 case GL_INDEX_LOGIC_OP
:
996 return ctx
->Color
.IndexLogicOpEnabled
;
997 case GL_COLOR_LOGIC_OP
:
998 return ctx
->Color
.ColorLogicOpEnabled
;
999 case GL_MAP1_COLOR_4
:
1000 return ctx
->Eval
.Map1Color4
;
1002 return ctx
->Eval
.Map1Index
;
1003 case GL_MAP1_NORMAL
:
1004 return ctx
->Eval
.Map1Normal
;
1005 case GL_MAP1_TEXTURE_COORD_1
:
1006 return ctx
->Eval
.Map1TextureCoord1
;
1007 case GL_MAP1_TEXTURE_COORD_2
:
1008 return ctx
->Eval
.Map1TextureCoord2
;
1009 case GL_MAP1_TEXTURE_COORD_3
:
1010 return ctx
->Eval
.Map1TextureCoord3
;
1011 case GL_MAP1_TEXTURE_COORD_4
:
1012 return ctx
->Eval
.Map1TextureCoord4
;
1013 case GL_MAP1_VERTEX_3
:
1014 return ctx
->Eval
.Map1Vertex3
;
1015 case GL_MAP1_VERTEX_4
:
1016 return ctx
->Eval
.Map1Vertex4
;
1017 case GL_MAP2_COLOR_4
:
1018 return ctx
->Eval
.Map2Color4
;
1020 return ctx
->Eval
.Map2Index
;
1021 case GL_MAP2_NORMAL
:
1022 return ctx
->Eval
.Map2Normal
;
1023 case GL_MAP2_TEXTURE_COORD_1
:
1024 return ctx
->Eval
.Map2TextureCoord1
;
1025 case GL_MAP2_TEXTURE_COORD_2
:
1026 return ctx
->Eval
.Map2TextureCoord2
;
1027 case GL_MAP2_TEXTURE_COORD_3
:
1028 return ctx
->Eval
.Map2TextureCoord3
;
1029 case GL_MAP2_TEXTURE_COORD_4
:
1030 return ctx
->Eval
.Map2TextureCoord4
;
1031 case GL_MAP2_VERTEX_3
:
1032 return ctx
->Eval
.Map2Vertex3
;
1033 case GL_MAP2_VERTEX_4
:
1034 return ctx
->Eval
.Map2Vertex4
;
1036 return ctx
->Transform
.Normalize
;
1037 case GL_POINT_SMOOTH
:
1038 return ctx
->Point
.SmoothFlag
;
1039 case GL_POLYGON_SMOOTH
:
1040 return ctx
->Polygon
.SmoothFlag
;
1041 case GL_POLYGON_STIPPLE
:
1042 return ctx
->Polygon
.StippleFlag
;
1043 case GL_POLYGON_OFFSET_POINT
:
1044 return ctx
->Polygon
.OffsetPoint
;
1045 case GL_POLYGON_OFFSET_LINE
:
1046 return ctx
->Polygon
.OffsetLine
;
1047 case GL_POLYGON_OFFSET_FILL
:
1048 /*case GL_POLYGON_OFFSET_EXT:*/
1049 return ctx
->Polygon
.OffsetFill
;
1050 case GL_RESCALE_NORMAL_EXT
:
1051 return ctx
->Transform
.RescaleNormals
;
1052 case GL_SCISSOR_TEST
:
1053 return ctx
->Scissor
.Enabled
;
1054 case GL_SHARED_TEXTURE_PALETTE_EXT
:
1055 return ctx
->Texture
.SharedPalette
;
1056 case GL_STENCIL_TEST
:
1057 return ctx
->Stencil
.Enabled
;
1060 const struct gl_texture_unit
*texUnit
;
1061 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1062 return (texUnit
->Enabled
& TEXTURE_1D_BIT
) ? GL_TRUE
: GL_FALSE
;
1066 const struct gl_texture_unit
*texUnit
;
1067 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1068 return (texUnit
->Enabled
& TEXTURE_2D_BIT
) ? GL_TRUE
: GL_FALSE
;
1072 const struct gl_texture_unit
*texUnit
;
1073 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1074 return (texUnit
->Enabled
& TEXTURE_3D_BIT
) ? GL_TRUE
: GL_FALSE
;
1076 case GL_TEXTURE_GEN_Q
:
1078 const struct gl_texture_unit
*texUnit
;
1079 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1080 return (texUnit
->TexGenEnabled
& Q_BIT
) ? GL_TRUE
: GL_FALSE
;
1082 case GL_TEXTURE_GEN_R
:
1084 const struct gl_texture_unit
*texUnit
;
1085 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1086 return (texUnit
->TexGenEnabled
& R_BIT
) ? GL_TRUE
: GL_FALSE
;
1088 case GL_TEXTURE_GEN_S
:
1090 const struct gl_texture_unit
*texUnit
;
1091 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1092 return (texUnit
->TexGenEnabled
& S_BIT
) ? GL_TRUE
: GL_FALSE
;
1094 case GL_TEXTURE_GEN_T
:
1096 const struct gl_texture_unit
*texUnit
;
1097 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1098 return (texUnit
->TexGenEnabled
& T_BIT
) ? GL_TRUE
: GL_FALSE
;
1104 case GL_VERTEX_ARRAY
:
1105 return (ctx
->Array
.Vertex
.Enabled
!= 0);
1106 case GL_NORMAL_ARRAY
:
1107 return (ctx
->Array
.Normal
.Enabled
!= 0);
1108 case GL_COLOR_ARRAY
:
1109 return (ctx
->Array
.Color
.Enabled
!= 0);
1110 case GL_INDEX_ARRAY
:
1111 return (ctx
->Array
.Index
.Enabled
!= 0);
1112 case GL_TEXTURE_COORD_ARRAY
:
1113 return (ctx
->Array
.TexCoord
[ctx
->Array
.ActiveTexture
].Enabled
!= 0);
1114 case GL_EDGE_FLAG_ARRAY
:
1115 return (ctx
->Array
.EdgeFlag
.Enabled
!= 0);
1116 case GL_FOG_COORDINATE_ARRAY_EXT
:
1117 CHECK_EXTENSION(EXT_fog_coord
);
1118 return (ctx
->Array
.FogCoord
.Enabled
!= 0);
1119 case GL_SECONDARY_COLOR_ARRAY_EXT
:
1120 CHECK_EXTENSION(EXT_secondary_color
);
1121 return (ctx
->Array
.SecondaryColor
.Enabled
!= 0);
1123 /* GL_EXT_histogram */
1125 CHECK_EXTENSION(EXT_histogram
);
1126 return ctx
->Pixel
.HistogramEnabled
;
1128 CHECK_EXTENSION(EXT_histogram
);
1129 return ctx
->Pixel
.MinMaxEnabled
;
1131 /* GL_HP_occlusion_test */
1132 case GL_OCCLUSION_TEST_HP
:
1133 CHECK_EXTENSION(HP_occlusion_test
);
1134 return ctx
->Depth
.OcclusionTest
;
1136 /* GL_SGIS_pixel_texture */
1137 case GL_PIXEL_TEXTURE_SGIS
:
1138 CHECK_EXTENSION(SGIS_pixel_texture
);
1139 return ctx
->Pixel
.PixelTextureEnabled
;
1141 /* GL_SGIX_pixel_texture */
1142 case GL_PIXEL_TEX_GEN_SGIX
:
1143 CHECK_EXTENSION(SGIX_pixel_texture
);
1144 return ctx
->Pixel
.PixelTextureEnabled
;
1146 /* GL_SGI_color_table */
1147 case GL_COLOR_TABLE_SGI
:
1148 CHECK_EXTENSION(SGI_color_table
);
1149 return ctx
->Pixel
.ColorTableEnabled
;
1150 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI
:
1151 CHECK_EXTENSION(SGI_color_table
);
1152 return ctx
->Pixel
.PostConvolutionColorTableEnabled
;
1153 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
:
1154 CHECK_EXTENSION(SGI_color_table
);
1155 return ctx
->Pixel
.PostColorMatrixColorTableEnabled
;
1157 /* GL_EXT_convolution */
1158 case GL_CONVOLUTION_1D
:
1159 CHECK_EXTENSION(EXT_convolution
);
1160 return ctx
->Pixel
.Convolution1DEnabled
;
1161 case GL_CONVOLUTION_2D
:
1162 CHECK_EXTENSION(EXT_convolution
);
1163 return ctx
->Pixel
.Convolution2DEnabled
;
1164 case GL_SEPARABLE_2D
:
1165 CHECK_EXTENSION(EXT_convolution
);
1166 return ctx
->Pixel
.Separable2DEnabled
;
1168 /* GL_ARB_texture_cube_map */
1169 case GL_TEXTURE_CUBE_MAP_ARB
:
1170 CHECK_EXTENSION(ARB_texture_cube_map
);
1172 const struct gl_texture_unit
*texUnit
;
1173 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1174 return (texUnit
->Enabled
& TEXTURE_CUBE_BIT
) ? GL_TRUE
: GL_FALSE
;
1177 /* GL_ARB_multisample */
1178 case GL_MULTISAMPLE_ARB
:
1179 CHECK_EXTENSION(ARB_multisample
);
1180 return ctx
->Multisample
.Enabled
;
1181 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
:
1182 CHECK_EXTENSION(ARB_multisample
);
1183 return ctx
->Multisample
.SampleAlphaToCoverage
;
1184 case GL_SAMPLE_ALPHA_TO_ONE_ARB
:
1185 CHECK_EXTENSION(ARB_multisample
);
1186 return ctx
->Multisample
.SampleAlphaToOne
;
1187 case GL_SAMPLE_COVERAGE_ARB
:
1188 CHECK_EXTENSION(ARB_multisample
);
1189 return ctx
->Multisample
.SampleCoverage
;
1190 case GL_SAMPLE_COVERAGE_INVERT_ARB
:
1191 CHECK_EXTENSION(ARB_multisample
);
1192 return ctx
->Multisample
.SampleCoverageInvert
;
1194 /* GL_IBM_rasterpos_clip */
1195 case GL_RASTER_POSITION_UNCLIPPED_IBM
:
1196 CHECK_EXTENSION(IBM_rasterpos_clip
);
1197 return ctx
->Transform
.RasterPositionUnclipped
;
1199 /* GL_NV_point_sprite */
1200 case GL_POINT_SPRITE_NV
:
1201 return ctx
->Point
.PointSprite
;
1203 #if FEATURE_NV_vertex_program
1204 case GL_VERTEX_PROGRAM_NV
:
1205 CHECK_EXTENSION(NV_vertex_program
);
1206 return ctx
->VertexProgram
.Enabled
;
1207 case GL_VERTEX_PROGRAM_POINT_SIZE_NV
:
1208 CHECK_EXTENSION(NV_vertex_program
);
1209 return ctx
->VertexProgram
.PointSizeEnabled
;
1210 case GL_VERTEX_PROGRAM_TWO_SIDE_NV
:
1211 CHECK_EXTENSION(NV_vertex_program
);
1212 return ctx
->VertexProgram
.TwoSideEnabled
;
1213 case GL_VERTEX_ATTRIB_ARRAY0_NV
:
1214 case GL_VERTEX_ATTRIB_ARRAY1_NV
:
1215 case GL_VERTEX_ATTRIB_ARRAY2_NV
:
1216 case GL_VERTEX_ATTRIB_ARRAY3_NV
:
1217 case GL_VERTEX_ATTRIB_ARRAY4_NV
:
1218 case GL_VERTEX_ATTRIB_ARRAY5_NV
:
1219 case GL_VERTEX_ATTRIB_ARRAY6_NV
:
1220 case GL_VERTEX_ATTRIB_ARRAY7_NV
:
1221 case GL_VERTEX_ATTRIB_ARRAY8_NV
:
1222 case GL_VERTEX_ATTRIB_ARRAY9_NV
:
1223 case GL_VERTEX_ATTRIB_ARRAY10_NV
:
1224 case GL_VERTEX_ATTRIB_ARRAY11_NV
:
1225 case GL_VERTEX_ATTRIB_ARRAY12_NV
:
1226 case GL_VERTEX_ATTRIB_ARRAY13_NV
:
1227 case GL_VERTEX_ATTRIB_ARRAY14_NV
:
1228 case GL_VERTEX_ATTRIB_ARRAY15_NV
:
1229 CHECK_EXTENSION(NV_vertex_program
);
1231 GLint n
= (GLint
) cap
- GL_VERTEX_ATTRIB_ARRAY0_NV
;
1232 return (ctx
->Array
.VertexAttrib
[n
].Enabled
!= 0);
1234 case GL_MAP1_VERTEX_ATTRIB0_4_NV
:
1235 case GL_MAP1_VERTEX_ATTRIB1_4_NV
:
1236 case GL_MAP1_VERTEX_ATTRIB2_4_NV
:
1237 case GL_MAP1_VERTEX_ATTRIB3_4_NV
:
1238 case GL_MAP1_VERTEX_ATTRIB4_4_NV
:
1239 case GL_MAP1_VERTEX_ATTRIB5_4_NV
:
1240 case GL_MAP1_VERTEX_ATTRIB6_4_NV
:
1241 case GL_MAP1_VERTEX_ATTRIB7_4_NV
:
1242 case GL_MAP1_VERTEX_ATTRIB8_4_NV
:
1243 case GL_MAP1_VERTEX_ATTRIB9_4_NV
:
1244 case GL_MAP1_VERTEX_ATTRIB10_4_NV
:
1245 case GL_MAP1_VERTEX_ATTRIB11_4_NV
:
1246 case GL_MAP1_VERTEX_ATTRIB12_4_NV
:
1247 case GL_MAP1_VERTEX_ATTRIB13_4_NV
:
1248 case GL_MAP1_VERTEX_ATTRIB14_4_NV
:
1249 case GL_MAP1_VERTEX_ATTRIB15_4_NV
:
1250 CHECK_EXTENSION(NV_vertex_program
);
1252 const GLuint map
= (GLuint
) (cap
- GL_MAP1_VERTEX_ATTRIB0_4_NV
);
1253 return ctx
->Eval
.Map1Attrib
[map
];
1255 case GL_MAP2_VERTEX_ATTRIB0_4_NV
:
1256 case GL_MAP2_VERTEX_ATTRIB1_4_NV
:
1257 case GL_MAP2_VERTEX_ATTRIB2_4_NV
:
1258 case GL_MAP2_VERTEX_ATTRIB3_4_NV
:
1259 case GL_MAP2_VERTEX_ATTRIB4_4_NV
:
1260 case GL_MAP2_VERTEX_ATTRIB5_4_NV
:
1261 case GL_MAP2_VERTEX_ATTRIB6_4_NV
:
1262 case GL_MAP2_VERTEX_ATTRIB7_4_NV
:
1263 case GL_MAP2_VERTEX_ATTRIB8_4_NV
:
1264 case GL_MAP2_VERTEX_ATTRIB9_4_NV
:
1265 case GL_MAP2_VERTEX_ATTRIB10_4_NV
:
1266 case GL_MAP2_VERTEX_ATTRIB11_4_NV
:
1267 case GL_MAP2_VERTEX_ATTRIB12_4_NV
:
1268 case GL_MAP2_VERTEX_ATTRIB13_4_NV
:
1269 case GL_MAP2_VERTEX_ATTRIB14_4_NV
:
1270 case GL_MAP2_VERTEX_ATTRIB15_4_NV
:
1271 CHECK_EXTENSION(NV_vertex_program
);
1273 const GLuint map
= (GLuint
) (cap
- GL_MAP2_VERTEX_ATTRIB0_4_NV
);
1274 return ctx
->Eval
.Map2Attrib
[map
];
1276 #endif /* FEATURE_NV_vertex_program */
1278 #if FEATURE_NV_fragment_program
1279 case GL_FRAGMENT_PROGRAM_NV
:
1280 CHECK_EXTENSION(NV_fragment_program
);
1281 return ctx
->FragmentProgram
.Enabled
;
1282 #endif /* FEATURE_NV_fragment_program */
1284 /* GL_NV_texture_rectangle */
1285 case GL_TEXTURE_RECTANGLE_NV
:
1286 CHECK_EXTENSION(NV_texture_rectangle
);
1288 const struct gl_texture_unit
*texUnit
;
1289 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1290 return (texUnit
->Enabled
& TEXTURE_RECT_BIT
) ? GL_TRUE
: GL_FALSE
;
1293 /* GL_EXT_stencil_two_side */
1294 case GL_STENCIL_TEST_TWO_SIDE_EXT
:
1295 CHECK_EXTENSION(EXT_stencil_two_side
);
1296 return ctx
->Stencil
.TestTwoSide
;
1299 _mesa_error(ctx
, GL_INVALID_ENUM
, "glIsEnabled(0x%x)", (int) cap
);