3 * Enable/disable/query GL capabilities.
7 * Mesa 3-D graphics library
9 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
35 #include "debug_output.h"
45 #define CHECK_EXTENSION(EXTNAME, CAP) \
46 if (!ctx->Extensions.EXTNAME) { \
47 goto invalid_enum_error; \
52 update_derived_primitive_restart_state(struct gl_context
*ctx
)
54 /* Update derived primitive restart state.
56 ctx
->Array
._PrimitiveRestart
= ctx
->Array
.PrimitiveRestart
57 || ctx
->Array
.PrimitiveRestartFixedIndex
;
61 * Helper to enable/disable client-side state.
64 client_state(struct gl_context
*ctx
, GLenum cap
, GLboolean state
)
66 struct gl_vertex_array_object
*vao
= ctx
->Array
.VAO
;
69 uint64_t new_state
= _NEW_ARRAY
;
73 var
= &vao
->VertexAttrib
[VERT_ATTRIB_POS
].Enabled
;
77 var
= &vao
->VertexAttrib
[VERT_ATTRIB_NORMAL
].Enabled
;
78 flag
= VERT_BIT_NORMAL
;
81 var
= &vao
->VertexAttrib
[VERT_ATTRIB_COLOR0
].Enabled
;
82 flag
= VERT_BIT_COLOR0
;
85 var
= &vao
->VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].Enabled
;
86 flag
= VERT_BIT_COLOR_INDEX
;
88 case GL_TEXTURE_COORD_ARRAY
:
89 var
= &vao
->VertexAttrib
[VERT_ATTRIB_TEX(ctx
->Array
.ActiveTexture
)].Enabled
;
90 flag
= VERT_BIT_TEX(ctx
->Array
.ActiveTexture
);
92 case GL_EDGE_FLAG_ARRAY
:
93 var
= &vao
->VertexAttrib
[VERT_ATTRIB_EDGEFLAG
].Enabled
;
94 flag
= VERT_BIT_EDGEFLAG
;
96 case GL_FOG_COORDINATE_ARRAY_EXT
:
97 var
= &vao
->VertexAttrib
[VERT_ATTRIB_FOG
].Enabled
;
100 case GL_SECONDARY_COLOR_ARRAY_EXT
:
101 var
= &vao
->VertexAttrib
[VERT_ATTRIB_COLOR1
].Enabled
;
102 flag
= VERT_BIT_COLOR1
;
105 case GL_POINT_SIZE_ARRAY_OES
:
106 var
= &vao
->VertexAttrib
[VERT_ATTRIB_POINT_SIZE
].Enabled
;
107 flag
= VERT_BIT_POINT_SIZE
;
108 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
109 ctx
->VertexProgram
.PointSizeEnabled
= state
;
112 /* GL_NV_primitive_restart */
113 case GL_PRIMITIVE_RESTART_NV
:
114 if (!ctx
->Extensions
.NV_primitive_restart
) {
115 goto invalid_enum_error
;
117 var
= &ctx
->Array
.PrimitiveRestart
;
119 new_state
= 0; /* primitive restart is not a vertex array state */
123 goto invalid_enum_error
;
129 FLUSH_VERTICES(ctx
, new_state
);
133 update_derived_primitive_restart_state(ctx
);
136 vao
->_Enabled
|= flag
;
138 vao
->_Enabled
&= ~flag
;
140 vao
->NewArrays
|= flag
;
142 if (ctx
->Driver
.Enable
) {
143 ctx
->Driver
.Enable( ctx
, cap
, state
);
149 _mesa_error(ctx
, GL_INVALID_ENUM
, "gl%sClientState(%s)",
150 state
? "Enable" : "Disable", _mesa_enum_to_string(cap
));
155 * Enable GL capability.
156 * \param cap state to enable/disable.
158 * Get's the current context, assures that we're outside glBegin()/glEnd() and
159 * calls client_state().
162 _mesa_EnableClientState( GLenum cap
)
164 GET_CURRENT_CONTEXT(ctx
);
165 client_state( ctx
, cap
, GL_TRUE
);
170 * Disable GL capability.
171 * \param cap state to enable/disable.
173 * Get's the current context, assures that we're outside glBegin()/glEnd() and
174 * calls client_state().
177 _mesa_DisableClientState( GLenum cap
)
179 GET_CURRENT_CONTEXT(ctx
);
180 client_state( ctx
, cap
, GL_FALSE
);
184 #undef CHECK_EXTENSION
185 #define CHECK_EXTENSION(EXTNAME, CAP) \
186 if (!ctx->Extensions.EXTNAME) { \
187 goto invalid_enum_error; \
190 #define CHECK_EXTENSION2(EXT1, EXT2, CAP) \
191 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
192 goto invalid_enum_error; \
196 * Return pointer to current texture unit for setting/getting coordinate
198 * Note that we'll set GL_INVALID_OPERATION and return NULL if the active
199 * texture unit is higher than the number of supported coordinate units.
201 static struct gl_texture_unit
*
202 get_texcoord_unit(struct gl_context
*ctx
)
204 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxTextureCoordUnits
) {
205 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEnable/Disable(texcoord unit)");
209 return &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
215 * Helper function to enable or disable a texture target.
216 * \param bit one of the TEXTURE_x_BIT values
217 * \return GL_TRUE if state is changing or GL_FALSE if no change
220 enable_texture(struct gl_context
*ctx
, GLboolean state
, GLbitfield texBit
)
222 struct gl_texture_unit
*texUnit
= _mesa_get_current_tex_unit(ctx
);
223 const GLbitfield newenabled
= state
224 ? (texUnit
->Enabled
| texBit
) : (texUnit
->Enabled
& ~texBit
);
226 if (texUnit
->Enabled
== newenabled
)
229 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
230 texUnit
->Enabled
= newenabled
;
236 * Helper function to enable or disable GL_MULTISAMPLE, skipping the check for
237 * whether the API supports it (GLES doesn't).
240 _mesa_set_multisample(struct gl_context
*ctx
, GLboolean state
)
242 if (ctx
->Multisample
.Enabled
== state
)
245 /* GL compatibility needs Multisample.Enable to determine program state
248 if (ctx
->API
== API_OPENGL_COMPAT
|| ctx
->API
== API_OPENGLES
||
249 !ctx
->DriverFlags
.NewMultisampleEnable
) {
250 FLUSH_VERTICES(ctx
, _NEW_MULTISAMPLE
);
252 FLUSH_VERTICES(ctx
, 0);
255 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewMultisampleEnable
;
256 ctx
->Multisample
.Enabled
= state
;
258 if (ctx
->Driver
.Enable
) {
259 ctx
->Driver
.Enable(ctx
, GL_MULTISAMPLE
, state
);
264 * Helper function to enable or disable GL_FRAMEBUFFER_SRGB, skipping the
265 * check for whether the API supports it (GLES doesn't).
268 _mesa_set_framebuffer_srgb(struct gl_context
*ctx
, GLboolean state
)
270 if (ctx
->Color
.sRGBEnabled
== state
)
273 /* TODO: Switch i965 to the new flag and remove the conditional */
274 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewFramebufferSRGB
? 0 : _NEW_BUFFERS
);
275 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewFramebufferSRGB
;
276 ctx
->Color
.sRGBEnabled
= state
;
278 if (ctx
->Driver
.Enable
) {
279 ctx
->Driver
.Enable(ctx
, GL_FRAMEBUFFER_SRGB
, state
);
284 * Helper function to enable or disable state.
286 * \param ctx GL context.
287 * \param cap the state to enable/disable
288 * \param state whether to enable or disable the specified capability.
290 * Updates the current context and flushes the vertices as needed. For
291 * capabilities associated with extensions it verifies that those extensions
292 * are effectivly present before updating. Notifies the driver via
293 * dd_function_table::Enable.
296 _mesa_set_enable(struct gl_context
*ctx
, GLenum cap
, GLboolean state
)
298 if (MESA_VERBOSE
& VERBOSE_API
)
299 _mesa_debug(ctx
, "%s %s (newstate is %x)\n",
300 state
? "glEnable" : "glDisable",
301 _mesa_enum_to_string(cap
),
306 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
307 goto invalid_enum_error
;
308 if (ctx
->Color
.AlphaEnabled
== state
)
310 /* AlphaEnabled is used by the fixed-func fragment program */
311 FLUSH_VERTICES(ctx
, _NEW_COLOR
);
312 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewAlphaTest
;
313 ctx
->Color
.AlphaEnabled
= state
;
316 if (ctx
->API
!= API_OPENGL_COMPAT
)
317 goto invalid_enum_error
;
318 if (ctx
->Eval
.AutoNormal
== state
)
320 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
321 ctx
->Eval
.AutoNormal
= state
;
325 GLbitfield newEnabled
=
326 state
* ((1 << ctx
->Const
.MaxDrawBuffers
) - 1);
327 if (newEnabled
!= ctx
->Color
.BlendEnabled
) {
328 _mesa_flush_vertices_for_blend_state(ctx
);
329 ctx
->Color
.BlendEnabled
= newEnabled
;
333 case GL_CLIP_DISTANCE0
: /* aka GL_CLIP_PLANE0 */
334 case GL_CLIP_DISTANCE1
:
335 case GL_CLIP_DISTANCE2
:
336 case GL_CLIP_DISTANCE3
:
337 case GL_CLIP_DISTANCE4
:
338 case GL_CLIP_DISTANCE5
:
339 case GL_CLIP_DISTANCE6
:
340 case GL_CLIP_DISTANCE7
:
342 const GLuint p
= cap
- GL_CLIP_DISTANCE0
;
344 if (p
>= ctx
->Const
.MaxClipPlanes
)
345 goto invalid_enum_error
;
347 if ((ctx
->Transform
.ClipPlanesEnabled
& (1 << p
))
348 == ((GLuint
) state
<< p
))
351 /* The compatibility profile needs _NEW_TRANSFORM to transform
352 * clip planes according to the projection matrix.
354 if (ctx
->API
== API_OPENGL_COMPAT
|| ctx
->API
== API_OPENGLES
||
355 !ctx
->DriverFlags
.NewClipPlaneEnable
) {
356 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
358 FLUSH_VERTICES(ctx
, 0);
360 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewClipPlaneEnable
;
363 ctx
->Transform
.ClipPlanesEnabled
|= (1 << p
);
364 if (ctx
->API
== API_OPENGL_COMPAT
|| ctx
->API
== API_OPENGLES
)
365 _mesa_update_clip_plane(ctx
, p
);
368 ctx
->Transform
.ClipPlanesEnabled
&= ~(1 << p
);
372 case GL_COLOR_MATERIAL
:
373 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
374 goto invalid_enum_error
;
375 if (ctx
->Light
.ColorMaterialEnabled
== state
)
377 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
378 FLUSH_CURRENT(ctx
, 0);
379 ctx
->Light
.ColorMaterialEnabled
= state
;
381 _mesa_update_color_material( ctx
,
382 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
] );
386 if (ctx
->Polygon
.CullFlag
== state
)
389 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
390 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
391 ctx
->Polygon
.CullFlag
= state
;
394 if (ctx
->Depth
.Test
== state
)
396 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewDepth
? 0 : _NEW_DEPTH
);
397 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewDepth
;
398 ctx
->Depth
.Test
= state
;
400 case GL_DEBUG_OUTPUT
:
401 case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
:
402 _mesa_set_debug_state_int(ctx
, cap
, state
);
405 if (ctx
->Color
.DitherFlag
== state
)
407 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewBlend
? 0 : _NEW_COLOR
);
408 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewBlend
;
409 ctx
->Color
.DitherFlag
= state
;
412 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
413 goto invalid_enum_error
;
414 if (ctx
->Fog
.Enabled
== state
)
416 FLUSH_VERTICES(ctx
, _NEW_FOG
);
417 ctx
->Fog
.Enabled
= state
;
418 ctx
->Fog
._PackedEnabledMode
= state
? ctx
->Fog
._PackedMode
: FOG_NONE
;
428 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
429 goto invalid_enum_error
;
430 if (ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
== state
)
432 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
433 ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
= state
;
435 ctx
->Light
._EnabledLights
|= 1u << (cap
- GL_LIGHT0
);
438 ctx
->Light
._EnabledLights
&= ~(1u << (cap
- GL_LIGHT0
));
442 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
443 goto invalid_enum_error
;
444 if (ctx
->Light
.Enabled
== state
)
446 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
447 ctx
->Light
.Enabled
= state
;
450 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
451 goto invalid_enum_error
;
452 if (ctx
->Line
.SmoothFlag
== state
)
454 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLineState
? 0 : _NEW_LINE
);
455 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLineState
;
456 ctx
->Line
.SmoothFlag
= state
;
458 case GL_LINE_STIPPLE
:
459 if (ctx
->API
!= API_OPENGL_COMPAT
)
460 goto invalid_enum_error
;
461 if (ctx
->Line
.StippleFlag
== state
)
463 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLineState
? 0 : _NEW_LINE
);
464 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLineState
;
465 ctx
->Line
.StippleFlag
= state
;
467 case GL_INDEX_LOGIC_OP
:
468 if (ctx
->API
!= API_OPENGL_COMPAT
)
469 goto invalid_enum_error
;
470 if (ctx
->Color
.IndexLogicOpEnabled
== state
)
472 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLogicOp
? 0 : _NEW_COLOR
);
473 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLogicOp
;
474 ctx
->Color
.IndexLogicOpEnabled
= state
;
476 case GL_CONSERVATIVE_RASTERIZATION_INTEL
:
477 if (!_mesa_has_INTEL_conservative_rasterization(ctx
))
478 goto invalid_enum_error
;
479 if (ctx
->IntelConservativeRasterization
== state
)
481 FLUSH_VERTICES(ctx
, 0);
482 ctx
->NewDriverState
|=
483 ctx
->DriverFlags
.NewIntelConservativeRasterization
;
484 ctx
->IntelConservativeRasterization
= state
;
486 case GL_COLOR_LOGIC_OP
:
487 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
488 goto invalid_enum_error
;
489 if (ctx
->Color
.ColorLogicOpEnabled
== state
)
491 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLogicOp
? 0 : _NEW_COLOR
);
492 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLogicOp
;
493 ctx
->Color
.ColorLogicOpEnabled
= state
;
495 case GL_MAP1_COLOR_4
:
496 if (ctx
->API
!= API_OPENGL_COMPAT
)
497 goto invalid_enum_error
;
498 if (ctx
->Eval
.Map1Color4
== state
)
500 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
501 ctx
->Eval
.Map1Color4
= state
;
504 if (ctx
->API
!= API_OPENGL_COMPAT
)
505 goto invalid_enum_error
;
506 if (ctx
->Eval
.Map1Index
== state
)
508 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
509 ctx
->Eval
.Map1Index
= state
;
512 if (ctx
->API
!= API_OPENGL_COMPAT
)
513 goto invalid_enum_error
;
514 if (ctx
->Eval
.Map1Normal
== state
)
516 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
517 ctx
->Eval
.Map1Normal
= state
;
519 case GL_MAP1_TEXTURE_COORD_1
:
520 if (ctx
->API
!= API_OPENGL_COMPAT
)
521 goto invalid_enum_error
;
522 if (ctx
->Eval
.Map1TextureCoord1
== state
)
524 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
525 ctx
->Eval
.Map1TextureCoord1
= state
;
527 case GL_MAP1_TEXTURE_COORD_2
:
528 if (ctx
->API
!= API_OPENGL_COMPAT
)
529 goto invalid_enum_error
;
530 if (ctx
->Eval
.Map1TextureCoord2
== state
)
532 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
533 ctx
->Eval
.Map1TextureCoord2
= state
;
535 case GL_MAP1_TEXTURE_COORD_3
:
536 if (ctx
->API
!= API_OPENGL_COMPAT
)
537 goto invalid_enum_error
;
538 if (ctx
->Eval
.Map1TextureCoord3
== state
)
540 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
541 ctx
->Eval
.Map1TextureCoord3
= state
;
543 case GL_MAP1_TEXTURE_COORD_4
:
544 if (ctx
->API
!= API_OPENGL_COMPAT
)
545 goto invalid_enum_error
;
546 if (ctx
->Eval
.Map1TextureCoord4
== state
)
548 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
549 ctx
->Eval
.Map1TextureCoord4
= state
;
551 case GL_MAP1_VERTEX_3
:
552 if (ctx
->API
!= API_OPENGL_COMPAT
)
553 goto invalid_enum_error
;
554 if (ctx
->Eval
.Map1Vertex3
== state
)
556 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
557 ctx
->Eval
.Map1Vertex3
= state
;
559 case GL_MAP1_VERTEX_4
:
560 if (ctx
->API
!= API_OPENGL_COMPAT
)
561 goto invalid_enum_error
;
562 if (ctx
->Eval
.Map1Vertex4
== state
)
564 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
565 ctx
->Eval
.Map1Vertex4
= state
;
567 case GL_MAP2_COLOR_4
:
568 if (ctx
->API
!= API_OPENGL_COMPAT
)
569 goto invalid_enum_error
;
570 if (ctx
->Eval
.Map2Color4
== state
)
572 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
573 ctx
->Eval
.Map2Color4
= state
;
576 if (ctx
->API
!= API_OPENGL_COMPAT
)
577 goto invalid_enum_error
;
578 if (ctx
->Eval
.Map2Index
== state
)
580 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
581 ctx
->Eval
.Map2Index
= state
;
584 if (ctx
->API
!= API_OPENGL_COMPAT
)
585 goto invalid_enum_error
;
586 if (ctx
->Eval
.Map2Normal
== state
)
588 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
589 ctx
->Eval
.Map2Normal
= state
;
591 case GL_MAP2_TEXTURE_COORD_1
:
592 if (ctx
->API
!= API_OPENGL_COMPAT
)
593 goto invalid_enum_error
;
594 if (ctx
->Eval
.Map2TextureCoord1
== state
)
596 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
597 ctx
->Eval
.Map2TextureCoord1
= state
;
599 case GL_MAP2_TEXTURE_COORD_2
:
600 if (ctx
->API
!= API_OPENGL_COMPAT
)
601 goto invalid_enum_error
;
602 if (ctx
->Eval
.Map2TextureCoord2
== state
)
604 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
605 ctx
->Eval
.Map2TextureCoord2
= state
;
607 case GL_MAP2_TEXTURE_COORD_3
:
608 if (ctx
->API
!= API_OPENGL_COMPAT
)
609 goto invalid_enum_error
;
610 if (ctx
->Eval
.Map2TextureCoord3
== state
)
612 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
613 ctx
->Eval
.Map2TextureCoord3
= state
;
615 case GL_MAP2_TEXTURE_COORD_4
:
616 if (ctx
->API
!= API_OPENGL_COMPAT
)
617 goto invalid_enum_error
;
618 if (ctx
->Eval
.Map2TextureCoord4
== state
)
620 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
621 ctx
->Eval
.Map2TextureCoord4
= state
;
623 case GL_MAP2_VERTEX_3
:
624 if (ctx
->API
!= API_OPENGL_COMPAT
)
625 goto invalid_enum_error
;
626 if (ctx
->Eval
.Map2Vertex3
== state
)
628 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
629 ctx
->Eval
.Map2Vertex3
= state
;
631 case GL_MAP2_VERTEX_4
:
632 if (ctx
->API
!= API_OPENGL_COMPAT
)
633 goto invalid_enum_error
;
634 if (ctx
->Eval
.Map2Vertex4
== state
)
636 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
637 ctx
->Eval
.Map2Vertex4
= state
;
640 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
641 goto invalid_enum_error
;
642 if (ctx
->Transform
.Normalize
== state
)
644 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
645 ctx
->Transform
.Normalize
= state
;
647 case GL_POINT_SMOOTH
:
648 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
649 goto invalid_enum_error
;
650 if (ctx
->Point
.SmoothFlag
== state
)
652 FLUSH_VERTICES(ctx
, _NEW_POINT
);
653 ctx
->Point
.SmoothFlag
= state
;
655 case GL_POLYGON_SMOOTH
:
656 if (!_mesa_is_desktop_gl(ctx
))
657 goto invalid_enum_error
;
658 if (ctx
->Polygon
.SmoothFlag
== state
)
661 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
662 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
663 ctx
->Polygon
.SmoothFlag
= state
;
665 case GL_POLYGON_STIPPLE
:
666 if (ctx
->API
!= API_OPENGL_COMPAT
)
667 goto invalid_enum_error
;
668 if (ctx
->Polygon
.StippleFlag
== state
)
671 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
672 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
673 ctx
->Polygon
.StippleFlag
= state
;
675 case GL_POLYGON_OFFSET_POINT
:
676 if (!_mesa_is_desktop_gl(ctx
))
677 goto invalid_enum_error
;
678 if (ctx
->Polygon
.OffsetPoint
== state
)
681 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
682 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
683 ctx
->Polygon
.OffsetPoint
= state
;
685 case GL_POLYGON_OFFSET_LINE
:
686 if (!_mesa_is_desktop_gl(ctx
))
687 goto invalid_enum_error
;
688 if (ctx
->Polygon
.OffsetLine
== state
)
691 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
692 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
693 ctx
->Polygon
.OffsetLine
= state
;
695 case GL_POLYGON_OFFSET_FILL
:
696 if (ctx
->Polygon
.OffsetFill
== state
)
699 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
700 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
701 ctx
->Polygon
.OffsetFill
= state
;
703 case GL_RESCALE_NORMAL_EXT
:
704 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
705 goto invalid_enum_error
;
706 if (ctx
->Transform
.RescaleNormals
== state
)
708 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
709 ctx
->Transform
.RescaleNormals
= state
;
711 case GL_SCISSOR_TEST
:
713 /* Must expand glEnable to all scissors */
714 GLbitfield newEnabled
=
715 state
* ((1 << ctx
->Const
.MaxViewports
) - 1);
716 if (newEnabled
!= ctx
->Scissor
.EnableFlags
) {
717 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewScissorTest
? 0 :
719 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewScissorTest
;
720 ctx
->Scissor
.EnableFlags
= newEnabled
;
724 case GL_STENCIL_TEST
:
725 if (ctx
->Stencil
.Enabled
== state
)
727 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewStencil
? 0 : _NEW_STENCIL
);
728 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewStencil
;
729 ctx
->Stencil
.Enabled
= state
;
732 if (ctx
->API
!= API_OPENGL_COMPAT
)
733 goto invalid_enum_error
;
734 if (!enable_texture(ctx
, state
, TEXTURE_1D_BIT
)) {
739 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
740 goto invalid_enum_error
;
741 if (!enable_texture(ctx
, state
, TEXTURE_2D_BIT
)) {
746 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
747 goto invalid_enum_error
;
748 if (!enable_texture(ctx
, state
, TEXTURE_3D_BIT
)) {
752 case GL_TEXTURE_GEN_S
:
753 case GL_TEXTURE_GEN_T
:
754 case GL_TEXTURE_GEN_R
:
755 case GL_TEXTURE_GEN_Q
:
757 struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
759 if (ctx
->API
!= API_OPENGL_COMPAT
)
760 goto invalid_enum_error
;
763 GLbitfield coordBit
= S_BIT
<< (cap
- GL_TEXTURE_GEN_S
);
764 GLbitfield newenabled
= texUnit
->TexGenEnabled
& ~coordBit
;
766 newenabled
|= coordBit
;
767 if (texUnit
->TexGenEnabled
== newenabled
)
769 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
770 texUnit
->TexGenEnabled
= newenabled
;
775 case GL_TEXTURE_GEN_STR_OES
:
776 /* disable S, T, and R at the same time */
778 struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
780 if (ctx
->API
!= API_OPENGLES
)
781 goto invalid_enum_error
;
785 texUnit
->TexGenEnabled
& ~STR_BITS
;
787 newenabled
|= STR_BITS
;
788 if (texUnit
->TexGenEnabled
== newenabled
)
790 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
791 texUnit
->TexGenEnabled
= newenabled
;
796 /* client-side state */
797 case GL_VERTEX_ARRAY
:
798 case GL_NORMAL_ARRAY
:
800 case GL_TEXTURE_COORD_ARRAY
:
801 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
802 goto invalid_enum_error
;
803 client_state( ctx
, cap
, state
);
806 case GL_EDGE_FLAG_ARRAY
:
807 case GL_FOG_COORDINATE_ARRAY_EXT
:
808 case GL_SECONDARY_COLOR_ARRAY_EXT
:
809 if (ctx
->API
!= API_OPENGL_COMPAT
)
810 goto invalid_enum_error
;
811 client_state( ctx
, cap
, state
);
813 case GL_POINT_SIZE_ARRAY_OES
:
814 if (ctx
->API
!= API_OPENGLES
)
815 goto invalid_enum_error
;
816 client_state( ctx
, cap
, state
);
819 /* GL_ARB_texture_cube_map */
820 case GL_TEXTURE_CUBE_MAP
:
821 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
822 goto invalid_enum_error
;
823 CHECK_EXTENSION(ARB_texture_cube_map
, cap
);
824 if (!enable_texture(ctx
, state
, TEXTURE_CUBE_BIT
)) {
829 /* GL_EXT_secondary_color */
830 case GL_COLOR_SUM_EXT
:
831 if (ctx
->API
!= API_OPENGL_COMPAT
)
832 goto invalid_enum_error
;
833 if (ctx
->Fog
.ColorSumEnabled
== state
)
835 FLUSH_VERTICES(ctx
, _NEW_FOG
);
836 ctx
->Fog
.ColorSumEnabled
= state
;
839 /* GL_ARB_multisample */
840 case GL_MULTISAMPLE_ARB
:
841 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
842 goto invalid_enum_error
;
843 _mesa_set_multisample(ctx
, state
);
845 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
:
846 if (ctx
->Multisample
.SampleAlphaToCoverage
== state
)
848 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleAlphaToXEnable
? 0 :
850 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleAlphaToXEnable
;
851 ctx
->Multisample
.SampleAlphaToCoverage
= state
;
853 case GL_SAMPLE_ALPHA_TO_ONE_ARB
:
854 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
855 goto invalid_enum_error
;
856 if (ctx
->Multisample
.SampleAlphaToOne
== state
)
858 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleAlphaToXEnable
? 0 :
860 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleAlphaToXEnable
;
861 ctx
->Multisample
.SampleAlphaToOne
= state
;
863 case GL_SAMPLE_COVERAGE_ARB
:
864 if (ctx
->Multisample
.SampleCoverage
== state
)
866 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleMask
? 0 :
868 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleMask
;
869 ctx
->Multisample
.SampleCoverage
= state
;
871 case GL_SAMPLE_COVERAGE_INVERT_ARB
:
872 if (!_mesa_is_desktop_gl(ctx
))
873 goto invalid_enum_error
;
874 if (ctx
->Multisample
.SampleCoverageInvert
== state
)
876 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleMask
? 0 :
878 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleMask
;
879 ctx
->Multisample
.SampleCoverageInvert
= state
;
882 /* GL_ARB_sample_shading */
883 case GL_SAMPLE_SHADING
:
884 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
885 goto invalid_enum_error
;
886 CHECK_EXTENSION(ARB_sample_shading
, cap
);
887 if (ctx
->Multisample
.SampleShading
== state
)
889 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleShading
? 0 :
891 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleShading
;
892 ctx
->Multisample
.SampleShading
= state
;
895 /* GL_IBM_rasterpos_clip */
896 case GL_RASTER_POSITION_UNCLIPPED_IBM
:
897 if (ctx
->API
!= API_OPENGL_COMPAT
)
898 goto invalid_enum_error
;
899 if (ctx
->Transform
.RasterPositionUnclipped
== state
)
901 FLUSH_VERTICES(ctx
, 0);
902 ctx
->Transform
.RasterPositionUnclipped
= state
;
905 /* GL_NV_point_sprite */
906 case GL_POINT_SPRITE_NV
:
907 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
908 goto invalid_enum_error
;
909 CHECK_EXTENSION2(NV_point_sprite
, ARB_point_sprite
, cap
);
910 if (ctx
->Point
.PointSprite
== state
)
912 FLUSH_VERTICES(ctx
, _NEW_POINT
);
913 ctx
->Point
.PointSprite
= state
;
916 case GL_VERTEX_PROGRAM_ARB
:
917 if (ctx
->API
!= API_OPENGL_COMPAT
)
918 goto invalid_enum_error
;
919 CHECK_EXTENSION(ARB_vertex_program
, cap
);
920 if (ctx
->VertexProgram
.Enabled
== state
)
922 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
923 ctx
->VertexProgram
.Enabled
= state
;
925 case GL_VERTEX_PROGRAM_POINT_SIZE_ARB
:
926 /* This was added with ARB_vertex_program, but it is also used with
927 * GLSL vertex shaders on desktop.
929 if (!_mesa_is_desktop_gl(ctx
))
930 goto invalid_enum_error
;
931 CHECK_EXTENSION(ARB_vertex_program
, cap
);
932 if (ctx
->VertexProgram
.PointSizeEnabled
== state
)
934 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
935 ctx
->VertexProgram
.PointSizeEnabled
= state
;
937 case GL_VERTEX_PROGRAM_TWO_SIDE_ARB
:
938 if (ctx
->API
!= API_OPENGL_COMPAT
)
939 goto invalid_enum_error
;
940 CHECK_EXTENSION(ARB_vertex_program
, cap
);
941 if (ctx
->VertexProgram
.TwoSideEnabled
== state
)
943 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
944 ctx
->VertexProgram
.TwoSideEnabled
= state
;
947 /* GL_NV_texture_rectangle */
948 case GL_TEXTURE_RECTANGLE_NV
:
949 if (ctx
->API
!= API_OPENGL_COMPAT
)
950 goto invalid_enum_error
;
951 CHECK_EXTENSION(NV_texture_rectangle
, cap
);
952 if (!enable_texture(ctx
, state
, TEXTURE_RECT_BIT
)) {
957 /* GL_EXT_stencil_two_side */
958 case GL_STENCIL_TEST_TWO_SIDE_EXT
:
959 if (ctx
->API
!= API_OPENGL_COMPAT
)
960 goto invalid_enum_error
;
961 CHECK_EXTENSION(EXT_stencil_two_side
, cap
);
962 if (ctx
->Stencil
.TestTwoSide
== state
)
964 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewStencil
? 0 : _NEW_STENCIL
);
965 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewStencil
;
966 ctx
->Stencil
.TestTwoSide
= state
;
968 ctx
->Stencil
._BackFace
= 2;
970 ctx
->Stencil
._BackFace
= 1;
974 case GL_FRAGMENT_PROGRAM_ARB
:
975 if (ctx
->API
!= API_OPENGL_COMPAT
)
976 goto invalid_enum_error
;
977 CHECK_EXTENSION(ARB_fragment_program
, cap
);
978 if (ctx
->FragmentProgram
.Enabled
== state
)
980 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
981 ctx
->FragmentProgram
.Enabled
= state
;
984 /* GL_EXT_depth_bounds_test */
985 case GL_DEPTH_BOUNDS_TEST_EXT
:
986 if (!_mesa_is_desktop_gl(ctx
))
987 goto invalid_enum_error
;
988 CHECK_EXTENSION(EXT_depth_bounds_test
, cap
);
989 if (ctx
->Depth
.BoundsTest
== state
)
991 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewDepth
? 0 : _NEW_DEPTH
);
992 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewDepth
;
993 ctx
->Depth
.BoundsTest
= state
;
997 if (!_mesa_is_desktop_gl(ctx
))
998 goto invalid_enum_error
;
999 CHECK_EXTENSION(ARB_depth_clamp
, cap
);
1000 if (ctx
->Transform
.DepthClamp
== state
)
1002 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewDepthClamp
? 0 :
1004 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewDepthClamp
;
1005 ctx
->Transform
.DepthClamp
= state
;
1008 case GL_FRAGMENT_SHADER_ATI
:
1009 if (ctx
->API
!= API_OPENGL_COMPAT
)
1010 goto invalid_enum_error
;
1011 CHECK_EXTENSION(ATI_fragment_shader
, cap
);
1012 if (ctx
->ATIFragmentShader
.Enabled
== state
)
1014 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
1015 ctx
->ATIFragmentShader
.Enabled
= state
;
1018 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1019 if (!_mesa_is_desktop_gl(ctx
))
1020 goto invalid_enum_error
;
1021 CHECK_EXTENSION(ARB_seamless_cube_map
, cap
);
1022 if (ctx
->Texture
.CubeMapSeamless
!= state
) {
1023 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
1024 ctx
->Texture
.CubeMapSeamless
= state
;
1028 case GL_RASTERIZER_DISCARD
:
1029 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
1030 goto invalid_enum_error
;
1031 CHECK_EXTENSION(EXT_transform_feedback
, cap
);
1032 if (ctx
->RasterDiscard
!= state
) {
1033 FLUSH_VERTICES(ctx
, 0);
1034 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewRasterizerDiscard
;
1035 ctx
->RasterDiscard
= state
;
1039 /* GL 3.1 primitive restart. Note: this enum is different from
1040 * GL_PRIMITIVE_RESTART_NV (which is client state).
1042 case GL_PRIMITIVE_RESTART
:
1043 if (!_mesa_is_desktop_gl(ctx
) || ctx
->Version
< 31) {
1044 goto invalid_enum_error
;
1046 if (ctx
->Array
.PrimitiveRestart
!= state
) {
1047 FLUSH_VERTICES(ctx
, 0);
1048 ctx
->Array
.PrimitiveRestart
= state
;
1049 update_derived_primitive_restart_state(ctx
);
1053 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
1054 if (!_mesa_is_gles3(ctx
) && !ctx
->Extensions
.ARB_ES3_compatibility
)
1055 goto invalid_enum_error
;
1056 if (ctx
->Array
.PrimitiveRestartFixedIndex
!= state
) {
1057 FLUSH_VERTICES(ctx
, 0);
1058 ctx
->Array
.PrimitiveRestartFixedIndex
= state
;
1059 update_derived_primitive_restart_state(ctx
);
1063 /* GL3.0 - GL_framebuffer_sRGB */
1064 case GL_FRAMEBUFFER_SRGB_EXT
:
1065 if (!_mesa_is_desktop_gl(ctx
))
1066 goto invalid_enum_error
;
1067 CHECK_EXTENSION(EXT_framebuffer_sRGB
, cap
);
1068 _mesa_set_framebuffer_srgb(ctx
, state
);
1071 /* GL_OES_EGL_image_external */
1072 case GL_TEXTURE_EXTERNAL_OES
:
1073 if (!_mesa_is_gles(ctx
))
1074 goto invalid_enum_error
;
1075 CHECK_EXTENSION(OES_EGL_image_external
, cap
);
1076 if (!enable_texture(ctx
, state
, TEXTURE_EXTERNAL_BIT
)) {
1081 /* ARB_texture_multisample */
1082 case GL_SAMPLE_MASK
:
1083 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles31(ctx
))
1084 goto invalid_enum_error
;
1085 CHECK_EXTENSION(ARB_texture_multisample
, cap
);
1086 if (ctx
->Multisample
.SampleMask
== state
)
1088 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleMask
? 0 :
1090 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleMask
;
1091 ctx
->Multisample
.SampleMask
= state
;
1094 case GL_BLEND_ADVANCED_COHERENT_KHR
:
1095 CHECK_EXTENSION(KHR_blend_equation_advanced_coherent
, cap
);
1096 if (ctx
->Color
.BlendCoherent
== state
)
1098 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewBlend
? 0 : _NEW_COLOR
);
1099 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewBlend
;
1100 ctx
->Color
.BlendCoherent
= state
;
1104 goto invalid_enum_error
;
1107 if (ctx
->Driver
.Enable
) {
1108 ctx
->Driver
.Enable( ctx
, cap
, state
);
1114 _mesa_error(ctx
, GL_INVALID_ENUM
, "gl%s(%s)",
1115 state
? "Enable" : "Disable", _mesa_enum_to_string(cap
));
1120 * Enable GL capability. Called by glEnable()
1121 * \param cap state to enable.
1124 _mesa_Enable( GLenum cap
)
1126 GET_CURRENT_CONTEXT(ctx
);
1128 _mesa_set_enable( ctx
, cap
, GL_TRUE
);
1133 * Disable GL capability. Called by glDisable()
1134 * \param cap state to disable.
1137 _mesa_Disable( GLenum cap
)
1139 GET_CURRENT_CONTEXT(ctx
);
1141 _mesa_set_enable( ctx
, cap
, GL_FALSE
);
1147 * Enable/disable an indexed state var.
1150 _mesa_set_enablei(struct gl_context
*ctx
, GLenum cap
,
1151 GLuint index
, GLboolean state
)
1153 assert(state
== 0 || state
== 1);
1156 if (!ctx
->Extensions
.EXT_draw_buffers2
) {
1157 goto invalid_enum_error
;
1159 if (index
>= ctx
->Const
.MaxDrawBuffers
) {
1160 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(index=%u)",
1161 state
? "glEnableIndexed" : "glDisableIndexed", index
);
1164 if (((ctx
->Color
.BlendEnabled
>> index
) & 1) != state
) {
1165 _mesa_flush_vertices_for_blend_state(ctx
);
1167 ctx
->Color
.BlendEnabled
|= (1 << index
);
1169 ctx
->Color
.BlendEnabled
&= ~(1 << index
);
1172 case GL_SCISSOR_TEST
:
1173 if (index
>= ctx
->Const
.MaxViewports
) {
1174 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(index=%u)",
1175 state
? "glEnablei" : "glDisablei", index
);
1178 if (((ctx
->Scissor
.EnableFlags
>> index
) & 1) != state
) {
1180 ctx
->DriverFlags
.NewScissorTest
? 0 : _NEW_SCISSOR
);
1181 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewScissorTest
;
1183 ctx
->Scissor
.EnableFlags
|= (1 << index
);
1185 ctx
->Scissor
.EnableFlags
&= ~(1 << index
);
1189 goto invalid_enum_error
;
1194 _mesa_error(ctx
, GL_INVALID_ENUM
, "%s(cap=%s)",
1195 state
? "glEnablei" : "glDisablei",
1196 _mesa_enum_to_string(cap
));
1201 _mesa_Disablei( GLenum cap
, GLuint index
)
1203 GET_CURRENT_CONTEXT(ctx
);
1204 _mesa_set_enablei(ctx
, cap
, index
, GL_FALSE
);
1209 _mesa_Enablei( GLenum cap
, GLuint index
)
1211 GET_CURRENT_CONTEXT(ctx
);
1212 _mesa_set_enablei(ctx
, cap
, index
, GL_TRUE
);
1216 GLboolean GLAPIENTRY
1217 _mesa_IsEnabledi( GLenum cap
, GLuint index
)
1219 GET_CURRENT_CONTEXT(ctx
);
1220 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
1223 if (index
>= ctx
->Const
.MaxDrawBuffers
) {
1224 _mesa_error(ctx
, GL_INVALID_VALUE
, "glIsEnabledIndexed(index=%u)",
1228 return (ctx
->Color
.BlendEnabled
>> index
) & 1;
1229 case GL_SCISSOR_TEST
:
1230 if (index
>= ctx
->Const
.MaxViewports
) {
1231 _mesa_error(ctx
, GL_INVALID_VALUE
, "glIsEnabledIndexed(index=%u)",
1235 return (ctx
->Scissor
.EnableFlags
>> index
) & 1;
1237 _mesa_error(ctx
, GL_INVALID_ENUM
, "glIsEnabledIndexed(cap=%s)",
1238 _mesa_enum_to_string(cap
));
1246 #undef CHECK_EXTENSION
1247 #define CHECK_EXTENSION(EXTNAME) \
1248 if (!ctx->Extensions.EXTNAME) { \
1249 goto invalid_enum_error; \
1252 #undef CHECK_EXTENSION2
1253 #define CHECK_EXTENSION2(EXT1, EXT2) \
1254 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
1255 goto invalid_enum_error; \
1260 * Helper function to determine whether a texture target is enabled.
1263 is_texture_enabled(struct gl_context
*ctx
, GLbitfield bit
)
1265 const struct gl_texture_unit
*const texUnit
=
1266 &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1267 return (texUnit
->Enabled
& bit
) ? GL_TRUE
: GL_FALSE
;
1272 * Return simple enable/disable state.
1274 * \param cap state variable to query.
1276 * Returns the state of the specified capability from the current GL context.
1277 * For the capabilities associated with extensions verifies that those
1278 * extensions are effectively present before reporting.
1280 GLboolean GLAPIENTRY
1281 _mesa_IsEnabled( GLenum cap
)
1283 GET_CURRENT_CONTEXT(ctx
);
1284 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
1288 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1289 goto invalid_enum_error
;
1290 return ctx
->Color
.AlphaEnabled
;
1291 case GL_AUTO_NORMAL
:
1292 if (ctx
->API
!= API_OPENGL_COMPAT
)
1293 goto invalid_enum_error
;
1294 return ctx
->Eval
.AutoNormal
;
1296 return ctx
->Color
.BlendEnabled
& 1; /* return state for buffer[0] */
1297 case GL_CLIP_DISTANCE0
: /* aka GL_CLIP_PLANE0 */
1298 case GL_CLIP_DISTANCE1
:
1299 case GL_CLIP_DISTANCE2
:
1300 case GL_CLIP_DISTANCE3
:
1301 case GL_CLIP_DISTANCE4
:
1302 case GL_CLIP_DISTANCE5
:
1303 case GL_CLIP_DISTANCE6
:
1304 case GL_CLIP_DISTANCE7
: {
1305 const GLuint p
= cap
- GL_CLIP_DISTANCE0
;
1307 if (p
>= ctx
->Const
.MaxClipPlanes
)
1308 goto invalid_enum_error
;
1310 return (ctx
->Transform
.ClipPlanesEnabled
>> p
) & 1;
1312 case GL_COLOR_MATERIAL
:
1313 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1314 goto invalid_enum_error
;
1315 return ctx
->Light
.ColorMaterialEnabled
;
1317 return ctx
->Polygon
.CullFlag
;
1318 case GL_DEBUG_OUTPUT
:
1319 case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
:
1320 return (GLboolean
) _mesa_get_debug_state_int(ctx
, cap
);
1322 return ctx
->Depth
.Test
;
1324 return ctx
->Color
.DitherFlag
;
1326 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1327 goto invalid_enum_error
;
1328 return ctx
->Fog
.Enabled
;
1330 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1331 goto invalid_enum_error
;
1332 return ctx
->Light
.Enabled
;
1341 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1342 goto invalid_enum_error
;
1343 return ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
;
1344 case GL_LINE_SMOOTH
:
1345 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1346 goto invalid_enum_error
;
1347 return ctx
->Line
.SmoothFlag
;
1348 case GL_LINE_STIPPLE
:
1349 if (ctx
->API
!= API_OPENGL_COMPAT
)
1350 goto invalid_enum_error
;
1351 return ctx
->Line
.StippleFlag
;
1352 case GL_INDEX_LOGIC_OP
:
1353 if (ctx
->API
!= API_OPENGL_COMPAT
)
1354 goto invalid_enum_error
;
1355 return ctx
->Color
.IndexLogicOpEnabled
;
1356 case GL_COLOR_LOGIC_OP
:
1357 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1358 goto invalid_enum_error
;
1359 return ctx
->Color
.ColorLogicOpEnabled
;
1360 case GL_MAP1_COLOR_4
:
1361 if (ctx
->API
!= API_OPENGL_COMPAT
)
1362 goto invalid_enum_error
;
1363 return ctx
->Eval
.Map1Color4
;
1365 if (ctx
->API
!= API_OPENGL_COMPAT
)
1366 goto invalid_enum_error
;
1367 return ctx
->Eval
.Map1Index
;
1368 case GL_MAP1_NORMAL
:
1369 if (ctx
->API
!= API_OPENGL_COMPAT
)
1370 goto invalid_enum_error
;
1371 return ctx
->Eval
.Map1Normal
;
1372 case GL_MAP1_TEXTURE_COORD_1
:
1373 if (ctx
->API
!= API_OPENGL_COMPAT
)
1374 goto invalid_enum_error
;
1375 return ctx
->Eval
.Map1TextureCoord1
;
1376 case GL_MAP1_TEXTURE_COORD_2
:
1377 if (ctx
->API
!= API_OPENGL_COMPAT
)
1378 goto invalid_enum_error
;
1379 return ctx
->Eval
.Map1TextureCoord2
;
1380 case GL_MAP1_TEXTURE_COORD_3
:
1381 if (ctx
->API
!= API_OPENGL_COMPAT
)
1382 goto invalid_enum_error
;
1383 return ctx
->Eval
.Map1TextureCoord3
;
1384 case GL_MAP1_TEXTURE_COORD_4
:
1385 if (ctx
->API
!= API_OPENGL_COMPAT
)
1386 goto invalid_enum_error
;
1387 return ctx
->Eval
.Map1TextureCoord4
;
1388 case GL_MAP1_VERTEX_3
:
1389 if (ctx
->API
!= API_OPENGL_COMPAT
)
1390 goto invalid_enum_error
;
1391 return ctx
->Eval
.Map1Vertex3
;
1392 case GL_MAP1_VERTEX_4
:
1393 if (ctx
->API
!= API_OPENGL_COMPAT
)
1394 goto invalid_enum_error
;
1395 return ctx
->Eval
.Map1Vertex4
;
1396 case GL_MAP2_COLOR_4
:
1397 if (ctx
->API
!= API_OPENGL_COMPAT
)
1398 goto invalid_enum_error
;
1399 return ctx
->Eval
.Map2Color4
;
1401 if (ctx
->API
!= API_OPENGL_COMPAT
)
1402 goto invalid_enum_error
;
1403 return ctx
->Eval
.Map2Index
;
1404 case GL_MAP2_NORMAL
:
1405 if (ctx
->API
!= API_OPENGL_COMPAT
)
1406 goto invalid_enum_error
;
1407 return ctx
->Eval
.Map2Normal
;
1408 case GL_MAP2_TEXTURE_COORD_1
:
1409 if (ctx
->API
!= API_OPENGL_COMPAT
)
1410 goto invalid_enum_error
;
1411 return ctx
->Eval
.Map2TextureCoord1
;
1412 case GL_MAP2_TEXTURE_COORD_2
:
1413 if (ctx
->API
!= API_OPENGL_COMPAT
)
1414 goto invalid_enum_error
;
1415 return ctx
->Eval
.Map2TextureCoord2
;
1416 case GL_MAP2_TEXTURE_COORD_3
:
1417 if (ctx
->API
!= API_OPENGL_COMPAT
)
1418 goto invalid_enum_error
;
1419 return ctx
->Eval
.Map2TextureCoord3
;
1420 case GL_MAP2_TEXTURE_COORD_4
:
1421 if (ctx
->API
!= API_OPENGL_COMPAT
)
1422 goto invalid_enum_error
;
1423 return ctx
->Eval
.Map2TextureCoord4
;
1424 case GL_MAP2_VERTEX_3
:
1425 if (ctx
->API
!= API_OPENGL_COMPAT
)
1426 goto invalid_enum_error
;
1427 return ctx
->Eval
.Map2Vertex3
;
1428 case GL_MAP2_VERTEX_4
:
1429 if (ctx
->API
!= API_OPENGL_COMPAT
)
1430 goto invalid_enum_error
;
1431 return ctx
->Eval
.Map2Vertex4
;
1433 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1434 goto invalid_enum_error
;
1435 return ctx
->Transform
.Normalize
;
1436 case GL_POINT_SMOOTH
:
1437 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1438 goto invalid_enum_error
;
1439 return ctx
->Point
.SmoothFlag
;
1440 case GL_POLYGON_SMOOTH
:
1441 if (!_mesa_is_desktop_gl(ctx
))
1442 goto invalid_enum_error
;
1443 return ctx
->Polygon
.SmoothFlag
;
1444 case GL_POLYGON_STIPPLE
:
1445 if (ctx
->API
!= API_OPENGL_COMPAT
)
1446 goto invalid_enum_error
;
1447 return ctx
->Polygon
.StippleFlag
;
1448 case GL_POLYGON_OFFSET_POINT
:
1449 if (!_mesa_is_desktop_gl(ctx
))
1450 goto invalid_enum_error
;
1451 return ctx
->Polygon
.OffsetPoint
;
1452 case GL_POLYGON_OFFSET_LINE
:
1453 if (!_mesa_is_desktop_gl(ctx
))
1454 goto invalid_enum_error
;
1455 return ctx
->Polygon
.OffsetLine
;
1456 case GL_POLYGON_OFFSET_FILL
:
1457 return ctx
->Polygon
.OffsetFill
;
1458 case GL_RESCALE_NORMAL_EXT
:
1459 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1460 goto invalid_enum_error
;
1461 return ctx
->Transform
.RescaleNormals
;
1462 case GL_SCISSOR_TEST
:
1463 return ctx
->Scissor
.EnableFlags
& 1; /* return state for index 0 */
1464 case GL_STENCIL_TEST
:
1465 return ctx
->Stencil
.Enabled
;
1467 if (ctx
->API
!= API_OPENGL_COMPAT
)
1468 goto invalid_enum_error
;
1469 return is_texture_enabled(ctx
, TEXTURE_1D_BIT
);
1471 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1472 goto invalid_enum_error
;
1473 return is_texture_enabled(ctx
, TEXTURE_2D_BIT
);
1475 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1476 goto invalid_enum_error
;
1477 return is_texture_enabled(ctx
, TEXTURE_3D_BIT
);
1478 case GL_TEXTURE_GEN_S
:
1479 case GL_TEXTURE_GEN_T
:
1480 case GL_TEXTURE_GEN_R
:
1481 case GL_TEXTURE_GEN_Q
:
1483 const struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
1485 if (ctx
->API
!= API_OPENGL_COMPAT
)
1486 goto invalid_enum_error
;
1489 GLbitfield coordBit
= S_BIT
<< (cap
- GL_TEXTURE_GEN_S
);
1490 return (texUnit
->TexGenEnabled
& coordBit
) ? GL_TRUE
: GL_FALSE
;
1494 case GL_TEXTURE_GEN_STR_OES
:
1496 const struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
1498 if (ctx
->API
!= API_OPENGLES
)
1499 goto invalid_enum_error
;
1502 return (texUnit
->TexGenEnabled
& STR_BITS
) == STR_BITS
1503 ? GL_TRUE
: GL_FALSE
;
1507 /* client-side state */
1508 case GL_VERTEX_ARRAY
:
1509 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1510 goto invalid_enum_error
;
1511 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_POS
].Enabled
;
1512 case GL_NORMAL_ARRAY
:
1513 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1514 goto invalid_enum_error
;
1515 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_NORMAL
].Enabled
;
1516 case GL_COLOR_ARRAY
:
1517 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1518 goto invalid_enum_error
;
1519 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_COLOR0
].Enabled
;
1520 case GL_INDEX_ARRAY
:
1521 if (ctx
->API
!= API_OPENGL_COMPAT
)
1522 goto invalid_enum_error
;
1523 return ctx
->Array
.VAO
->
1524 VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].Enabled
;
1525 case GL_TEXTURE_COORD_ARRAY
:
1526 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1527 goto invalid_enum_error
;
1528 return ctx
->Array
.VAO
->
1529 VertexAttrib
[VERT_ATTRIB_TEX(ctx
->Array
.ActiveTexture
)].Enabled
;
1530 case GL_EDGE_FLAG_ARRAY
:
1531 if (ctx
->API
!= API_OPENGL_COMPAT
)
1532 goto invalid_enum_error
;
1533 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_EDGEFLAG
].Enabled
;
1534 case GL_FOG_COORDINATE_ARRAY_EXT
:
1535 if (ctx
->API
!= API_OPENGL_COMPAT
)
1536 goto invalid_enum_error
;
1537 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_FOG
].Enabled
;
1538 case GL_SECONDARY_COLOR_ARRAY_EXT
:
1539 if (ctx
->API
!= API_OPENGL_COMPAT
)
1540 goto invalid_enum_error
;
1541 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_COLOR1
].Enabled
;
1542 case GL_POINT_SIZE_ARRAY_OES
:
1543 if (ctx
->API
!= API_OPENGLES
)
1544 goto invalid_enum_error
;
1545 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_POINT_SIZE
].Enabled
;
1547 /* GL_ARB_texture_cube_map */
1548 case GL_TEXTURE_CUBE_MAP
:
1549 CHECK_EXTENSION(ARB_texture_cube_map
);
1550 return is_texture_enabled(ctx
, TEXTURE_CUBE_BIT
);
1552 /* GL_EXT_secondary_color */
1553 case GL_COLOR_SUM_EXT
:
1554 if (ctx
->API
!= API_OPENGL_COMPAT
)
1555 goto invalid_enum_error
;
1556 return ctx
->Fog
.ColorSumEnabled
;
1558 /* GL_ARB_multisample */
1559 case GL_MULTISAMPLE_ARB
:
1560 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1561 goto invalid_enum_error
;
1562 return ctx
->Multisample
.Enabled
;
1563 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
:
1564 return ctx
->Multisample
.SampleAlphaToCoverage
;
1565 case GL_SAMPLE_ALPHA_TO_ONE_ARB
:
1566 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1567 goto invalid_enum_error
;
1568 return ctx
->Multisample
.SampleAlphaToOne
;
1569 case GL_SAMPLE_COVERAGE_ARB
:
1570 return ctx
->Multisample
.SampleCoverage
;
1571 case GL_SAMPLE_COVERAGE_INVERT_ARB
:
1572 if (!_mesa_is_desktop_gl(ctx
))
1573 goto invalid_enum_error
;
1574 return ctx
->Multisample
.SampleCoverageInvert
;
1576 /* GL_IBM_rasterpos_clip */
1577 case GL_RASTER_POSITION_UNCLIPPED_IBM
:
1578 if (ctx
->API
!= API_OPENGL_COMPAT
)
1579 goto invalid_enum_error
;
1580 return ctx
->Transform
.RasterPositionUnclipped
;
1582 /* GL_NV_point_sprite */
1583 case GL_POINT_SPRITE_NV
:
1584 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1585 goto invalid_enum_error
;
1586 CHECK_EXTENSION2(NV_point_sprite
, ARB_point_sprite
)
1587 return ctx
->Point
.PointSprite
;
1589 case GL_VERTEX_PROGRAM_ARB
:
1590 if (ctx
->API
!= API_OPENGL_COMPAT
)
1591 goto invalid_enum_error
;
1592 CHECK_EXTENSION(ARB_vertex_program
);
1593 return ctx
->VertexProgram
.Enabled
;
1594 case GL_VERTEX_PROGRAM_POINT_SIZE_ARB
:
1595 /* This was added with ARB_vertex_program, but it is also used with
1596 * GLSL vertex shaders on desktop.
1598 if (!_mesa_is_desktop_gl(ctx
))
1599 goto invalid_enum_error
;
1600 CHECK_EXTENSION(ARB_vertex_program
);
1601 return ctx
->VertexProgram
.PointSizeEnabled
;
1602 case GL_VERTEX_PROGRAM_TWO_SIDE_ARB
:
1603 if (ctx
->API
!= API_OPENGL_COMPAT
)
1604 goto invalid_enum_error
;
1605 CHECK_EXTENSION(ARB_vertex_program
);
1606 return ctx
->VertexProgram
.TwoSideEnabled
;
1608 /* GL_NV_texture_rectangle */
1609 case GL_TEXTURE_RECTANGLE_NV
:
1610 if (ctx
->API
!= API_OPENGL_COMPAT
)
1611 goto invalid_enum_error
;
1612 CHECK_EXTENSION(NV_texture_rectangle
);
1613 return is_texture_enabled(ctx
, TEXTURE_RECT_BIT
);
1615 /* GL_EXT_stencil_two_side */
1616 case GL_STENCIL_TEST_TWO_SIDE_EXT
:
1617 if (ctx
->API
!= API_OPENGL_COMPAT
)
1618 goto invalid_enum_error
;
1619 CHECK_EXTENSION(EXT_stencil_two_side
);
1620 return ctx
->Stencil
.TestTwoSide
;
1622 case GL_FRAGMENT_PROGRAM_ARB
:
1623 if (ctx
->API
!= API_OPENGL_COMPAT
)
1624 goto invalid_enum_error
;
1625 return ctx
->FragmentProgram
.Enabled
;
1627 /* GL_EXT_depth_bounds_test */
1628 case GL_DEPTH_BOUNDS_TEST_EXT
:
1629 if (!_mesa_is_desktop_gl(ctx
))
1630 goto invalid_enum_error
;
1631 CHECK_EXTENSION(EXT_depth_bounds_test
);
1632 return ctx
->Depth
.BoundsTest
;
1634 /* GL_ARB_depth_clamp */
1635 case GL_DEPTH_CLAMP
:
1636 if (!_mesa_is_desktop_gl(ctx
))
1637 goto invalid_enum_error
;
1638 CHECK_EXTENSION(ARB_depth_clamp
);
1639 return ctx
->Transform
.DepthClamp
;
1641 case GL_FRAGMENT_SHADER_ATI
:
1642 if (ctx
->API
!= API_OPENGL_COMPAT
)
1643 goto invalid_enum_error
;
1644 CHECK_EXTENSION(ATI_fragment_shader
);
1645 return ctx
->ATIFragmentShader
.Enabled
;
1647 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1648 if (!_mesa_is_desktop_gl(ctx
))
1649 goto invalid_enum_error
;
1650 CHECK_EXTENSION(ARB_seamless_cube_map
);
1651 return ctx
->Texture
.CubeMapSeamless
;
1653 case GL_RASTERIZER_DISCARD
:
1654 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
1655 goto invalid_enum_error
;
1656 CHECK_EXTENSION(EXT_transform_feedback
);
1657 return ctx
->RasterDiscard
;
1659 /* GL_NV_primitive_restart */
1660 case GL_PRIMITIVE_RESTART_NV
:
1661 if (ctx
->API
!= API_OPENGL_COMPAT
|| !ctx
->Extensions
.NV_primitive_restart
) {
1662 goto invalid_enum_error
;
1664 return ctx
->Array
.PrimitiveRestart
;
1666 /* GL 3.1 primitive restart */
1667 case GL_PRIMITIVE_RESTART
:
1668 if (!_mesa_is_desktop_gl(ctx
) || ctx
->Version
< 31) {
1669 goto invalid_enum_error
;
1671 return ctx
->Array
.PrimitiveRestart
;
1673 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
1674 if (!_mesa_is_gles3(ctx
) && !ctx
->Extensions
.ARB_ES3_compatibility
) {
1675 goto invalid_enum_error
;
1677 return ctx
->Array
.PrimitiveRestartFixedIndex
;
1679 /* GL3.0 - GL_framebuffer_sRGB */
1680 case GL_FRAMEBUFFER_SRGB_EXT
:
1681 if (!_mesa_is_desktop_gl(ctx
))
1682 goto invalid_enum_error
;
1683 CHECK_EXTENSION(EXT_framebuffer_sRGB
);
1684 return ctx
->Color
.sRGBEnabled
;
1686 /* GL_OES_EGL_image_external */
1687 case GL_TEXTURE_EXTERNAL_OES
:
1688 if (!_mesa_is_gles(ctx
))
1689 goto invalid_enum_error
;
1690 CHECK_EXTENSION(OES_EGL_image_external
);
1691 return is_texture_enabled(ctx
, TEXTURE_EXTERNAL_BIT
);
1693 /* ARB_texture_multisample */
1694 case GL_SAMPLE_MASK
:
1695 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles31(ctx
))
1696 goto invalid_enum_error
;
1697 CHECK_EXTENSION(ARB_texture_multisample
);
1698 return ctx
->Multisample
.SampleMask
;
1700 /* ARB_sample_shading */
1701 case GL_SAMPLE_SHADING
:
1702 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
1703 goto invalid_enum_error
;
1704 CHECK_EXTENSION(ARB_sample_shading
);
1705 return ctx
->Multisample
.SampleShading
;
1707 case GL_BLEND_ADVANCED_COHERENT_KHR
:
1708 CHECK_EXTENSION(KHR_blend_equation_advanced_coherent
);
1709 return ctx
->Color
.BlendCoherent
;
1711 case GL_CONSERVATIVE_RASTERIZATION_INTEL
:
1712 CHECK_EXTENSION(INTEL_conservative_rasterization
);
1713 return ctx
->IntelConservativeRasterization
;
1716 goto invalid_enum_error
;
1722 _mesa_error(ctx
, GL_INVALID_ENUM
, "glIsEnabled(%s)",
1723 _mesa_enum_to_string(cap
));