1 /* $Id: enable.c,v 1.26 2000/10/21 01:29:12 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 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.
38 #include "simple_list.h"
48 * Perform glEnable and glDisable calls.
50 void _mesa_set_enable( GLcontext
*ctx
, GLenum cap
, GLboolean state
)
52 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
, "gl_enable/disable" );
54 if (MESA_VERBOSE
& VERBOSE_API
)
55 fprintf(stderr
, "%s %s (newstate is %x)\n",
56 state
? "glEnable" : "glDisable",
57 gl_lookup_enum_by_nr(cap
),
62 if (ctx
->Color
.AlphaEnabled
!=state
) {
63 ctx
->Color
.AlphaEnabled
= state
;
64 ctx
->NewState
|= NEW_RASTER_OPS
;
68 ctx
->Eval
.AutoNormal
= state
;
71 if (ctx
->Color
.BlendEnabled
!=state
) {
72 ctx
->Color
.BlendEnabled
= state
;
73 /* The following needed to accomodate 1.0 RGB logic op blending */
74 if (ctx
->Color
.BlendEquation
==GL_LOGIC_OP
&& state
) {
75 ctx
->Color
.ColorLogicOpEnabled
= GL_TRUE
;
78 ctx
->Color
.ColorLogicOpEnabled
= GL_FALSE
;
80 ctx
->NewState
|= NEW_RASTER_OPS
;
89 if (cap
>= GL_CLIP_PLANE0
&&
90 cap
<= GL_CLIP_PLANE5
&&
91 ctx
->Transform
.ClipEnabled
[cap
-GL_CLIP_PLANE0
] != state
)
93 GLuint p
= cap
-GL_CLIP_PLANE0
;
95 ctx
->Transform
.ClipEnabled
[p
] = state
;
96 ctx
->NewState
|= NEW_USER_CLIP
;
99 ctx
->Enabled
|= ENABLE_USERCLIP
;
100 ctx
->Transform
.AnyClip
++;
102 if (ctx
->ProjectionMatrix
.flags
& MAT_DIRTY_ALL_OVER
) {
103 gl_matrix_analyze( &ctx
->ProjectionMatrix
);
106 gl_transform_vector( ctx
->Transform
.ClipUserPlane
[p
],
107 ctx
->Transform
.EyeUserPlane
[p
],
108 ctx
->ProjectionMatrix
.inv
);
110 if (--ctx
->Transform
.AnyClip
== 0)
111 ctx
->Enabled
&= ~ENABLE_USERCLIP
;
115 case GL_COLOR_MATERIAL
:
116 if (ctx
->Light
.ColorMaterialEnabled
!=state
) {
117 ctx
->Light
.ColorMaterialEnabled
= state
;
118 ctx
->NewState
|= NEW_LIGHTING
;
120 gl_update_color_material( ctx
, ctx
->Current
.ByteColor
);
124 if (ctx
->Polygon
.CullFlag
!=state
) {
125 ctx
->Polygon
.CullFlag
= state
;
126 ctx
->TriangleCaps
^= DD_TRI_CULL
;
127 ctx
->NewState
|= NEW_POLYGON
;
131 if (state
&& ctx
->Visual
.DepthBits
==0) {
132 _mesa_warning(ctx
,"glEnable(GL_DEPTH_TEST) but no depth buffer");
135 if (ctx
->Depth
.Test
!=state
) {
136 ctx
->Depth
.Test
= state
;
137 ctx
->NewState
|= NEW_RASTER_OPS
;
142 /* MESA_NO_DITHER env var */
145 if (ctx
->Color
.DitherFlag
!=state
) {
146 ctx
->Color
.DitherFlag
= state
;
147 ctx
->NewState
|= NEW_RASTER_OPS
;
151 if (ctx
->Fog
.Enabled
!=state
) {
152 ctx
->Fog
.Enabled
= state
;
153 ctx
->Enabled
^= ENABLE_FOG
;
154 ctx
->NewState
|= NEW_FOG
|NEW_RASTER_OPS
;
158 if (ctx
->Extensions
.HaveHistogram
) {
159 ctx
->Pixel
.HistogramEnabled
= state
;
162 gl_error( ctx
, GL_INVALID_ENUM
, state
? "glEnable": "glDisable" );
174 if (ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
!= state
) {
175 ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
= state
;
178 insert_at_tail(&ctx
->Light
.EnabledList
,
179 &ctx
->Light
.Light
[cap
-GL_LIGHT0
]);
180 if (ctx
->Light
.Enabled
)
181 ctx
->Enabled
|= ENABLE_LIGHT
;
183 remove_from_list(&ctx
->Light
.Light
[cap
-GL_LIGHT0
]);
184 if (is_empty_list(&ctx
->Light
.EnabledList
))
185 ctx
->Enabled
&= ~ENABLE_LIGHT
;
188 ctx
->NewState
|= NEW_LIGHTING
;
192 if (ctx
->Light
.Enabled
!=state
) {
193 ctx
->Light
.Enabled
= state
;
194 ctx
->Enabled
&= ~ENABLE_LIGHT
;
196 ctx
->Enabled
|= ENABLE_LIGHT
;
197 ctx
->NewState
|= NEW_LIGHTING
;
201 if (ctx
->Line
.SmoothFlag
!=state
) {
202 ctx
->Line
.SmoothFlag
= state
;
203 ctx
->TriangleCaps
^= DD_LINE_SMOOTH
;
204 ctx
->NewState
|= NEW_RASTER_OPS
;
207 case GL_LINE_STIPPLE
:
208 if (ctx
->Line
.StippleFlag
!=state
) {
209 ctx
->Line
.StippleFlag
= state
;
210 ctx
->TriangleCaps
^= DD_LINE_STIPPLE
;
211 ctx
->NewState
|= NEW_RASTER_OPS
;
214 case GL_INDEX_LOGIC_OP
:
215 if (ctx
->Color
.IndexLogicOpEnabled
!=state
) {
216 ctx
->Color
.IndexLogicOpEnabled
= state
;
217 ctx
->NewState
|= NEW_RASTER_OPS
;
220 case GL_COLOR_LOGIC_OP
:
221 if (ctx
->Color
.ColorLogicOpEnabled
!=state
) {
222 ctx
->Color
.ColorLogicOpEnabled
= state
;
223 ctx
->NewState
|= NEW_RASTER_OPS
;
226 case GL_MAP1_COLOR_4
:
227 ctx
->Eval
.Map1Color4
= state
;
230 ctx
->Eval
.Map1Index
= state
;
233 ctx
->Eval
.Map1Normal
= state
;
235 case GL_MAP1_TEXTURE_COORD_1
:
236 ctx
->Eval
.Map1TextureCoord1
= state
;
238 case GL_MAP1_TEXTURE_COORD_2
:
239 ctx
->Eval
.Map1TextureCoord2
= state
;
241 case GL_MAP1_TEXTURE_COORD_3
:
242 ctx
->Eval
.Map1TextureCoord3
= state
;
244 case GL_MAP1_TEXTURE_COORD_4
:
245 ctx
->Eval
.Map1TextureCoord4
= state
;
247 case GL_MAP1_VERTEX_3
:
248 ctx
->Eval
.Map1Vertex3
= state
;
250 case GL_MAP1_VERTEX_4
:
251 ctx
->Eval
.Map1Vertex4
= state
;
253 case GL_MAP2_COLOR_4
:
254 ctx
->Eval
.Map2Color4
= state
;
257 ctx
->Eval
.Map2Index
= state
;
260 ctx
->Eval
.Map2Normal
= state
;
262 case GL_MAP2_TEXTURE_COORD_1
:
263 ctx
->Eval
.Map2TextureCoord1
= state
;
265 case GL_MAP2_TEXTURE_COORD_2
:
266 ctx
->Eval
.Map2TextureCoord2
= state
;
268 case GL_MAP2_TEXTURE_COORD_3
:
269 ctx
->Eval
.Map2TextureCoord3
= state
;
271 case GL_MAP2_TEXTURE_COORD_4
:
272 ctx
->Eval
.Map2TextureCoord4
= state
;
274 case GL_MAP2_VERTEX_3
:
275 ctx
->Eval
.Map2Vertex3
= state
;
277 case GL_MAP2_VERTEX_4
:
278 ctx
->Eval
.Map2Vertex4
= state
;
281 ctx
->Pixel
.MinMaxEnabled
= state
;
284 if (ctx
->Transform
.Normalize
!= state
) {
285 ctx
->Transform
.Normalize
= state
;
286 ctx
->NewState
|= NEW_NORMAL_TRANSFORM
|NEW_LIGHTING
;
287 ctx
->Enabled
^= ENABLE_NORMALIZE
;
290 case GL_POINT_SMOOTH
:
291 if (ctx
->Point
.SmoothFlag
!=state
) {
292 ctx
->Point
.SmoothFlag
= state
;
293 ctx
->TriangleCaps
^= DD_POINT_SMOOTH
;
294 ctx
->NewState
|= NEW_RASTER_OPS
;
297 case GL_POLYGON_SMOOTH
:
298 if (ctx
->Polygon
.SmoothFlag
!=state
) {
299 ctx
->Polygon
.SmoothFlag
= state
;
300 ctx
->TriangleCaps
^= DD_TRI_SMOOTH
;
301 ctx
->NewState
|= NEW_RASTER_OPS
;
304 case GL_POLYGON_STIPPLE
:
305 if (ctx
->Polygon
.StippleFlag
!=state
) {
306 ctx
->Polygon
.StippleFlag
= state
;
307 ctx
->TriangleCaps
^= DD_TRI_STIPPLE
;
308 ctx
->NewState
|= NEW_RASTER_OPS
;
311 case GL_POLYGON_OFFSET_POINT
:
312 if (ctx
->Polygon
.OffsetPoint
!=state
) {
313 ctx
->Polygon
.OffsetPoint
= state
;
314 ctx
->NewState
|= NEW_POLYGON
;
317 case GL_POLYGON_OFFSET_LINE
:
318 if (ctx
->Polygon
.OffsetLine
!=state
) {
319 ctx
->Polygon
.OffsetLine
= state
;
320 ctx
->NewState
|= NEW_POLYGON
;
323 case GL_POLYGON_OFFSET_FILL
:
324 /*case GL_POLYGON_OFFSET_EXT:*/
325 if (ctx
->Polygon
.OffsetFill
!=state
) {
326 ctx
->Polygon
.OffsetFill
= state
;
327 ctx
->NewState
|= NEW_POLYGON
;
330 case GL_RESCALE_NORMAL_EXT
:
331 if (ctx
->Transform
.RescaleNormals
!= state
) {
332 ctx
->Transform
.RescaleNormals
= state
;
333 ctx
->NewState
|= NEW_NORMAL_TRANSFORM
|NEW_LIGHTING
;
334 ctx
->Enabled
^= ENABLE_RESCALE
;
337 case GL_SCISSOR_TEST
:
338 if (ctx
->Scissor
.Enabled
!=state
) {
339 ctx
->Scissor
.Enabled
= state
;
340 ctx
->NewState
|= NEW_RASTER_OPS
;
343 case GL_SHARED_TEXTURE_PALETTE_EXT
:
344 ctx
->Texture
.SharedPalette
= state
;
346 case GL_STENCIL_TEST
:
347 if (state
&& ctx
->Visual
.StencilBits
==0) {
348 _mesa_warning(ctx
, "glEnable(GL_STENCIL_TEST) but no stencil buffer");
351 if (ctx
->Stencil
.Enabled
!=state
) {
352 ctx
->Stencil
.Enabled
= state
;
353 ctx
->NewState
|= NEW_RASTER_OPS
;
354 ctx
->TriangleCaps
^= DD_STENCIL
;
358 if (ctx
->Visual
.RGBAflag
) {
359 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
360 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
361 ctx
->NewState
|= NEW_TEXTURE_ENABLE
;
363 texUnit
->Enabled
|= TEXTURE0_1D
;
366 texUnit
->Enabled
&= ~TEXTURE0_1D
;
371 if (ctx
->Visual
.RGBAflag
) {
372 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
373 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
374 ctx
->NewState
|= NEW_TEXTURE_ENABLE
;
376 texUnit
->Enabled
|= TEXTURE0_2D
;
379 texUnit
->Enabled
&= ~TEXTURE0_2D
;
384 if (ctx
->Visual
.RGBAflag
) {
385 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
386 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
387 ctx
->NewState
|= NEW_TEXTURE_ENABLE
;
389 texUnit
->Enabled
|= TEXTURE0_3D
;
392 texUnit
->Enabled
&= ~TEXTURE0_3D
;
396 case GL_TEXTURE_GEN_Q
:
398 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
400 texUnit
->TexGenEnabled
|= Q_BIT
;
402 texUnit
->TexGenEnabled
&= ~Q_BIT
;
403 ctx
->NewState
|= NEW_TEXTURING
;
406 case GL_TEXTURE_GEN_R
:
408 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
410 texUnit
->TexGenEnabled
|= R_BIT
;
412 texUnit
->TexGenEnabled
&= ~R_BIT
;
413 ctx
->NewState
|= NEW_TEXTURING
;
416 case GL_TEXTURE_GEN_S
:
418 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
420 texUnit
->TexGenEnabled
|= S_BIT
;
422 texUnit
->TexGenEnabled
&= ~S_BIT
;
423 ctx
->NewState
|= NEW_TEXTURING
;
426 case GL_TEXTURE_GEN_T
:
428 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
430 texUnit
->TexGenEnabled
|= T_BIT
;
432 texUnit
->TexGenEnabled
&= ~T_BIT
;
433 ctx
->NewState
|= NEW_TEXTURING
;
440 case GL_VERTEX_ARRAY
:
441 ctx
->Array
.Vertex
.Enabled
= state
;
443 case GL_NORMAL_ARRAY
:
444 ctx
->Array
.Normal
.Enabled
= state
;
447 ctx
->Array
.Color
.Enabled
= state
;
450 ctx
->Array
.Index
.Enabled
= state
;
452 case GL_TEXTURE_COORD_ARRAY
:
453 ctx
->Array
.TexCoord
[ctx
->Array
.ActiveTexture
].Enabled
= state
;
455 case GL_EDGE_FLAG_ARRAY
:
456 ctx
->Array
.EdgeFlag
.Enabled
= state
;
459 /* GL_HP_occlusion_test */
460 case GL_OCCLUSION_TEST_HP
:
461 if (ctx
->Extensions
.HaveHpOcclusionTest
) {
462 ctx
->Depth
.OcclusionTest
= state
;
464 ctx
->OcclusionResult
= ctx
->OcclusionResultSaved
;
466 ctx
->OcclusionResultSaved
= ctx
->OcclusionResult
;
467 ctx
->NewState
|= NEW_RASTER_OPS
;
470 gl_error( ctx
, GL_INVALID_ENUM
, state
? "glEnable": "glDisable" );
475 /* GL_SGIS_pixel_texture */
476 case GL_PIXEL_TEXTURE_SGIS
:
477 /* XXX check for extension */
478 ctx
->Pixel
.PixelTextureEnabled
= state
;
481 /* GL_SGIX_pixel_texture */
482 case GL_PIXEL_TEX_GEN_SGIX
:
483 /* XXX check for extension */
484 ctx
->Pixel
.PixelTextureEnabled
= state
;
487 /* GL_SGI_color_table */
488 case GL_COLOR_TABLE_SGI
:
489 /* XXX check for extension */
490 ctx
->Pixel
.ColorTableEnabled
= state
;
491 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
493 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI
:
494 ctx
->Pixel
.PostConvolutionColorTableEnabled
= state
;
495 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
497 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
:
498 ctx
->Pixel
.PostColorMatrixColorTableEnabled
= state
;
499 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
502 /* GL_EXT_convolution */
503 case GL_CONVOLUTION_1D
:
504 /* XXX check for extension */
505 ctx
->Pixel
.Convolution1DEnabled
= state
;
506 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
508 case GL_CONVOLUTION_2D
:
509 ctx
->Pixel
.Convolution2DEnabled
= state
;
510 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
512 case GL_SEPARABLE_2D
:
513 ctx
->Pixel
.Separable2DEnabled
= state
;
514 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
517 /* GL_ARB_texture_cube_map */
518 case GL_TEXTURE_CUBE_MAP_ARB
:
519 if (ctx
->Extensions
.HaveTextureCubeMap
) {
520 if (ctx
->Visual
.RGBAflag
) {
521 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
522 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
523 ctx
->NewState
|= NEW_TEXTURE_ENABLE
;
525 texUnit
->Enabled
|= TEXTURE0_CUBE
;
528 texUnit
->Enabled
&= ~TEXTURE0_CUBE
;
533 gl_error(ctx
, GL_INVALID_ENUM
, state
? "glEnable" : "glDisable");
539 gl_error(ctx
, GL_INVALID_ENUM
, state
? "glEnable" : "glDisable");
543 if (ctx
->Driver
.Enable
) {
544 (*ctx
->Driver
.Enable
)( ctx
, cap
, state
);
552 _mesa_Enable( GLenum cap
)
554 GET_CURRENT_CONTEXT(ctx
);
555 _mesa_set_enable( ctx
, cap
, GL_TRUE
);
561 _mesa_Disable( GLenum cap
)
563 GET_CURRENT_CONTEXT(ctx
);
564 _mesa_set_enable( ctx
, cap
, GL_FALSE
);
570 _mesa_IsEnabled( GLenum cap
)
572 GET_CURRENT_CONTEXT(ctx
);
575 return ctx
->Color
.AlphaEnabled
;
577 return ctx
->Eval
.AutoNormal
;
579 return ctx
->Color
.BlendEnabled
;
586 return ctx
->Transform
.ClipEnabled
[cap
-GL_CLIP_PLANE0
];
587 case GL_COLOR_MATERIAL
:
588 return ctx
->Light
.ColorMaterialEnabled
;
590 return ctx
->Polygon
.CullFlag
;
592 return ctx
->Depth
.Test
;
594 return ctx
->Color
.DitherFlag
;
596 return ctx
->Fog
.Enabled
;
598 if (ctx
->Extensions
.HaveHistogram
) {
599 return ctx
->Pixel
.HistogramEnabled
;
602 gl_error(ctx
, GL_INVALID_ENUM
, "glIsEnabled");
606 return ctx
->Light
.Enabled
;
615 return ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
;
617 return ctx
->Line
.SmoothFlag
;
618 case GL_LINE_STIPPLE
:
619 return ctx
->Line
.StippleFlag
;
620 case GL_INDEX_LOGIC_OP
:
621 return ctx
->Color
.IndexLogicOpEnabled
;
622 case GL_COLOR_LOGIC_OP
:
623 return ctx
->Color
.ColorLogicOpEnabled
;
624 case GL_MAP1_COLOR_4
:
625 return ctx
->Eval
.Map1Color4
;
627 return ctx
->Eval
.Map1Index
;
629 return ctx
->Eval
.Map1Normal
;
630 case GL_MAP1_TEXTURE_COORD_1
:
631 return ctx
->Eval
.Map1TextureCoord1
;
632 case GL_MAP1_TEXTURE_COORD_2
:
633 return ctx
->Eval
.Map1TextureCoord2
;
634 case GL_MAP1_TEXTURE_COORD_3
:
635 return ctx
->Eval
.Map1TextureCoord3
;
636 case GL_MAP1_TEXTURE_COORD_4
:
637 return ctx
->Eval
.Map1TextureCoord4
;
638 case GL_MAP1_VERTEX_3
:
639 return ctx
->Eval
.Map1Vertex3
;
640 case GL_MAP1_VERTEX_4
:
641 return ctx
->Eval
.Map1Vertex4
;
642 case GL_MAP2_COLOR_4
:
643 return ctx
->Eval
.Map2Color4
;
645 return ctx
->Eval
.Map2Index
;
647 return ctx
->Eval
.Map2Normal
;
648 case GL_MAP2_TEXTURE_COORD_1
:
649 return ctx
->Eval
.Map2TextureCoord1
;
650 case GL_MAP2_TEXTURE_COORD_2
:
651 return ctx
->Eval
.Map2TextureCoord2
;
652 case GL_MAP2_TEXTURE_COORD_3
:
653 return ctx
->Eval
.Map2TextureCoord3
;
654 case GL_MAP2_TEXTURE_COORD_4
:
655 return ctx
->Eval
.Map2TextureCoord4
;
656 case GL_MAP2_VERTEX_3
:
657 return ctx
->Eval
.Map2Vertex3
;
658 case GL_MAP2_VERTEX_4
:
659 return ctx
->Eval
.Map2Vertex4
;
661 return ctx
->Pixel
.MinMaxEnabled
;
663 return ctx
->Transform
.Normalize
;
664 case GL_POINT_SMOOTH
:
665 return ctx
->Point
.SmoothFlag
;
666 case GL_POLYGON_SMOOTH
:
667 return ctx
->Polygon
.SmoothFlag
;
668 case GL_POLYGON_STIPPLE
:
669 return ctx
->Polygon
.StippleFlag
;
670 case GL_POLYGON_OFFSET_POINT
:
671 return ctx
->Polygon
.OffsetPoint
;
672 case GL_POLYGON_OFFSET_LINE
:
673 return ctx
->Polygon
.OffsetLine
;
674 case GL_POLYGON_OFFSET_FILL
:
675 /*case GL_POLYGON_OFFSET_EXT:*/
676 return ctx
->Polygon
.OffsetFill
;
677 case GL_RESCALE_NORMAL_EXT
:
678 return ctx
->Transform
.RescaleNormals
;
679 case GL_SCISSOR_TEST
:
680 return ctx
->Scissor
.Enabled
;
681 case GL_SHARED_TEXTURE_PALETTE_EXT
:
682 return ctx
->Texture
.SharedPalette
;
683 case GL_STENCIL_TEST
:
684 return ctx
->Stencil
.Enabled
;
687 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
688 return (texUnit
->Enabled
& TEXTURE0_1D
) ? GL_TRUE
: GL_FALSE
;
692 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
693 return (texUnit
->Enabled
& TEXTURE0_2D
) ? GL_TRUE
: GL_FALSE
;
697 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
698 return (texUnit
->Enabled
& TEXTURE0_3D
) ? GL_TRUE
: GL_FALSE
;
700 case GL_TEXTURE_GEN_Q
:
702 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
703 return (texUnit
->TexGenEnabled
& Q_BIT
) ? GL_TRUE
: GL_FALSE
;
705 case GL_TEXTURE_GEN_R
:
707 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
708 return (texUnit
->TexGenEnabled
& R_BIT
) ? GL_TRUE
: GL_FALSE
;
710 case GL_TEXTURE_GEN_S
:
712 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
713 return (texUnit
->TexGenEnabled
& S_BIT
) ? GL_TRUE
: GL_FALSE
;
715 case GL_TEXTURE_GEN_T
:
717 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
718 return (texUnit
->TexGenEnabled
& T_BIT
) ? GL_TRUE
: GL_FALSE
;
724 case GL_VERTEX_ARRAY
:
725 return ctx
->Array
.Vertex
.Enabled
;
726 case GL_NORMAL_ARRAY
:
727 return ctx
->Array
.Normal
.Enabled
;
729 return ctx
->Array
.Color
.Enabled
;
731 return ctx
->Array
.Index
.Enabled
;
732 case GL_TEXTURE_COORD_ARRAY
:
733 return ctx
->Array
.TexCoord
[ctx
->Array
.ActiveTexture
].Enabled
;
734 case GL_EDGE_FLAG_ARRAY
:
735 return ctx
->Array
.EdgeFlag
.Enabled
;
737 /* GL_HP_occlusion_test */
738 case GL_OCCLUSION_TEST_HP
:
739 if (ctx
->Extensions
.HaveHpOcclusionTest
) {
740 return ctx
->Depth
.OcclusionTest
;
743 gl_error( ctx
, GL_INVALID_ENUM
, "glIsEnabled" );
747 /* GL_SGIS_pixel_texture */
748 case GL_PIXEL_TEXTURE_SGIS
:
749 return ctx
->Pixel
.PixelTextureEnabled
;
751 /* GL_SGIX_pixel_texture */
752 case GL_PIXEL_TEX_GEN_SGIX
:
753 return ctx
->Pixel
.PixelTextureEnabled
;
755 /* GL_SGI_color_table */
756 case GL_COLOR_TABLE_SGI
:
757 return ctx
->Pixel
.ColorTableEnabled
;
758 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI
:
759 return ctx
->Pixel
.PostConvolutionColorTableEnabled
;
760 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
:
761 return ctx
->Pixel
.PostColorMatrixColorTableEnabled
;
763 /* GL_EXT_convolution */
764 case GL_CONVOLUTION_1D
:
765 return ctx
->Pixel
.Convolution1DEnabled
;
766 case GL_CONVOLUTION_2D
:
767 return ctx
->Pixel
.Convolution2DEnabled
;
768 case GL_SEPARABLE_2D
:
769 return ctx
->Pixel
.Separable2DEnabled
;
771 /* GL_ARB_texture_cube_map */
772 case GL_TEXTURE_CUBE_MAP_ARB
:
773 if (ctx
->Extensions
.HaveTextureCubeMap
) {
774 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
775 return (texUnit
->Enabled
& TEXTURE0_CUBE
) ? GL_TRUE
: GL_FALSE
;
778 gl_error(ctx
, GL_INVALID_ENUM
, "glIsEnabled");
783 gl_error( ctx
, GL_INVALID_ENUM
, "glIsEnabled" );
792 client_state( GLcontext
*ctx
, GLenum cap
, GLboolean state
)
794 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
,
796 ? "glEnableClientState"
797 : "glDisableClientState") );
800 case GL_VERTEX_ARRAY
:
801 ctx
->Array
.Vertex
.Enabled
= state
;
803 case GL_NORMAL_ARRAY
:
804 ctx
->Array
.Normal
.Enabled
= state
;
807 ctx
->Array
.Color
.Enabled
= state
;
810 ctx
->Array
.Index
.Enabled
= state
;
812 case GL_TEXTURE_COORD_ARRAY
:
813 ctx
->Array
.TexCoord
[ctx
->Array
.ActiveTexture
].Enabled
= state
;
815 case GL_EDGE_FLAG_ARRAY
:
816 ctx
->Array
.EdgeFlag
.Enabled
= state
;
819 gl_error( ctx
, GL_INVALID_ENUM
, "glEnable/DisableClientState" );
822 ctx
->NewState
|= NEW_CLIENT_STATE
;
828 _mesa_EnableClientState( GLenum cap
)
830 GET_CURRENT_CONTEXT(ctx
);
831 client_state( ctx
, cap
, GL_TRUE
);
837 _mesa_DisableClientState( GLenum cap
)
839 GET_CURRENT_CONTEXT(ctx
);
840 client_state( ctx
, cap
, GL_FALSE
);