1 /* $Id: enable.c,v 1.25 2000/10/05 23:10:42 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999 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 const GLuint flag
= TEXTURE0_1D
<< (curr
* 4);
361 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
362 ctx
->NewState
|= NEW_TEXTURE_ENABLE
;
364 texUnit
->Enabled
|= TEXTURE0_1D
;
365 ctx
->Enabled
|= flag
;
368 texUnit
->Enabled
&= ~TEXTURE0_1D
;
369 ctx
->Enabled
&= ~flag
;
374 if (ctx
->Visual
.RGBAflag
) {
375 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
376 const GLuint flag
= TEXTURE0_2D
<< (curr
* 4);
377 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
378 ctx
->NewState
|= NEW_TEXTURE_ENABLE
;
380 texUnit
->Enabled
|= TEXTURE0_2D
;
381 ctx
->Enabled
|= flag
;
384 texUnit
->Enabled
&= ~TEXTURE0_2D
;
385 ctx
->Enabled
&= ~flag
;
390 if (ctx
->Visual
.RGBAflag
) {
391 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
392 const GLuint flag
= TEXTURE0_3D
<< (curr
* 4);
393 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
394 ctx
->NewState
|= NEW_TEXTURE_ENABLE
;
396 texUnit
->Enabled
|= TEXTURE0_3D
;
397 ctx
->Enabled
|= flag
;
400 texUnit
->Enabled
&= ~TEXTURE0_3D
;
401 ctx
->Enabled
&= ~flag
;
405 case GL_TEXTURE_GEN_Q
:
407 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
409 texUnit
->TexGenEnabled
|= Q_BIT
;
411 texUnit
->TexGenEnabled
&= ~Q_BIT
;
412 ctx
->NewState
|= NEW_TEXTURING
;
415 case GL_TEXTURE_GEN_R
:
417 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
419 texUnit
->TexGenEnabled
|= R_BIT
;
421 texUnit
->TexGenEnabled
&= ~R_BIT
;
422 ctx
->NewState
|= NEW_TEXTURING
;
425 case GL_TEXTURE_GEN_S
:
427 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
429 texUnit
->TexGenEnabled
|= S_BIT
;
431 texUnit
->TexGenEnabled
&= ~S_BIT
;
432 ctx
->NewState
|= NEW_TEXTURING
;
435 case GL_TEXTURE_GEN_T
:
437 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
439 texUnit
->TexGenEnabled
|= T_BIT
;
441 texUnit
->TexGenEnabled
&= ~T_BIT
;
442 ctx
->NewState
|= NEW_TEXTURING
;
449 case GL_VERTEX_ARRAY
:
450 ctx
->Array
.Vertex
.Enabled
= state
;
452 case GL_NORMAL_ARRAY
:
453 ctx
->Array
.Normal
.Enabled
= state
;
456 ctx
->Array
.Color
.Enabled
= state
;
459 ctx
->Array
.Index
.Enabled
= state
;
461 case GL_TEXTURE_COORD_ARRAY
:
462 ctx
->Array
.TexCoord
[ctx
->Array
.ActiveTexture
].Enabled
= state
;
464 case GL_EDGE_FLAG_ARRAY
:
465 ctx
->Array
.EdgeFlag
.Enabled
= state
;
468 /* GL_HP_occlusion_test */
469 case GL_OCCLUSION_TEST_HP
:
470 if (ctx
->Extensions
.HaveHpOcclusionTest
) {
471 ctx
->Depth
.OcclusionTest
= state
;
473 ctx
->OcclusionResult
= ctx
->OcclusionResultSaved
;
475 ctx
->OcclusionResultSaved
= ctx
->OcclusionResult
;
476 ctx
->NewState
|= NEW_RASTER_OPS
;
479 gl_error( ctx
, GL_INVALID_ENUM
, state
? "glEnable": "glDisable" );
484 /* GL_SGIS_pixel_texture */
485 case GL_PIXEL_TEXTURE_SGIS
:
486 /* XXX check for extension */
487 ctx
->Pixel
.PixelTextureEnabled
= state
;
490 /* GL_SGIX_pixel_texture */
491 case GL_PIXEL_TEX_GEN_SGIX
:
492 /* XXX check for extension */
493 ctx
->Pixel
.PixelTextureEnabled
= state
;
496 /* GL_SGI_color_table */
497 case GL_COLOR_TABLE_SGI
:
498 /* XXX check for extension */
499 ctx
->Pixel
.ColorTableEnabled
= state
;
500 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
502 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI
:
503 ctx
->Pixel
.PostConvolutionColorTableEnabled
= state
;
504 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
506 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
:
507 ctx
->Pixel
.PostColorMatrixColorTableEnabled
= state
;
508 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
511 /* GL_EXT_convolution */
512 case GL_CONVOLUTION_1D
:
513 /* XXX check for extension */
514 ctx
->Pixel
.Convolution1DEnabled
= state
;
515 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
517 case GL_CONVOLUTION_2D
:
518 ctx
->Pixel
.Convolution2DEnabled
= state
;
519 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
521 case GL_SEPARABLE_2D
:
522 ctx
->Pixel
.Separable2DEnabled
= state
;
523 ctx
->ImageTransferState
= UPDATE_IMAGE_TRANSFER_STATE
;
526 /* GL_ARB_texture_cube_map */
527 case GL_TEXTURE_CUBE_MAP_ARB
:
528 if (ctx
->Extensions
.HaveTextureCubeMap
) {
529 if (ctx
->Visual
.RGBAflag
) {
530 const GLuint curr
= ctx
->Texture
.CurrentUnit
;
531 const GLuint flag
= TEXTURE0_CUBE
<< (curr
* 4);
532 struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[curr
];
533 ctx
->NewState
|= NEW_TEXTURE_ENABLE
;
535 texUnit
->Enabled
|= TEXTURE0_CUBE
;
536 ctx
->Enabled
|= flag
;
539 texUnit
->Enabled
&= ~TEXTURE0_CUBE
;
540 ctx
->Enabled
&= ~flag
;
546 gl_error(ctx
, GL_INVALID_ENUM
, "glEnable");
548 gl_error(ctx
, GL_INVALID_ENUM
, "glDisable");
555 gl_error( ctx
, GL_INVALID_ENUM
, "glEnable" );
558 gl_error( ctx
, GL_INVALID_ENUM
, "glDisable" );
563 if (ctx
->Driver
.Enable
) {
564 (*ctx
->Driver
.Enable
)( ctx
, cap
, state
);
572 _mesa_Enable( GLenum cap
)
574 GET_CURRENT_CONTEXT(ctx
);
575 _mesa_set_enable( ctx
, cap
, GL_TRUE
);
581 _mesa_Disable( GLenum cap
)
583 GET_CURRENT_CONTEXT(ctx
);
584 _mesa_set_enable( ctx
, cap
, GL_FALSE
);
590 _mesa_IsEnabled( GLenum cap
)
592 GET_CURRENT_CONTEXT(ctx
);
595 return ctx
->Color
.AlphaEnabled
;
597 return ctx
->Eval
.AutoNormal
;
599 return ctx
->Color
.BlendEnabled
;
606 return ctx
->Transform
.ClipEnabled
[cap
-GL_CLIP_PLANE0
];
607 case GL_COLOR_MATERIAL
:
608 return ctx
->Light
.ColorMaterialEnabled
;
610 return ctx
->Polygon
.CullFlag
;
612 return ctx
->Depth
.Test
;
614 return ctx
->Color
.DitherFlag
;
616 return ctx
->Fog
.Enabled
;
618 if (ctx
->Extensions
.HaveHistogram
) {
619 return ctx
->Pixel
.HistogramEnabled
;
622 gl_error(ctx
, GL_INVALID_ENUM
, "glIsEnabled");
626 return ctx
->Light
.Enabled
;
635 return ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
;
637 return ctx
->Line
.SmoothFlag
;
638 case GL_LINE_STIPPLE
:
639 return ctx
->Line
.StippleFlag
;
640 case GL_INDEX_LOGIC_OP
:
641 return ctx
->Color
.IndexLogicOpEnabled
;
642 case GL_COLOR_LOGIC_OP
:
643 return ctx
->Color
.ColorLogicOpEnabled
;
644 case GL_MAP1_COLOR_4
:
645 return ctx
->Eval
.Map1Color4
;
647 return ctx
->Eval
.Map1Index
;
649 return ctx
->Eval
.Map1Normal
;
650 case GL_MAP1_TEXTURE_COORD_1
:
651 return ctx
->Eval
.Map1TextureCoord1
;
652 case GL_MAP1_TEXTURE_COORD_2
:
653 return ctx
->Eval
.Map1TextureCoord2
;
654 case GL_MAP1_TEXTURE_COORD_3
:
655 return ctx
->Eval
.Map1TextureCoord3
;
656 case GL_MAP1_TEXTURE_COORD_4
:
657 return ctx
->Eval
.Map1TextureCoord4
;
658 case GL_MAP1_VERTEX_3
:
659 return ctx
->Eval
.Map1Vertex3
;
660 case GL_MAP1_VERTEX_4
:
661 return ctx
->Eval
.Map1Vertex4
;
662 case GL_MAP2_COLOR_4
:
663 return ctx
->Eval
.Map2Color4
;
665 return ctx
->Eval
.Map2Index
;
667 return ctx
->Eval
.Map2Normal
;
668 case GL_MAP2_TEXTURE_COORD_1
:
669 return ctx
->Eval
.Map2TextureCoord1
;
670 case GL_MAP2_TEXTURE_COORD_2
:
671 return ctx
->Eval
.Map2TextureCoord2
;
672 case GL_MAP2_TEXTURE_COORD_3
:
673 return ctx
->Eval
.Map2TextureCoord3
;
674 case GL_MAP2_TEXTURE_COORD_4
:
675 return ctx
->Eval
.Map2TextureCoord4
;
676 case GL_MAP2_VERTEX_3
:
677 return ctx
->Eval
.Map2Vertex3
;
678 case GL_MAP2_VERTEX_4
:
679 return ctx
->Eval
.Map2Vertex4
;
681 return ctx
->Pixel
.MinMaxEnabled
;
683 return ctx
->Transform
.Normalize
;
684 case GL_POINT_SMOOTH
:
685 return ctx
->Point
.SmoothFlag
;
686 case GL_POLYGON_SMOOTH
:
687 return ctx
->Polygon
.SmoothFlag
;
688 case GL_POLYGON_STIPPLE
:
689 return ctx
->Polygon
.StippleFlag
;
690 case GL_POLYGON_OFFSET_POINT
:
691 return ctx
->Polygon
.OffsetPoint
;
692 case GL_POLYGON_OFFSET_LINE
:
693 return ctx
->Polygon
.OffsetLine
;
694 case GL_POLYGON_OFFSET_FILL
:
695 /*case GL_POLYGON_OFFSET_EXT:*/
696 return ctx
->Polygon
.OffsetFill
;
697 case GL_RESCALE_NORMAL_EXT
:
698 return ctx
->Transform
.RescaleNormals
;
699 case GL_SCISSOR_TEST
:
700 return ctx
->Scissor
.Enabled
;
701 case GL_SHARED_TEXTURE_PALETTE_EXT
:
702 return ctx
->Texture
.SharedPalette
;
703 case GL_STENCIL_TEST
:
704 return ctx
->Stencil
.Enabled
;
707 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
708 return (texUnit
->Enabled
& TEXTURE0_1D
) ? GL_TRUE
: GL_FALSE
;
712 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
713 return (texUnit
->Enabled
& TEXTURE0_2D
) ? GL_TRUE
: GL_FALSE
;
717 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
718 return (texUnit
->Enabled
& TEXTURE0_3D
) ? GL_TRUE
: GL_FALSE
;
720 case GL_TEXTURE_GEN_Q
:
722 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
723 return (texUnit
->TexGenEnabled
& Q_BIT
) ? GL_TRUE
: GL_FALSE
;
725 case GL_TEXTURE_GEN_R
:
727 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
728 return (texUnit
->TexGenEnabled
& R_BIT
) ? GL_TRUE
: GL_FALSE
;
730 case GL_TEXTURE_GEN_S
:
732 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
733 return (texUnit
->TexGenEnabled
& S_BIT
) ? GL_TRUE
: GL_FALSE
;
735 case GL_TEXTURE_GEN_T
:
737 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
738 return (texUnit
->TexGenEnabled
& T_BIT
) ? GL_TRUE
: GL_FALSE
;
744 case GL_VERTEX_ARRAY
:
745 return ctx
->Array
.Vertex
.Enabled
;
746 case GL_NORMAL_ARRAY
:
747 return ctx
->Array
.Normal
.Enabled
;
749 return ctx
->Array
.Color
.Enabled
;
751 return ctx
->Array
.Index
.Enabled
;
752 case GL_TEXTURE_COORD_ARRAY
:
753 return ctx
->Array
.TexCoord
[ctx
->Array
.ActiveTexture
].Enabled
;
754 case GL_EDGE_FLAG_ARRAY
:
755 return ctx
->Array
.EdgeFlag
.Enabled
;
757 /* GL_HP_occlusion_test */
758 case GL_OCCLUSION_TEST_HP
:
759 if (ctx
->Extensions
.HaveHpOcclusionTest
) {
760 return ctx
->Depth
.OcclusionTest
;
763 gl_error( ctx
, GL_INVALID_ENUM
, "glIsEnabled" );
767 /* GL_SGIS_pixel_texture */
768 case GL_PIXEL_TEXTURE_SGIS
:
769 return ctx
->Pixel
.PixelTextureEnabled
;
771 /* GL_SGIX_pixel_texture */
772 case GL_PIXEL_TEX_GEN_SGIX
:
773 return ctx
->Pixel
.PixelTextureEnabled
;
775 /* GL_SGI_color_table */
776 case GL_COLOR_TABLE_SGI
:
777 return ctx
->Pixel
.ColorTableEnabled
;
778 case GL_POST_CONVOLUTION_COLOR_TABLE_SGI
:
779 return ctx
->Pixel
.PostConvolutionColorTableEnabled
;
780 case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI
:
781 return ctx
->Pixel
.PostColorMatrixColorTableEnabled
;
783 /* GL_EXT_convolution */
784 case GL_CONVOLUTION_1D
:
785 return ctx
->Pixel
.Convolution1DEnabled
;
786 case GL_CONVOLUTION_2D
:
787 return ctx
->Pixel
.Convolution2DEnabled
;
788 case GL_SEPARABLE_2D
:
789 return ctx
->Pixel
.Separable2DEnabled
;
791 /* GL_ARB_texture_cube_map */
792 case GL_TEXTURE_CUBE_MAP_ARB
:
793 if (ctx
->Extensions
.HaveTextureCubeMap
) {
794 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
795 return (texUnit
->Enabled
& TEXTURE0_CUBE
) ? GL_TRUE
: GL_FALSE
;
798 gl_error(ctx
, GL_INVALID_ENUM
, "glIsEnabled");
803 gl_error( ctx
, GL_INVALID_ENUM
, "glIsEnabled" );
812 client_state( GLcontext
*ctx
, GLenum cap
, GLboolean state
)
814 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx
,
816 ? "glEnableClientState"
817 : "glDisableClientState") );
820 case GL_VERTEX_ARRAY
:
821 ctx
->Array
.Vertex
.Enabled
= state
;
823 case GL_NORMAL_ARRAY
:
824 ctx
->Array
.Normal
.Enabled
= state
;
827 ctx
->Array
.Color
.Enabled
= state
;
830 ctx
->Array
.Index
.Enabled
= state
;
832 case GL_TEXTURE_COORD_ARRAY
:
833 ctx
->Array
.TexCoord
[ctx
->Array
.ActiveTexture
].Enabled
= state
;
835 case GL_EDGE_FLAG_ARRAY
:
836 ctx
->Array
.EdgeFlag
.Enabled
= state
;
839 gl_error( ctx
, GL_INVALID_ENUM
, "glEnable/DisableClientState" );
842 ctx
->NewState
|= NEW_CLIENT_STATE
;
848 _mesa_EnableClientState( GLenum cap
)
850 GET_CURRENT_CONTEXT(ctx
);
851 client_state( ctx
, cap
, GL_TRUE
);
857 _mesa_DisableClientState( GLenum cap
)
859 GET_CURRENT_CONTEXT(ctx
);
860 client_state( ctx
, cap
, GL_FALSE
);