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
;
72 var
= &vao
->VertexAttrib
[VERT_ATTRIB_POS
].Enabled
;
76 var
= &vao
->VertexAttrib
[VERT_ATTRIB_NORMAL
].Enabled
;
77 flag
= VERT_BIT_NORMAL
;
80 var
= &vao
->VertexAttrib
[VERT_ATTRIB_COLOR0
].Enabled
;
81 flag
= VERT_BIT_COLOR0
;
84 var
= &vao
->VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].Enabled
;
85 flag
= VERT_BIT_COLOR_INDEX
;
87 case GL_TEXTURE_COORD_ARRAY
:
88 var
= &vao
->VertexAttrib
[VERT_ATTRIB_TEX(ctx
->Array
.ActiveTexture
)].Enabled
;
89 flag
= VERT_BIT_TEX(ctx
->Array
.ActiveTexture
);
91 case GL_EDGE_FLAG_ARRAY
:
92 var
= &vao
->VertexAttrib
[VERT_ATTRIB_EDGEFLAG
].Enabled
;
93 flag
= VERT_BIT_EDGEFLAG
;
95 case GL_FOG_COORDINATE_ARRAY_EXT
:
96 var
= &vao
->VertexAttrib
[VERT_ATTRIB_FOG
].Enabled
;
99 case GL_SECONDARY_COLOR_ARRAY_EXT
:
100 var
= &vao
->VertexAttrib
[VERT_ATTRIB_COLOR1
].Enabled
;
101 flag
= VERT_BIT_COLOR1
;
104 case GL_POINT_SIZE_ARRAY_OES
:
105 var
= &vao
->VertexAttrib
[VERT_ATTRIB_POINT_SIZE
].Enabled
;
106 flag
= VERT_BIT_POINT_SIZE
;
107 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
108 ctx
->VertexProgram
.PointSizeEnabled
= state
;
111 /* GL_NV_primitive_restart */
112 case GL_PRIMITIVE_RESTART_NV
:
113 if (!ctx
->Extensions
.NV_primitive_restart
) {
114 goto invalid_enum_error
;
116 var
= &ctx
->Array
.PrimitiveRestart
;
121 goto invalid_enum_error
;
127 FLUSH_VERTICES(ctx
, _NEW_ARRAY
);
131 update_derived_primitive_restart_state(ctx
);
134 vao
->_Enabled
|= flag
;
136 vao
->_Enabled
&= ~flag
;
138 vao
->NewArrays
|= flag
;
140 if (ctx
->Driver
.Enable
) {
141 ctx
->Driver
.Enable( ctx
, cap
, state
);
147 _mesa_error(ctx
, GL_INVALID_ENUM
, "gl%sClientState(%s)",
148 state
? "Enable" : "Disable", _mesa_enum_to_string(cap
));
153 * Enable GL capability.
154 * \param cap state to enable/disable.
156 * Get's the current context, assures that we're outside glBegin()/glEnd() and
157 * calls client_state().
160 _mesa_EnableClientState( GLenum cap
)
162 GET_CURRENT_CONTEXT(ctx
);
163 client_state( ctx
, cap
, GL_TRUE
);
168 * Disable GL capability.
169 * \param cap state to enable/disable.
171 * Get's the current context, assures that we're outside glBegin()/glEnd() and
172 * calls client_state().
175 _mesa_DisableClientState( GLenum cap
)
177 GET_CURRENT_CONTEXT(ctx
);
178 client_state( ctx
, cap
, GL_FALSE
);
182 #undef CHECK_EXTENSION
183 #define CHECK_EXTENSION(EXTNAME, CAP) \
184 if (!ctx->Extensions.EXTNAME) { \
185 goto invalid_enum_error; \
188 #define CHECK_EXTENSION2(EXT1, EXT2, CAP) \
189 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
190 goto invalid_enum_error; \
194 * Return pointer to current texture unit for setting/getting coordinate
196 * Note that we'll set GL_INVALID_OPERATION and return NULL if the active
197 * texture unit is higher than the number of supported coordinate units.
199 static struct gl_texture_unit
*
200 get_texcoord_unit(struct gl_context
*ctx
)
202 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxTextureCoordUnits
) {
203 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEnable/Disable(texcoord unit)");
207 return &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
213 * Helper function to enable or disable a texture target.
214 * \param bit one of the TEXTURE_x_BIT values
215 * \return GL_TRUE if state is changing or GL_FALSE if no change
218 enable_texture(struct gl_context
*ctx
, GLboolean state
, GLbitfield texBit
)
220 struct gl_texture_unit
*texUnit
= _mesa_get_current_tex_unit(ctx
);
221 const GLbitfield newenabled
= state
222 ? (texUnit
->Enabled
| texBit
) : (texUnit
->Enabled
& ~texBit
);
224 if (texUnit
->Enabled
== newenabled
)
227 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
228 texUnit
->Enabled
= newenabled
;
234 * Helper function to enable or disable GL_MULTISAMPLE, skipping the check for
235 * whether the API supports it (GLES doesn't).
238 _mesa_set_multisample(struct gl_context
*ctx
, GLboolean state
)
240 if (ctx
->Multisample
.Enabled
== state
)
243 /* GL compatibility needs Multisample.Enable to determine program state
246 if (ctx
->API
== API_OPENGL_COMPAT
|| ctx
->API
== API_OPENGLES
||
247 !ctx
->DriverFlags
.NewMultisampleEnable
) {
248 FLUSH_VERTICES(ctx
, _NEW_MULTISAMPLE
);
250 FLUSH_VERTICES(ctx
, 0);
253 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewMultisampleEnable
;
254 ctx
->Multisample
.Enabled
= state
;
256 if (ctx
->Driver
.Enable
) {
257 ctx
->Driver
.Enable(ctx
, GL_MULTISAMPLE
, state
);
262 * Helper function to enable or disable GL_FRAMEBUFFER_SRGB, skipping the
263 * check for whether the API supports it (GLES doesn't).
266 _mesa_set_framebuffer_srgb(struct gl_context
*ctx
, GLboolean state
)
268 if (ctx
->Color
.sRGBEnabled
== state
)
271 /* TODO: Switch i965 to the new flag and remove the conditional */
272 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewFramebufferSRGB
? 0 : _NEW_BUFFERS
);
273 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewFramebufferSRGB
;
274 ctx
->Color
.sRGBEnabled
= state
;
276 if (ctx
->Driver
.Enable
) {
277 ctx
->Driver
.Enable(ctx
, GL_FRAMEBUFFER_SRGB
, state
);
282 * Helper function to enable or disable state.
284 * \param ctx GL context.
285 * \param cap the state to enable/disable
286 * \param state whether to enable or disable the specified capability.
288 * Updates the current context and flushes the vertices as needed. For
289 * capabilities associated with extensions it verifies that those extensions
290 * are effectivly present before updating. Notifies the driver via
291 * dd_function_table::Enable.
294 _mesa_set_enable(struct gl_context
*ctx
, GLenum cap
, GLboolean state
)
296 if (MESA_VERBOSE
& VERBOSE_API
)
297 _mesa_debug(ctx
, "%s %s (newstate is %x)\n",
298 state
? "glEnable" : "glDisable",
299 _mesa_enum_to_string(cap
),
304 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
305 goto invalid_enum_error
;
306 if (ctx
->Color
.AlphaEnabled
== state
)
308 /* AlphaEnabled is used by the fixed-func fragment program */
309 FLUSH_VERTICES(ctx
, _NEW_COLOR
);
310 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewAlphaTest
;
311 ctx
->Color
.AlphaEnabled
= state
;
314 if (ctx
->API
!= API_OPENGL_COMPAT
)
315 goto invalid_enum_error
;
316 if (ctx
->Eval
.AutoNormal
== state
)
318 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
319 ctx
->Eval
.AutoNormal
= state
;
323 GLbitfield newEnabled
=
324 state
* ((1 << ctx
->Const
.MaxDrawBuffers
) - 1);
325 if (newEnabled
!= ctx
->Color
.BlendEnabled
) {
326 _mesa_flush_vertices_for_blend_state(ctx
);
327 ctx
->Color
.BlendEnabled
= newEnabled
;
331 case GL_CLIP_DISTANCE0
: /* aka GL_CLIP_PLANE0 */
332 case GL_CLIP_DISTANCE1
:
333 case GL_CLIP_DISTANCE2
:
334 case GL_CLIP_DISTANCE3
:
335 case GL_CLIP_DISTANCE4
:
336 case GL_CLIP_DISTANCE5
:
337 case GL_CLIP_DISTANCE6
:
338 case GL_CLIP_DISTANCE7
:
340 const GLuint p
= cap
- GL_CLIP_DISTANCE0
;
342 if (p
>= ctx
->Const
.MaxClipPlanes
)
343 goto invalid_enum_error
;
345 if ((ctx
->Transform
.ClipPlanesEnabled
& (1 << p
))
346 == ((GLuint
) state
<< p
))
349 /* The compatibility profile needs _NEW_TRANSFORM to transform
350 * clip planes according to the projection matrix.
352 if (ctx
->API
== API_OPENGL_COMPAT
|| ctx
->API
== API_OPENGLES
||
353 !ctx
->DriverFlags
.NewClipPlaneEnable
) {
354 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
356 FLUSH_VERTICES(ctx
, 0);
358 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewClipPlaneEnable
;
361 ctx
->Transform
.ClipPlanesEnabled
|= (1 << p
);
362 if (ctx
->API
== API_OPENGL_COMPAT
|| ctx
->API
== API_OPENGLES
)
363 _mesa_update_clip_plane(ctx
, p
);
366 ctx
->Transform
.ClipPlanesEnabled
&= ~(1 << p
);
370 case GL_COLOR_MATERIAL
:
371 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
372 goto invalid_enum_error
;
373 if (ctx
->Light
.ColorMaterialEnabled
== state
)
375 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
376 FLUSH_CURRENT(ctx
, 0);
377 ctx
->Light
.ColorMaterialEnabled
= state
;
379 _mesa_update_color_material( ctx
,
380 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
] );
384 if (ctx
->Polygon
.CullFlag
== state
)
387 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
388 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
389 ctx
->Polygon
.CullFlag
= state
;
392 if (ctx
->Depth
.Test
== state
)
394 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewDepth
? 0 : _NEW_DEPTH
);
395 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewDepth
;
396 ctx
->Depth
.Test
= state
;
398 case GL_DEBUG_OUTPUT
:
399 case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
:
400 _mesa_set_debug_state_int(ctx
, cap
, state
);
403 if (ctx
->Color
.DitherFlag
== state
)
405 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewBlend
? 0 : _NEW_COLOR
);
406 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewBlend
;
407 ctx
->Color
.DitherFlag
= state
;
410 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
411 goto invalid_enum_error
;
412 if (ctx
->Fog
.Enabled
== state
)
414 FLUSH_VERTICES(ctx
, _NEW_FOG
);
415 ctx
->Fog
.Enabled
= state
;
416 ctx
->Fog
._PackedEnabledMode
= state
? ctx
->Fog
._PackedMode
: FOG_NONE
;
426 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
427 goto invalid_enum_error
;
428 if (ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
== state
)
430 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
431 ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
= state
;
433 ctx
->Light
._EnabledLights
|= 1u << (cap
- GL_LIGHT0
);
436 ctx
->Light
._EnabledLights
&= ~(1u << (cap
- GL_LIGHT0
));
440 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
441 goto invalid_enum_error
;
442 if (ctx
->Light
.Enabled
== state
)
444 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
445 ctx
->Light
.Enabled
= state
;
448 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
449 goto invalid_enum_error
;
450 if (ctx
->Line
.SmoothFlag
== state
)
452 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLineState
? 0 : _NEW_LINE
);
453 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLineState
;
454 ctx
->Line
.SmoothFlag
= state
;
456 case GL_LINE_STIPPLE
:
457 if (ctx
->API
!= API_OPENGL_COMPAT
)
458 goto invalid_enum_error
;
459 if (ctx
->Line
.StippleFlag
== state
)
461 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLineState
? 0 : _NEW_LINE
);
462 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLineState
;
463 ctx
->Line
.StippleFlag
= state
;
465 case GL_INDEX_LOGIC_OP
:
466 if (ctx
->API
!= API_OPENGL_COMPAT
)
467 goto invalid_enum_error
;
468 if (ctx
->Color
.IndexLogicOpEnabled
== state
)
470 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLogicOp
? 0 : _NEW_COLOR
);
471 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLogicOp
;
472 ctx
->Color
.IndexLogicOpEnabled
= state
;
474 case GL_CONSERVATIVE_RASTERIZATION_INTEL
:
475 if (!_mesa_has_INTEL_conservative_rasterization(ctx
))
476 goto invalid_enum_error
;
477 if (ctx
->IntelConservativeRasterization
== state
)
479 FLUSH_VERTICES(ctx
, 0);
480 ctx
->NewDriverState
|=
481 ctx
->DriverFlags
.NewIntelConservativeRasterization
;
482 ctx
->IntelConservativeRasterization
= state
;
484 case GL_COLOR_LOGIC_OP
:
485 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
486 goto invalid_enum_error
;
487 if (ctx
->Color
.ColorLogicOpEnabled
== state
)
489 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLogicOp
? 0 : _NEW_COLOR
);
490 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLogicOp
;
491 ctx
->Color
.ColorLogicOpEnabled
= state
;
493 case GL_MAP1_COLOR_4
:
494 if (ctx
->API
!= API_OPENGL_COMPAT
)
495 goto invalid_enum_error
;
496 if (ctx
->Eval
.Map1Color4
== state
)
498 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
499 ctx
->Eval
.Map1Color4
= state
;
502 if (ctx
->API
!= API_OPENGL_COMPAT
)
503 goto invalid_enum_error
;
504 if (ctx
->Eval
.Map1Index
== state
)
506 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
507 ctx
->Eval
.Map1Index
= state
;
510 if (ctx
->API
!= API_OPENGL_COMPAT
)
511 goto invalid_enum_error
;
512 if (ctx
->Eval
.Map1Normal
== state
)
514 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
515 ctx
->Eval
.Map1Normal
= state
;
517 case GL_MAP1_TEXTURE_COORD_1
:
518 if (ctx
->API
!= API_OPENGL_COMPAT
)
519 goto invalid_enum_error
;
520 if (ctx
->Eval
.Map1TextureCoord1
== state
)
522 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
523 ctx
->Eval
.Map1TextureCoord1
= state
;
525 case GL_MAP1_TEXTURE_COORD_2
:
526 if (ctx
->API
!= API_OPENGL_COMPAT
)
527 goto invalid_enum_error
;
528 if (ctx
->Eval
.Map1TextureCoord2
== state
)
530 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
531 ctx
->Eval
.Map1TextureCoord2
= state
;
533 case GL_MAP1_TEXTURE_COORD_3
:
534 if (ctx
->API
!= API_OPENGL_COMPAT
)
535 goto invalid_enum_error
;
536 if (ctx
->Eval
.Map1TextureCoord3
== state
)
538 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
539 ctx
->Eval
.Map1TextureCoord3
= state
;
541 case GL_MAP1_TEXTURE_COORD_4
:
542 if (ctx
->API
!= API_OPENGL_COMPAT
)
543 goto invalid_enum_error
;
544 if (ctx
->Eval
.Map1TextureCoord4
== state
)
546 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
547 ctx
->Eval
.Map1TextureCoord4
= state
;
549 case GL_MAP1_VERTEX_3
:
550 if (ctx
->API
!= API_OPENGL_COMPAT
)
551 goto invalid_enum_error
;
552 if (ctx
->Eval
.Map1Vertex3
== state
)
554 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
555 ctx
->Eval
.Map1Vertex3
= state
;
557 case GL_MAP1_VERTEX_4
:
558 if (ctx
->API
!= API_OPENGL_COMPAT
)
559 goto invalid_enum_error
;
560 if (ctx
->Eval
.Map1Vertex4
== state
)
562 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
563 ctx
->Eval
.Map1Vertex4
= state
;
565 case GL_MAP2_COLOR_4
:
566 if (ctx
->API
!= API_OPENGL_COMPAT
)
567 goto invalid_enum_error
;
568 if (ctx
->Eval
.Map2Color4
== state
)
570 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
571 ctx
->Eval
.Map2Color4
= state
;
574 if (ctx
->API
!= API_OPENGL_COMPAT
)
575 goto invalid_enum_error
;
576 if (ctx
->Eval
.Map2Index
== state
)
578 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
579 ctx
->Eval
.Map2Index
= state
;
582 if (ctx
->API
!= API_OPENGL_COMPAT
)
583 goto invalid_enum_error
;
584 if (ctx
->Eval
.Map2Normal
== state
)
586 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
587 ctx
->Eval
.Map2Normal
= state
;
589 case GL_MAP2_TEXTURE_COORD_1
:
590 if (ctx
->API
!= API_OPENGL_COMPAT
)
591 goto invalid_enum_error
;
592 if (ctx
->Eval
.Map2TextureCoord1
== state
)
594 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
595 ctx
->Eval
.Map2TextureCoord1
= state
;
597 case GL_MAP2_TEXTURE_COORD_2
:
598 if (ctx
->API
!= API_OPENGL_COMPAT
)
599 goto invalid_enum_error
;
600 if (ctx
->Eval
.Map2TextureCoord2
== state
)
602 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
603 ctx
->Eval
.Map2TextureCoord2
= state
;
605 case GL_MAP2_TEXTURE_COORD_3
:
606 if (ctx
->API
!= API_OPENGL_COMPAT
)
607 goto invalid_enum_error
;
608 if (ctx
->Eval
.Map2TextureCoord3
== state
)
610 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
611 ctx
->Eval
.Map2TextureCoord3
= state
;
613 case GL_MAP2_TEXTURE_COORD_4
:
614 if (ctx
->API
!= API_OPENGL_COMPAT
)
615 goto invalid_enum_error
;
616 if (ctx
->Eval
.Map2TextureCoord4
== state
)
618 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
619 ctx
->Eval
.Map2TextureCoord4
= state
;
621 case GL_MAP2_VERTEX_3
:
622 if (ctx
->API
!= API_OPENGL_COMPAT
)
623 goto invalid_enum_error
;
624 if (ctx
->Eval
.Map2Vertex3
== state
)
626 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
627 ctx
->Eval
.Map2Vertex3
= state
;
629 case GL_MAP2_VERTEX_4
:
630 if (ctx
->API
!= API_OPENGL_COMPAT
)
631 goto invalid_enum_error
;
632 if (ctx
->Eval
.Map2Vertex4
== state
)
634 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
635 ctx
->Eval
.Map2Vertex4
= state
;
638 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
639 goto invalid_enum_error
;
640 if (ctx
->Transform
.Normalize
== state
)
642 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
643 ctx
->Transform
.Normalize
= state
;
645 case GL_POINT_SMOOTH
:
646 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
647 goto invalid_enum_error
;
648 if (ctx
->Point
.SmoothFlag
== state
)
650 FLUSH_VERTICES(ctx
, _NEW_POINT
);
651 ctx
->Point
.SmoothFlag
= state
;
653 case GL_POLYGON_SMOOTH
:
654 if (!_mesa_is_desktop_gl(ctx
))
655 goto invalid_enum_error
;
656 if (ctx
->Polygon
.SmoothFlag
== state
)
659 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
660 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
661 ctx
->Polygon
.SmoothFlag
= state
;
663 case GL_POLYGON_STIPPLE
:
664 if (ctx
->API
!= API_OPENGL_COMPAT
)
665 goto invalid_enum_error
;
666 if (ctx
->Polygon
.StippleFlag
== state
)
669 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
670 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
671 ctx
->Polygon
.StippleFlag
= state
;
673 case GL_POLYGON_OFFSET_POINT
:
674 if (!_mesa_is_desktop_gl(ctx
))
675 goto invalid_enum_error
;
676 if (ctx
->Polygon
.OffsetPoint
== state
)
679 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
680 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
681 ctx
->Polygon
.OffsetPoint
= state
;
683 case GL_POLYGON_OFFSET_LINE
:
684 if (!_mesa_is_desktop_gl(ctx
))
685 goto invalid_enum_error
;
686 if (ctx
->Polygon
.OffsetLine
== state
)
689 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
690 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
691 ctx
->Polygon
.OffsetLine
= state
;
693 case GL_POLYGON_OFFSET_FILL
:
694 if (ctx
->Polygon
.OffsetFill
== state
)
697 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
698 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
699 ctx
->Polygon
.OffsetFill
= state
;
701 case GL_RESCALE_NORMAL_EXT
:
702 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
703 goto invalid_enum_error
;
704 if (ctx
->Transform
.RescaleNormals
== state
)
706 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
707 ctx
->Transform
.RescaleNormals
= state
;
709 case GL_SCISSOR_TEST
:
711 /* Must expand glEnable to all scissors */
712 GLbitfield newEnabled
=
713 state
* ((1 << ctx
->Const
.MaxViewports
) - 1);
714 if (newEnabled
!= ctx
->Scissor
.EnableFlags
) {
715 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewScissorTest
? 0 :
717 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewScissorTest
;
718 ctx
->Scissor
.EnableFlags
= newEnabled
;
722 case GL_STENCIL_TEST
:
723 if (ctx
->Stencil
.Enabled
== state
)
725 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewStencil
? 0 : _NEW_STENCIL
);
726 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewStencil
;
727 ctx
->Stencil
.Enabled
= state
;
730 if (ctx
->API
!= API_OPENGL_COMPAT
)
731 goto invalid_enum_error
;
732 if (!enable_texture(ctx
, state
, TEXTURE_1D_BIT
)) {
737 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
738 goto invalid_enum_error
;
739 if (!enable_texture(ctx
, state
, TEXTURE_2D_BIT
)) {
744 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
745 goto invalid_enum_error
;
746 if (!enable_texture(ctx
, state
, TEXTURE_3D_BIT
)) {
750 case GL_TEXTURE_GEN_S
:
751 case GL_TEXTURE_GEN_T
:
752 case GL_TEXTURE_GEN_R
:
753 case GL_TEXTURE_GEN_Q
:
755 struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
757 if (ctx
->API
!= API_OPENGL_COMPAT
)
758 goto invalid_enum_error
;
761 GLbitfield coordBit
= S_BIT
<< (cap
- GL_TEXTURE_GEN_S
);
762 GLbitfield newenabled
= texUnit
->TexGenEnabled
& ~coordBit
;
764 newenabled
|= coordBit
;
765 if (texUnit
->TexGenEnabled
== newenabled
)
767 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
768 texUnit
->TexGenEnabled
= newenabled
;
773 case GL_TEXTURE_GEN_STR_OES
:
774 /* disable S, T, and R at the same time */
776 struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
778 if (ctx
->API
!= API_OPENGLES
)
779 goto invalid_enum_error
;
783 texUnit
->TexGenEnabled
& ~STR_BITS
;
785 newenabled
|= STR_BITS
;
786 if (texUnit
->TexGenEnabled
== newenabled
)
788 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
789 texUnit
->TexGenEnabled
= newenabled
;
794 /* client-side state */
795 case GL_VERTEX_ARRAY
:
796 case GL_NORMAL_ARRAY
:
798 case GL_TEXTURE_COORD_ARRAY
:
799 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
800 goto invalid_enum_error
;
801 client_state( ctx
, cap
, state
);
804 case GL_EDGE_FLAG_ARRAY
:
805 case GL_FOG_COORDINATE_ARRAY_EXT
:
806 case GL_SECONDARY_COLOR_ARRAY_EXT
:
807 if (ctx
->API
!= API_OPENGL_COMPAT
)
808 goto invalid_enum_error
;
809 client_state( ctx
, cap
, state
);
811 case GL_POINT_SIZE_ARRAY_OES
:
812 if (ctx
->API
!= API_OPENGLES
)
813 goto invalid_enum_error
;
814 client_state( ctx
, cap
, state
);
817 /* GL_ARB_texture_cube_map */
818 case GL_TEXTURE_CUBE_MAP
:
819 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
820 goto invalid_enum_error
;
821 CHECK_EXTENSION(ARB_texture_cube_map
, cap
);
822 if (!enable_texture(ctx
, state
, TEXTURE_CUBE_BIT
)) {
827 /* GL_EXT_secondary_color */
828 case GL_COLOR_SUM_EXT
:
829 if (ctx
->API
!= API_OPENGL_COMPAT
)
830 goto invalid_enum_error
;
831 if (ctx
->Fog
.ColorSumEnabled
== state
)
833 FLUSH_VERTICES(ctx
, _NEW_FOG
);
834 ctx
->Fog
.ColorSumEnabled
= state
;
837 /* GL_ARB_multisample */
838 case GL_MULTISAMPLE_ARB
:
839 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
840 goto invalid_enum_error
;
841 _mesa_set_multisample(ctx
, state
);
843 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
:
844 if (ctx
->Multisample
.SampleAlphaToCoverage
== state
)
846 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleAlphaToXEnable
? 0 :
848 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleAlphaToXEnable
;
849 ctx
->Multisample
.SampleAlphaToCoverage
= state
;
851 case GL_SAMPLE_ALPHA_TO_ONE_ARB
:
852 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
853 goto invalid_enum_error
;
854 if (ctx
->Multisample
.SampleAlphaToOne
== state
)
856 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleAlphaToXEnable
? 0 :
858 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleAlphaToXEnable
;
859 ctx
->Multisample
.SampleAlphaToOne
= state
;
861 case GL_SAMPLE_COVERAGE_ARB
:
862 if (ctx
->Multisample
.SampleCoverage
== state
)
864 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleMask
? 0 :
866 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleMask
;
867 ctx
->Multisample
.SampleCoverage
= state
;
869 case GL_SAMPLE_COVERAGE_INVERT_ARB
:
870 if (!_mesa_is_desktop_gl(ctx
))
871 goto invalid_enum_error
;
872 if (ctx
->Multisample
.SampleCoverageInvert
== state
)
874 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleMask
? 0 :
876 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleMask
;
877 ctx
->Multisample
.SampleCoverageInvert
= state
;
880 /* GL_ARB_sample_shading */
881 case GL_SAMPLE_SHADING
:
882 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
883 goto invalid_enum_error
;
884 CHECK_EXTENSION(ARB_sample_shading
, cap
);
885 if (ctx
->Multisample
.SampleShading
== state
)
887 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleShading
? 0 :
889 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleShading
;
890 ctx
->Multisample
.SampleShading
= state
;
893 /* GL_IBM_rasterpos_clip */
894 case GL_RASTER_POSITION_UNCLIPPED_IBM
:
895 if (ctx
->API
!= API_OPENGL_COMPAT
)
896 goto invalid_enum_error
;
897 if (ctx
->Transform
.RasterPositionUnclipped
== state
)
899 FLUSH_VERTICES(ctx
, 0);
900 ctx
->Transform
.RasterPositionUnclipped
= state
;
903 /* GL_NV_point_sprite */
904 case GL_POINT_SPRITE_NV
:
905 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
906 goto invalid_enum_error
;
907 CHECK_EXTENSION2(NV_point_sprite
, ARB_point_sprite
, cap
);
908 if (ctx
->Point
.PointSprite
== state
)
910 FLUSH_VERTICES(ctx
, _NEW_POINT
);
911 ctx
->Point
.PointSprite
= state
;
914 case GL_VERTEX_PROGRAM_ARB
:
915 if (ctx
->API
!= API_OPENGL_COMPAT
)
916 goto invalid_enum_error
;
917 CHECK_EXTENSION(ARB_vertex_program
, cap
);
918 if (ctx
->VertexProgram
.Enabled
== state
)
920 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
921 ctx
->VertexProgram
.Enabled
= state
;
923 case GL_VERTEX_PROGRAM_POINT_SIZE_ARB
:
924 /* This was added with ARB_vertex_program, but it is also used with
925 * GLSL vertex shaders on desktop.
927 if (!_mesa_is_desktop_gl(ctx
))
928 goto invalid_enum_error
;
929 CHECK_EXTENSION(ARB_vertex_program
, cap
);
930 if (ctx
->VertexProgram
.PointSizeEnabled
== state
)
932 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
933 ctx
->VertexProgram
.PointSizeEnabled
= state
;
935 case GL_VERTEX_PROGRAM_TWO_SIDE_ARB
:
936 if (ctx
->API
!= API_OPENGL_COMPAT
)
937 goto invalid_enum_error
;
938 CHECK_EXTENSION(ARB_vertex_program
, cap
);
939 if (ctx
->VertexProgram
.TwoSideEnabled
== state
)
941 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
942 ctx
->VertexProgram
.TwoSideEnabled
= state
;
945 /* GL_NV_texture_rectangle */
946 case GL_TEXTURE_RECTANGLE_NV
:
947 if (ctx
->API
!= API_OPENGL_COMPAT
)
948 goto invalid_enum_error
;
949 CHECK_EXTENSION(NV_texture_rectangle
, cap
);
950 if (!enable_texture(ctx
, state
, TEXTURE_RECT_BIT
)) {
955 /* GL_EXT_stencil_two_side */
956 case GL_STENCIL_TEST_TWO_SIDE_EXT
:
957 if (ctx
->API
!= API_OPENGL_COMPAT
)
958 goto invalid_enum_error
;
959 CHECK_EXTENSION(EXT_stencil_two_side
, cap
);
960 if (ctx
->Stencil
.TestTwoSide
== state
)
962 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewStencil
? 0 : _NEW_STENCIL
);
963 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewStencil
;
964 ctx
->Stencil
.TestTwoSide
= state
;
966 ctx
->Stencil
._BackFace
= 2;
968 ctx
->Stencil
._BackFace
= 1;
972 case GL_FRAGMENT_PROGRAM_ARB
:
973 if (ctx
->API
!= API_OPENGL_COMPAT
)
974 goto invalid_enum_error
;
975 CHECK_EXTENSION(ARB_fragment_program
, cap
);
976 if (ctx
->FragmentProgram
.Enabled
== state
)
978 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
979 ctx
->FragmentProgram
.Enabled
= state
;
982 /* GL_EXT_depth_bounds_test */
983 case GL_DEPTH_BOUNDS_TEST_EXT
:
984 if (!_mesa_is_desktop_gl(ctx
))
985 goto invalid_enum_error
;
986 CHECK_EXTENSION(EXT_depth_bounds_test
, cap
);
987 if (ctx
->Depth
.BoundsTest
== state
)
989 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewDepth
? 0 : _NEW_DEPTH
);
990 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewDepth
;
991 ctx
->Depth
.BoundsTest
= state
;
995 if (!_mesa_is_desktop_gl(ctx
))
996 goto invalid_enum_error
;
997 CHECK_EXTENSION(ARB_depth_clamp
, cap
);
998 if (ctx
->Transform
.DepthClamp
== state
)
1000 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewDepthClamp
? 0 :
1002 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewDepthClamp
;
1003 ctx
->Transform
.DepthClamp
= state
;
1006 case GL_FRAGMENT_SHADER_ATI
:
1007 if (ctx
->API
!= API_OPENGL_COMPAT
)
1008 goto invalid_enum_error
;
1009 CHECK_EXTENSION(ATI_fragment_shader
, cap
);
1010 if (ctx
->ATIFragmentShader
.Enabled
== state
)
1012 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
1013 ctx
->ATIFragmentShader
.Enabled
= state
;
1016 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1017 if (!_mesa_is_desktop_gl(ctx
))
1018 goto invalid_enum_error
;
1019 CHECK_EXTENSION(ARB_seamless_cube_map
, cap
);
1020 if (ctx
->Texture
.CubeMapSeamless
!= state
) {
1021 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
1022 ctx
->Texture
.CubeMapSeamless
= state
;
1026 case GL_RASTERIZER_DISCARD
:
1027 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
1028 goto invalid_enum_error
;
1029 CHECK_EXTENSION(EXT_transform_feedback
, cap
);
1030 if (ctx
->RasterDiscard
!= state
) {
1031 FLUSH_VERTICES(ctx
, 0);
1032 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewRasterizerDiscard
;
1033 ctx
->RasterDiscard
= state
;
1037 /* GL 3.1 primitive restart. Note: this enum is different from
1038 * GL_PRIMITIVE_RESTART_NV (which is client state).
1040 case GL_PRIMITIVE_RESTART
:
1041 if (!_mesa_is_desktop_gl(ctx
) || ctx
->Version
< 31) {
1042 goto invalid_enum_error
;
1044 if (ctx
->Array
.PrimitiveRestart
!= state
) {
1045 FLUSH_VERTICES(ctx
, 0);
1046 ctx
->Array
.PrimitiveRestart
= state
;
1047 update_derived_primitive_restart_state(ctx
);
1051 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
1052 if (!_mesa_is_gles3(ctx
) && !ctx
->Extensions
.ARB_ES3_compatibility
)
1053 goto invalid_enum_error
;
1054 if (ctx
->Array
.PrimitiveRestartFixedIndex
!= state
) {
1055 FLUSH_VERTICES(ctx
, 0);
1056 ctx
->Array
.PrimitiveRestartFixedIndex
= state
;
1057 update_derived_primitive_restart_state(ctx
);
1061 /* GL3.0 - GL_framebuffer_sRGB */
1062 case GL_FRAMEBUFFER_SRGB_EXT
:
1063 if (!_mesa_is_desktop_gl(ctx
))
1064 goto invalid_enum_error
;
1065 CHECK_EXTENSION(EXT_framebuffer_sRGB
, cap
);
1066 _mesa_set_framebuffer_srgb(ctx
, state
);
1069 /* GL_OES_EGL_image_external */
1070 case GL_TEXTURE_EXTERNAL_OES
:
1071 if (!_mesa_is_gles(ctx
))
1072 goto invalid_enum_error
;
1073 CHECK_EXTENSION(OES_EGL_image_external
, cap
);
1074 if (!enable_texture(ctx
, state
, TEXTURE_EXTERNAL_BIT
)) {
1079 /* ARB_texture_multisample */
1080 case GL_SAMPLE_MASK
:
1081 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles31(ctx
))
1082 goto invalid_enum_error
;
1083 CHECK_EXTENSION(ARB_texture_multisample
, cap
);
1084 if (ctx
->Multisample
.SampleMask
== state
)
1086 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleMask
? 0 :
1088 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleMask
;
1089 ctx
->Multisample
.SampleMask
= state
;
1092 case GL_BLEND_ADVANCED_COHERENT_KHR
:
1093 CHECK_EXTENSION(KHR_blend_equation_advanced_coherent
, cap
);
1094 if (ctx
->Color
.BlendCoherent
== state
)
1096 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewBlend
? 0 : _NEW_COLOR
);
1097 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewBlend
;
1098 ctx
->Color
.BlendCoherent
= state
;
1102 goto invalid_enum_error
;
1105 if (ctx
->Driver
.Enable
) {
1106 ctx
->Driver
.Enable( ctx
, cap
, state
);
1112 _mesa_error(ctx
, GL_INVALID_ENUM
, "gl%s(%s)",
1113 state
? "Enable" : "Disable", _mesa_enum_to_string(cap
));
1118 * Enable GL capability. Called by glEnable()
1119 * \param cap state to enable.
1122 _mesa_Enable( GLenum cap
)
1124 GET_CURRENT_CONTEXT(ctx
);
1126 _mesa_set_enable( ctx
, cap
, GL_TRUE
);
1131 * Disable GL capability. Called by glDisable()
1132 * \param cap state to disable.
1135 _mesa_Disable( GLenum cap
)
1137 GET_CURRENT_CONTEXT(ctx
);
1139 _mesa_set_enable( ctx
, cap
, GL_FALSE
);
1145 * Enable/disable an indexed state var.
1148 _mesa_set_enablei(struct gl_context
*ctx
, GLenum cap
,
1149 GLuint index
, GLboolean state
)
1151 assert(state
== 0 || state
== 1);
1154 if (!ctx
->Extensions
.EXT_draw_buffers2
) {
1155 goto invalid_enum_error
;
1157 if (index
>= ctx
->Const
.MaxDrawBuffers
) {
1158 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(index=%u)",
1159 state
? "glEnableIndexed" : "glDisableIndexed", index
);
1162 if (((ctx
->Color
.BlendEnabled
>> index
) & 1) != state
) {
1163 _mesa_flush_vertices_for_blend_state(ctx
);
1165 ctx
->Color
.BlendEnabled
|= (1 << index
);
1167 ctx
->Color
.BlendEnabled
&= ~(1 << index
);
1170 case GL_SCISSOR_TEST
:
1171 if (index
>= ctx
->Const
.MaxViewports
) {
1172 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(index=%u)",
1173 state
? "glEnablei" : "glDisablei", index
);
1176 if (((ctx
->Scissor
.EnableFlags
>> index
) & 1) != state
) {
1178 ctx
->DriverFlags
.NewScissorTest
? 0 : _NEW_SCISSOR
);
1179 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewScissorTest
;
1181 ctx
->Scissor
.EnableFlags
|= (1 << index
);
1183 ctx
->Scissor
.EnableFlags
&= ~(1 << index
);
1187 goto invalid_enum_error
;
1192 _mesa_error(ctx
, GL_INVALID_ENUM
, "%s(cap=%s)",
1193 state
? "glEnablei" : "glDisablei",
1194 _mesa_enum_to_string(cap
));
1199 _mesa_Disablei( GLenum cap
, GLuint index
)
1201 GET_CURRENT_CONTEXT(ctx
);
1202 _mesa_set_enablei(ctx
, cap
, index
, GL_FALSE
);
1207 _mesa_Enablei( GLenum cap
, GLuint index
)
1209 GET_CURRENT_CONTEXT(ctx
);
1210 _mesa_set_enablei(ctx
, cap
, index
, GL_TRUE
);
1214 GLboolean GLAPIENTRY
1215 _mesa_IsEnabledi( GLenum cap
, GLuint index
)
1217 GET_CURRENT_CONTEXT(ctx
);
1218 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
1221 if (index
>= ctx
->Const
.MaxDrawBuffers
) {
1222 _mesa_error(ctx
, GL_INVALID_VALUE
, "glIsEnabledIndexed(index=%u)",
1226 return (ctx
->Color
.BlendEnabled
>> index
) & 1;
1227 case GL_SCISSOR_TEST
:
1228 if (index
>= ctx
->Const
.MaxViewports
) {
1229 _mesa_error(ctx
, GL_INVALID_VALUE
, "glIsEnabledIndexed(index=%u)",
1233 return (ctx
->Scissor
.EnableFlags
>> index
) & 1;
1235 _mesa_error(ctx
, GL_INVALID_ENUM
, "glIsEnabledIndexed(cap=%s)",
1236 _mesa_enum_to_string(cap
));
1244 #undef CHECK_EXTENSION
1245 #define CHECK_EXTENSION(EXTNAME) \
1246 if (!ctx->Extensions.EXTNAME) { \
1247 goto invalid_enum_error; \
1250 #undef CHECK_EXTENSION2
1251 #define CHECK_EXTENSION2(EXT1, EXT2) \
1252 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
1253 goto invalid_enum_error; \
1258 * Helper function to determine whether a texture target is enabled.
1261 is_texture_enabled(struct gl_context
*ctx
, GLbitfield bit
)
1263 const struct gl_texture_unit
*const texUnit
=
1264 &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1265 return (texUnit
->Enabled
& bit
) ? GL_TRUE
: GL_FALSE
;
1270 * Return simple enable/disable state.
1272 * \param cap state variable to query.
1274 * Returns the state of the specified capability from the current GL context.
1275 * For the capabilities associated with extensions verifies that those
1276 * extensions are effectively present before reporting.
1278 GLboolean GLAPIENTRY
1279 _mesa_IsEnabled( GLenum cap
)
1281 GET_CURRENT_CONTEXT(ctx
);
1282 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
1286 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1287 goto invalid_enum_error
;
1288 return ctx
->Color
.AlphaEnabled
;
1289 case GL_AUTO_NORMAL
:
1290 if (ctx
->API
!= API_OPENGL_COMPAT
)
1291 goto invalid_enum_error
;
1292 return ctx
->Eval
.AutoNormal
;
1294 return ctx
->Color
.BlendEnabled
& 1; /* return state for buffer[0] */
1295 case GL_CLIP_DISTANCE0
: /* aka GL_CLIP_PLANE0 */
1296 case GL_CLIP_DISTANCE1
:
1297 case GL_CLIP_DISTANCE2
:
1298 case GL_CLIP_DISTANCE3
:
1299 case GL_CLIP_DISTANCE4
:
1300 case GL_CLIP_DISTANCE5
:
1301 case GL_CLIP_DISTANCE6
:
1302 case GL_CLIP_DISTANCE7
: {
1303 const GLuint p
= cap
- GL_CLIP_DISTANCE0
;
1305 if (p
>= ctx
->Const
.MaxClipPlanes
)
1306 goto invalid_enum_error
;
1308 return (ctx
->Transform
.ClipPlanesEnabled
>> p
) & 1;
1310 case GL_COLOR_MATERIAL
:
1311 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1312 goto invalid_enum_error
;
1313 return ctx
->Light
.ColorMaterialEnabled
;
1315 return ctx
->Polygon
.CullFlag
;
1316 case GL_DEBUG_OUTPUT
:
1317 case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
:
1318 return (GLboolean
) _mesa_get_debug_state_int(ctx
, cap
);
1320 return ctx
->Depth
.Test
;
1322 return ctx
->Color
.DitherFlag
;
1324 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1325 goto invalid_enum_error
;
1326 return ctx
->Fog
.Enabled
;
1328 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1329 goto invalid_enum_error
;
1330 return ctx
->Light
.Enabled
;
1339 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1340 goto invalid_enum_error
;
1341 return ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
;
1342 case GL_LINE_SMOOTH
:
1343 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1344 goto invalid_enum_error
;
1345 return ctx
->Line
.SmoothFlag
;
1346 case GL_LINE_STIPPLE
:
1347 if (ctx
->API
!= API_OPENGL_COMPAT
)
1348 goto invalid_enum_error
;
1349 return ctx
->Line
.StippleFlag
;
1350 case GL_INDEX_LOGIC_OP
:
1351 if (ctx
->API
!= API_OPENGL_COMPAT
)
1352 goto invalid_enum_error
;
1353 return ctx
->Color
.IndexLogicOpEnabled
;
1354 case GL_COLOR_LOGIC_OP
:
1355 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1356 goto invalid_enum_error
;
1357 return ctx
->Color
.ColorLogicOpEnabled
;
1358 case GL_MAP1_COLOR_4
:
1359 if (ctx
->API
!= API_OPENGL_COMPAT
)
1360 goto invalid_enum_error
;
1361 return ctx
->Eval
.Map1Color4
;
1363 if (ctx
->API
!= API_OPENGL_COMPAT
)
1364 goto invalid_enum_error
;
1365 return ctx
->Eval
.Map1Index
;
1366 case GL_MAP1_NORMAL
:
1367 if (ctx
->API
!= API_OPENGL_COMPAT
)
1368 goto invalid_enum_error
;
1369 return ctx
->Eval
.Map1Normal
;
1370 case GL_MAP1_TEXTURE_COORD_1
:
1371 if (ctx
->API
!= API_OPENGL_COMPAT
)
1372 goto invalid_enum_error
;
1373 return ctx
->Eval
.Map1TextureCoord1
;
1374 case GL_MAP1_TEXTURE_COORD_2
:
1375 if (ctx
->API
!= API_OPENGL_COMPAT
)
1376 goto invalid_enum_error
;
1377 return ctx
->Eval
.Map1TextureCoord2
;
1378 case GL_MAP1_TEXTURE_COORD_3
:
1379 if (ctx
->API
!= API_OPENGL_COMPAT
)
1380 goto invalid_enum_error
;
1381 return ctx
->Eval
.Map1TextureCoord3
;
1382 case GL_MAP1_TEXTURE_COORD_4
:
1383 if (ctx
->API
!= API_OPENGL_COMPAT
)
1384 goto invalid_enum_error
;
1385 return ctx
->Eval
.Map1TextureCoord4
;
1386 case GL_MAP1_VERTEX_3
:
1387 if (ctx
->API
!= API_OPENGL_COMPAT
)
1388 goto invalid_enum_error
;
1389 return ctx
->Eval
.Map1Vertex3
;
1390 case GL_MAP1_VERTEX_4
:
1391 if (ctx
->API
!= API_OPENGL_COMPAT
)
1392 goto invalid_enum_error
;
1393 return ctx
->Eval
.Map1Vertex4
;
1394 case GL_MAP2_COLOR_4
:
1395 if (ctx
->API
!= API_OPENGL_COMPAT
)
1396 goto invalid_enum_error
;
1397 return ctx
->Eval
.Map2Color4
;
1399 if (ctx
->API
!= API_OPENGL_COMPAT
)
1400 goto invalid_enum_error
;
1401 return ctx
->Eval
.Map2Index
;
1402 case GL_MAP2_NORMAL
:
1403 if (ctx
->API
!= API_OPENGL_COMPAT
)
1404 goto invalid_enum_error
;
1405 return ctx
->Eval
.Map2Normal
;
1406 case GL_MAP2_TEXTURE_COORD_1
:
1407 if (ctx
->API
!= API_OPENGL_COMPAT
)
1408 goto invalid_enum_error
;
1409 return ctx
->Eval
.Map2TextureCoord1
;
1410 case GL_MAP2_TEXTURE_COORD_2
:
1411 if (ctx
->API
!= API_OPENGL_COMPAT
)
1412 goto invalid_enum_error
;
1413 return ctx
->Eval
.Map2TextureCoord2
;
1414 case GL_MAP2_TEXTURE_COORD_3
:
1415 if (ctx
->API
!= API_OPENGL_COMPAT
)
1416 goto invalid_enum_error
;
1417 return ctx
->Eval
.Map2TextureCoord3
;
1418 case GL_MAP2_TEXTURE_COORD_4
:
1419 if (ctx
->API
!= API_OPENGL_COMPAT
)
1420 goto invalid_enum_error
;
1421 return ctx
->Eval
.Map2TextureCoord4
;
1422 case GL_MAP2_VERTEX_3
:
1423 if (ctx
->API
!= API_OPENGL_COMPAT
)
1424 goto invalid_enum_error
;
1425 return ctx
->Eval
.Map2Vertex3
;
1426 case GL_MAP2_VERTEX_4
:
1427 if (ctx
->API
!= API_OPENGL_COMPAT
)
1428 goto invalid_enum_error
;
1429 return ctx
->Eval
.Map2Vertex4
;
1431 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1432 goto invalid_enum_error
;
1433 return ctx
->Transform
.Normalize
;
1434 case GL_POINT_SMOOTH
:
1435 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1436 goto invalid_enum_error
;
1437 return ctx
->Point
.SmoothFlag
;
1438 case GL_POLYGON_SMOOTH
:
1439 if (!_mesa_is_desktop_gl(ctx
))
1440 goto invalid_enum_error
;
1441 return ctx
->Polygon
.SmoothFlag
;
1442 case GL_POLYGON_STIPPLE
:
1443 if (ctx
->API
!= API_OPENGL_COMPAT
)
1444 goto invalid_enum_error
;
1445 return ctx
->Polygon
.StippleFlag
;
1446 case GL_POLYGON_OFFSET_POINT
:
1447 if (!_mesa_is_desktop_gl(ctx
))
1448 goto invalid_enum_error
;
1449 return ctx
->Polygon
.OffsetPoint
;
1450 case GL_POLYGON_OFFSET_LINE
:
1451 if (!_mesa_is_desktop_gl(ctx
))
1452 goto invalid_enum_error
;
1453 return ctx
->Polygon
.OffsetLine
;
1454 case GL_POLYGON_OFFSET_FILL
:
1455 return ctx
->Polygon
.OffsetFill
;
1456 case GL_RESCALE_NORMAL_EXT
:
1457 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1458 goto invalid_enum_error
;
1459 return ctx
->Transform
.RescaleNormals
;
1460 case GL_SCISSOR_TEST
:
1461 return ctx
->Scissor
.EnableFlags
& 1; /* return state for index 0 */
1462 case GL_STENCIL_TEST
:
1463 return ctx
->Stencil
.Enabled
;
1465 if (ctx
->API
!= API_OPENGL_COMPAT
)
1466 goto invalid_enum_error
;
1467 return is_texture_enabled(ctx
, TEXTURE_1D_BIT
);
1469 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1470 goto invalid_enum_error
;
1471 return is_texture_enabled(ctx
, TEXTURE_2D_BIT
);
1473 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1474 goto invalid_enum_error
;
1475 return is_texture_enabled(ctx
, TEXTURE_3D_BIT
);
1476 case GL_TEXTURE_GEN_S
:
1477 case GL_TEXTURE_GEN_T
:
1478 case GL_TEXTURE_GEN_R
:
1479 case GL_TEXTURE_GEN_Q
:
1481 const struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
1483 if (ctx
->API
!= API_OPENGL_COMPAT
)
1484 goto invalid_enum_error
;
1487 GLbitfield coordBit
= S_BIT
<< (cap
- GL_TEXTURE_GEN_S
);
1488 return (texUnit
->TexGenEnabled
& coordBit
) ? GL_TRUE
: GL_FALSE
;
1492 case GL_TEXTURE_GEN_STR_OES
:
1494 const struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
1496 if (ctx
->API
!= API_OPENGLES
)
1497 goto invalid_enum_error
;
1500 return (texUnit
->TexGenEnabled
& STR_BITS
) == STR_BITS
1501 ? GL_TRUE
: GL_FALSE
;
1505 /* client-side state */
1506 case GL_VERTEX_ARRAY
:
1507 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1508 goto invalid_enum_error
;
1509 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_POS
].Enabled
;
1510 case GL_NORMAL_ARRAY
:
1511 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1512 goto invalid_enum_error
;
1513 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_NORMAL
].Enabled
;
1514 case GL_COLOR_ARRAY
:
1515 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1516 goto invalid_enum_error
;
1517 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_COLOR0
].Enabled
;
1518 case GL_INDEX_ARRAY
:
1519 if (ctx
->API
!= API_OPENGL_COMPAT
)
1520 goto invalid_enum_error
;
1521 return ctx
->Array
.VAO
->
1522 VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].Enabled
;
1523 case GL_TEXTURE_COORD_ARRAY
:
1524 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1525 goto invalid_enum_error
;
1526 return ctx
->Array
.VAO
->
1527 VertexAttrib
[VERT_ATTRIB_TEX(ctx
->Array
.ActiveTexture
)].Enabled
;
1528 case GL_EDGE_FLAG_ARRAY
:
1529 if (ctx
->API
!= API_OPENGL_COMPAT
)
1530 goto invalid_enum_error
;
1531 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_EDGEFLAG
].Enabled
;
1532 case GL_FOG_COORDINATE_ARRAY_EXT
:
1533 if (ctx
->API
!= API_OPENGL_COMPAT
)
1534 goto invalid_enum_error
;
1535 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_FOG
].Enabled
;
1536 case GL_SECONDARY_COLOR_ARRAY_EXT
:
1537 if (ctx
->API
!= API_OPENGL_COMPAT
)
1538 goto invalid_enum_error
;
1539 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_COLOR1
].Enabled
;
1540 case GL_POINT_SIZE_ARRAY_OES
:
1541 if (ctx
->API
!= API_OPENGLES
)
1542 goto invalid_enum_error
;
1543 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_POINT_SIZE
].Enabled
;
1545 /* GL_ARB_texture_cube_map */
1546 case GL_TEXTURE_CUBE_MAP
:
1547 CHECK_EXTENSION(ARB_texture_cube_map
);
1548 return is_texture_enabled(ctx
, TEXTURE_CUBE_BIT
);
1550 /* GL_EXT_secondary_color */
1551 case GL_COLOR_SUM_EXT
:
1552 if (ctx
->API
!= API_OPENGL_COMPAT
)
1553 goto invalid_enum_error
;
1554 return ctx
->Fog
.ColorSumEnabled
;
1556 /* GL_ARB_multisample */
1557 case GL_MULTISAMPLE_ARB
:
1558 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1559 goto invalid_enum_error
;
1560 return ctx
->Multisample
.Enabled
;
1561 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
:
1562 return ctx
->Multisample
.SampleAlphaToCoverage
;
1563 case GL_SAMPLE_ALPHA_TO_ONE_ARB
:
1564 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1565 goto invalid_enum_error
;
1566 return ctx
->Multisample
.SampleAlphaToOne
;
1567 case GL_SAMPLE_COVERAGE_ARB
:
1568 return ctx
->Multisample
.SampleCoverage
;
1569 case GL_SAMPLE_COVERAGE_INVERT_ARB
:
1570 if (!_mesa_is_desktop_gl(ctx
))
1571 goto invalid_enum_error
;
1572 return ctx
->Multisample
.SampleCoverageInvert
;
1574 /* GL_IBM_rasterpos_clip */
1575 case GL_RASTER_POSITION_UNCLIPPED_IBM
:
1576 if (ctx
->API
!= API_OPENGL_COMPAT
)
1577 goto invalid_enum_error
;
1578 return ctx
->Transform
.RasterPositionUnclipped
;
1580 /* GL_NV_point_sprite */
1581 case GL_POINT_SPRITE_NV
:
1582 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1583 goto invalid_enum_error
;
1584 CHECK_EXTENSION2(NV_point_sprite
, ARB_point_sprite
)
1585 return ctx
->Point
.PointSprite
;
1587 case GL_VERTEX_PROGRAM_ARB
:
1588 if (ctx
->API
!= API_OPENGL_COMPAT
)
1589 goto invalid_enum_error
;
1590 CHECK_EXTENSION(ARB_vertex_program
);
1591 return ctx
->VertexProgram
.Enabled
;
1592 case GL_VERTEX_PROGRAM_POINT_SIZE_ARB
:
1593 /* This was added with ARB_vertex_program, but it is also used with
1594 * GLSL vertex shaders on desktop.
1596 if (!_mesa_is_desktop_gl(ctx
))
1597 goto invalid_enum_error
;
1598 CHECK_EXTENSION(ARB_vertex_program
);
1599 return ctx
->VertexProgram
.PointSizeEnabled
;
1600 case GL_VERTEX_PROGRAM_TWO_SIDE_ARB
:
1601 if (ctx
->API
!= API_OPENGL_COMPAT
)
1602 goto invalid_enum_error
;
1603 CHECK_EXTENSION(ARB_vertex_program
);
1604 return ctx
->VertexProgram
.TwoSideEnabled
;
1606 /* GL_NV_texture_rectangle */
1607 case GL_TEXTURE_RECTANGLE_NV
:
1608 if (ctx
->API
!= API_OPENGL_COMPAT
)
1609 goto invalid_enum_error
;
1610 CHECK_EXTENSION(NV_texture_rectangle
);
1611 return is_texture_enabled(ctx
, TEXTURE_RECT_BIT
);
1613 /* GL_EXT_stencil_two_side */
1614 case GL_STENCIL_TEST_TWO_SIDE_EXT
:
1615 if (ctx
->API
!= API_OPENGL_COMPAT
)
1616 goto invalid_enum_error
;
1617 CHECK_EXTENSION(EXT_stencil_two_side
);
1618 return ctx
->Stencil
.TestTwoSide
;
1620 case GL_FRAGMENT_PROGRAM_ARB
:
1621 if (ctx
->API
!= API_OPENGL_COMPAT
)
1622 goto invalid_enum_error
;
1623 return ctx
->FragmentProgram
.Enabled
;
1625 /* GL_EXT_depth_bounds_test */
1626 case GL_DEPTH_BOUNDS_TEST_EXT
:
1627 if (!_mesa_is_desktop_gl(ctx
))
1628 goto invalid_enum_error
;
1629 CHECK_EXTENSION(EXT_depth_bounds_test
);
1630 return ctx
->Depth
.BoundsTest
;
1632 /* GL_ARB_depth_clamp */
1633 case GL_DEPTH_CLAMP
:
1634 if (!_mesa_is_desktop_gl(ctx
))
1635 goto invalid_enum_error
;
1636 CHECK_EXTENSION(ARB_depth_clamp
);
1637 return ctx
->Transform
.DepthClamp
;
1639 case GL_FRAGMENT_SHADER_ATI
:
1640 if (ctx
->API
!= API_OPENGL_COMPAT
)
1641 goto invalid_enum_error
;
1642 CHECK_EXTENSION(ATI_fragment_shader
);
1643 return ctx
->ATIFragmentShader
.Enabled
;
1645 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1646 if (!_mesa_is_desktop_gl(ctx
))
1647 goto invalid_enum_error
;
1648 CHECK_EXTENSION(ARB_seamless_cube_map
);
1649 return ctx
->Texture
.CubeMapSeamless
;
1651 case GL_RASTERIZER_DISCARD
:
1652 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
1653 goto invalid_enum_error
;
1654 CHECK_EXTENSION(EXT_transform_feedback
);
1655 return ctx
->RasterDiscard
;
1657 /* GL_NV_primitive_restart */
1658 case GL_PRIMITIVE_RESTART_NV
:
1659 if (ctx
->API
!= API_OPENGL_COMPAT
|| !ctx
->Extensions
.NV_primitive_restart
) {
1660 goto invalid_enum_error
;
1662 return ctx
->Array
.PrimitiveRestart
;
1664 /* GL 3.1 primitive restart */
1665 case GL_PRIMITIVE_RESTART
:
1666 if (!_mesa_is_desktop_gl(ctx
) || ctx
->Version
< 31) {
1667 goto invalid_enum_error
;
1669 return ctx
->Array
.PrimitiveRestart
;
1671 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
1672 if (!_mesa_is_gles3(ctx
) && !ctx
->Extensions
.ARB_ES3_compatibility
) {
1673 goto invalid_enum_error
;
1675 return ctx
->Array
.PrimitiveRestartFixedIndex
;
1677 /* GL3.0 - GL_framebuffer_sRGB */
1678 case GL_FRAMEBUFFER_SRGB_EXT
:
1679 if (!_mesa_is_desktop_gl(ctx
))
1680 goto invalid_enum_error
;
1681 CHECK_EXTENSION(EXT_framebuffer_sRGB
);
1682 return ctx
->Color
.sRGBEnabled
;
1684 /* GL_OES_EGL_image_external */
1685 case GL_TEXTURE_EXTERNAL_OES
:
1686 if (!_mesa_is_gles(ctx
))
1687 goto invalid_enum_error
;
1688 CHECK_EXTENSION(OES_EGL_image_external
);
1689 return is_texture_enabled(ctx
, TEXTURE_EXTERNAL_BIT
);
1691 /* ARB_texture_multisample */
1692 case GL_SAMPLE_MASK
:
1693 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles31(ctx
))
1694 goto invalid_enum_error
;
1695 CHECK_EXTENSION(ARB_texture_multisample
);
1696 return ctx
->Multisample
.SampleMask
;
1698 /* ARB_sample_shading */
1699 case GL_SAMPLE_SHADING
:
1700 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
1701 goto invalid_enum_error
;
1702 CHECK_EXTENSION(ARB_sample_shading
);
1703 return ctx
->Multisample
.SampleShading
;
1705 case GL_BLEND_ADVANCED_COHERENT_KHR
:
1706 CHECK_EXTENSION(KHR_blend_equation_advanced_coherent
);
1707 return ctx
->Color
.BlendCoherent
;
1709 case GL_CONSERVATIVE_RASTERIZATION_INTEL
:
1710 CHECK_EXTENSION(INTEL_conservative_rasterization
);
1711 return ctx
->IntelConservativeRasterization
;
1714 goto invalid_enum_error
;
1720 _mesa_error(ctx
, GL_INVALID_ENUM
, "glIsEnabled(%s)",
1721 _mesa_enum_to_string(cap
));