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 _mesa_update_clip_plane(ctx
, p
);
365 ctx
->Transform
.ClipPlanesEnabled
&= ~(1 << p
);
369 case GL_COLOR_MATERIAL
:
370 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
371 goto invalid_enum_error
;
372 if (ctx
->Light
.ColorMaterialEnabled
== state
)
374 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
375 FLUSH_CURRENT(ctx
, 0);
376 ctx
->Light
.ColorMaterialEnabled
= state
;
378 _mesa_update_color_material( ctx
,
379 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
] );
383 if (ctx
->Polygon
.CullFlag
== state
)
386 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
387 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
388 ctx
->Polygon
.CullFlag
= state
;
391 if (ctx
->Depth
.Test
== state
)
393 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewDepth
? 0 : _NEW_DEPTH
);
394 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewDepth
;
395 ctx
->Depth
.Test
= state
;
397 case GL_DEBUG_OUTPUT
:
398 case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
:
399 _mesa_set_debug_state_int(ctx
, cap
, state
);
402 if (ctx
->Color
.DitherFlag
== state
)
404 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewBlend
? 0 : _NEW_COLOR
);
405 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewBlend
;
406 ctx
->Color
.DitherFlag
= state
;
409 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
410 goto invalid_enum_error
;
411 if (ctx
->Fog
.Enabled
== state
)
413 FLUSH_VERTICES(ctx
, _NEW_FOG
);
414 ctx
->Fog
.Enabled
= state
;
415 ctx
->Fog
._PackedEnabledMode
= state
? ctx
->Fog
._PackedMode
: FOG_NONE
;
425 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
426 goto invalid_enum_error
;
427 if (ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
== state
)
429 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
430 ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
= state
;
432 ctx
->Light
._EnabledLights
|= 1u << (cap
- GL_LIGHT0
);
435 ctx
->Light
._EnabledLights
&= ~(1u << (cap
- GL_LIGHT0
));
439 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
440 goto invalid_enum_error
;
441 if (ctx
->Light
.Enabled
== state
)
443 FLUSH_VERTICES(ctx
, _NEW_LIGHT
);
444 ctx
->Light
.Enabled
= state
;
447 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
448 goto invalid_enum_error
;
449 if (ctx
->Line
.SmoothFlag
== state
)
451 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLineState
? 0 : _NEW_LINE
);
452 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLineState
;
453 ctx
->Line
.SmoothFlag
= state
;
455 case GL_LINE_STIPPLE
:
456 if (ctx
->API
!= API_OPENGL_COMPAT
)
457 goto invalid_enum_error
;
458 if (ctx
->Line
.StippleFlag
== state
)
460 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLineState
? 0 : _NEW_LINE
);
461 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLineState
;
462 ctx
->Line
.StippleFlag
= state
;
464 case GL_INDEX_LOGIC_OP
:
465 if (ctx
->API
!= API_OPENGL_COMPAT
)
466 goto invalid_enum_error
;
467 if (ctx
->Color
.IndexLogicOpEnabled
== state
)
469 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLogicOp
? 0 : _NEW_COLOR
);
470 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLogicOp
;
471 ctx
->Color
.IndexLogicOpEnabled
= state
;
473 case GL_CONSERVATIVE_RASTERIZATION_INTEL
:
474 if (!_mesa_has_INTEL_conservative_rasterization(ctx
))
475 goto invalid_enum_error
;
476 if (ctx
->IntelConservativeRasterization
== state
)
478 FLUSH_VERTICES(ctx
, 0);
479 ctx
->NewDriverState
|=
480 ctx
->DriverFlags
.NewIntelConservativeRasterization
;
481 ctx
->IntelConservativeRasterization
= state
;
483 case GL_COLOR_LOGIC_OP
:
484 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
485 goto invalid_enum_error
;
486 if (ctx
->Color
.ColorLogicOpEnabled
== state
)
488 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewLogicOp
? 0 : _NEW_COLOR
);
489 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewLogicOp
;
490 ctx
->Color
.ColorLogicOpEnabled
= state
;
492 case GL_MAP1_COLOR_4
:
493 if (ctx
->API
!= API_OPENGL_COMPAT
)
494 goto invalid_enum_error
;
495 if (ctx
->Eval
.Map1Color4
== state
)
497 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
498 ctx
->Eval
.Map1Color4
= state
;
501 if (ctx
->API
!= API_OPENGL_COMPAT
)
502 goto invalid_enum_error
;
503 if (ctx
->Eval
.Map1Index
== state
)
505 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
506 ctx
->Eval
.Map1Index
= state
;
509 if (ctx
->API
!= API_OPENGL_COMPAT
)
510 goto invalid_enum_error
;
511 if (ctx
->Eval
.Map1Normal
== state
)
513 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
514 ctx
->Eval
.Map1Normal
= state
;
516 case GL_MAP1_TEXTURE_COORD_1
:
517 if (ctx
->API
!= API_OPENGL_COMPAT
)
518 goto invalid_enum_error
;
519 if (ctx
->Eval
.Map1TextureCoord1
== state
)
521 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
522 ctx
->Eval
.Map1TextureCoord1
= state
;
524 case GL_MAP1_TEXTURE_COORD_2
:
525 if (ctx
->API
!= API_OPENGL_COMPAT
)
526 goto invalid_enum_error
;
527 if (ctx
->Eval
.Map1TextureCoord2
== state
)
529 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
530 ctx
->Eval
.Map1TextureCoord2
= state
;
532 case GL_MAP1_TEXTURE_COORD_3
:
533 if (ctx
->API
!= API_OPENGL_COMPAT
)
534 goto invalid_enum_error
;
535 if (ctx
->Eval
.Map1TextureCoord3
== state
)
537 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
538 ctx
->Eval
.Map1TextureCoord3
= state
;
540 case GL_MAP1_TEXTURE_COORD_4
:
541 if (ctx
->API
!= API_OPENGL_COMPAT
)
542 goto invalid_enum_error
;
543 if (ctx
->Eval
.Map1TextureCoord4
== state
)
545 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
546 ctx
->Eval
.Map1TextureCoord4
= state
;
548 case GL_MAP1_VERTEX_3
:
549 if (ctx
->API
!= API_OPENGL_COMPAT
)
550 goto invalid_enum_error
;
551 if (ctx
->Eval
.Map1Vertex3
== state
)
553 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
554 ctx
->Eval
.Map1Vertex3
= state
;
556 case GL_MAP1_VERTEX_4
:
557 if (ctx
->API
!= API_OPENGL_COMPAT
)
558 goto invalid_enum_error
;
559 if (ctx
->Eval
.Map1Vertex4
== state
)
561 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
562 ctx
->Eval
.Map1Vertex4
= state
;
564 case GL_MAP2_COLOR_4
:
565 if (ctx
->API
!= API_OPENGL_COMPAT
)
566 goto invalid_enum_error
;
567 if (ctx
->Eval
.Map2Color4
== state
)
569 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
570 ctx
->Eval
.Map2Color4
= state
;
573 if (ctx
->API
!= API_OPENGL_COMPAT
)
574 goto invalid_enum_error
;
575 if (ctx
->Eval
.Map2Index
== state
)
577 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
578 ctx
->Eval
.Map2Index
= state
;
581 if (ctx
->API
!= API_OPENGL_COMPAT
)
582 goto invalid_enum_error
;
583 if (ctx
->Eval
.Map2Normal
== state
)
585 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
586 ctx
->Eval
.Map2Normal
= state
;
588 case GL_MAP2_TEXTURE_COORD_1
:
589 if (ctx
->API
!= API_OPENGL_COMPAT
)
590 goto invalid_enum_error
;
591 if (ctx
->Eval
.Map2TextureCoord1
== state
)
593 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
594 ctx
->Eval
.Map2TextureCoord1
= state
;
596 case GL_MAP2_TEXTURE_COORD_2
:
597 if (ctx
->API
!= API_OPENGL_COMPAT
)
598 goto invalid_enum_error
;
599 if (ctx
->Eval
.Map2TextureCoord2
== state
)
601 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
602 ctx
->Eval
.Map2TextureCoord2
= state
;
604 case GL_MAP2_TEXTURE_COORD_3
:
605 if (ctx
->API
!= API_OPENGL_COMPAT
)
606 goto invalid_enum_error
;
607 if (ctx
->Eval
.Map2TextureCoord3
== state
)
609 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
610 ctx
->Eval
.Map2TextureCoord3
= state
;
612 case GL_MAP2_TEXTURE_COORD_4
:
613 if (ctx
->API
!= API_OPENGL_COMPAT
)
614 goto invalid_enum_error
;
615 if (ctx
->Eval
.Map2TextureCoord4
== state
)
617 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
618 ctx
->Eval
.Map2TextureCoord4
= state
;
620 case GL_MAP2_VERTEX_3
:
621 if (ctx
->API
!= API_OPENGL_COMPAT
)
622 goto invalid_enum_error
;
623 if (ctx
->Eval
.Map2Vertex3
== state
)
625 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
626 ctx
->Eval
.Map2Vertex3
= state
;
628 case GL_MAP2_VERTEX_4
:
629 if (ctx
->API
!= API_OPENGL_COMPAT
)
630 goto invalid_enum_error
;
631 if (ctx
->Eval
.Map2Vertex4
== state
)
633 FLUSH_VERTICES(ctx
, _NEW_EVAL
);
634 ctx
->Eval
.Map2Vertex4
= state
;
637 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
638 goto invalid_enum_error
;
639 if (ctx
->Transform
.Normalize
== state
)
641 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
642 ctx
->Transform
.Normalize
= state
;
644 case GL_POINT_SMOOTH
:
645 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
646 goto invalid_enum_error
;
647 if (ctx
->Point
.SmoothFlag
== state
)
649 FLUSH_VERTICES(ctx
, _NEW_POINT
);
650 ctx
->Point
.SmoothFlag
= state
;
652 case GL_POLYGON_SMOOTH
:
653 if (!_mesa_is_desktop_gl(ctx
))
654 goto invalid_enum_error
;
655 if (ctx
->Polygon
.SmoothFlag
== state
)
658 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
659 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
660 ctx
->Polygon
.SmoothFlag
= state
;
662 case GL_POLYGON_STIPPLE
:
663 if (ctx
->API
!= API_OPENGL_COMPAT
)
664 goto invalid_enum_error
;
665 if (ctx
->Polygon
.StippleFlag
== state
)
668 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
669 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
670 ctx
->Polygon
.StippleFlag
= state
;
672 case GL_POLYGON_OFFSET_POINT
:
673 if (!_mesa_is_desktop_gl(ctx
))
674 goto invalid_enum_error
;
675 if (ctx
->Polygon
.OffsetPoint
== state
)
678 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
679 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
680 ctx
->Polygon
.OffsetPoint
= state
;
682 case GL_POLYGON_OFFSET_LINE
:
683 if (!_mesa_is_desktop_gl(ctx
))
684 goto invalid_enum_error
;
685 if (ctx
->Polygon
.OffsetLine
== state
)
688 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
689 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
690 ctx
->Polygon
.OffsetLine
= state
;
692 case GL_POLYGON_OFFSET_FILL
:
693 if (ctx
->Polygon
.OffsetFill
== state
)
696 ctx
->DriverFlags
.NewPolygonState
? 0 : _NEW_POLYGON
);
697 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewPolygonState
;
698 ctx
->Polygon
.OffsetFill
= state
;
700 case GL_RESCALE_NORMAL_EXT
:
701 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
702 goto invalid_enum_error
;
703 if (ctx
->Transform
.RescaleNormals
== state
)
705 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
706 ctx
->Transform
.RescaleNormals
= state
;
708 case GL_SCISSOR_TEST
:
710 /* Must expand glEnable to all scissors */
711 GLbitfield newEnabled
=
712 state
* ((1 << ctx
->Const
.MaxViewports
) - 1);
713 if (newEnabled
!= ctx
->Scissor
.EnableFlags
) {
714 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewScissorTest
? 0 :
716 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewScissorTest
;
717 ctx
->Scissor
.EnableFlags
= newEnabled
;
721 case GL_STENCIL_TEST
:
722 if (ctx
->Stencil
.Enabled
== state
)
724 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewStencil
? 0 : _NEW_STENCIL
);
725 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewStencil
;
726 ctx
->Stencil
.Enabled
= state
;
729 if (ctx
->API
!= API_OPENGL_COMPAT
)
730 goto invalid_enum_error
;
731 if (!enable_texture(ctx
, state
, TEXTURE_1D_BIT
)) {
736 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
737 goto invalid_enum_error
;
738 if (!enable_texture(ctx
, state
, TEXTURE_2D_BIT
)) {
743 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
744 goto invalid_enum_error
;
745 if (!enable_texture(ctx
, state
, TEXTURE_3D_BIT
)) {
749 case GL_TEXTURE_GEN_S
:
750 case GL_TEXTURE_GEN_T
:
751 case GL_TEXTURE_GEN_R
:
752 case GL_TEXTURE_GEN_Q
:
754 struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
756 if (ctx
->API
!= API_OPENGL_COMPAT
)
757 goto invalid_enum_error
;
760 GLbitfield coordBit
= S_BIT
<< (cap
- GL_TEXTURE_GEN_S
);
761 GLbitfield newenabled
= texUnit
->TexGenEnabled
& ~coordBit
;
763 newenabled
|= coordBit
;
764 if (texUnit
->TexGenEnabled
== newenabled
)
766 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
767 texUnit
->TexGenEnabled
= newenabled
;
772 case GL_TEXTURE_GEN_STR_OES
:
773 /* disable S, T, and R at the same time */
775 struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
777 if (ctx
->API
!= API_OPENGLES
)
778 goto invalid_enum_error
;
782 texUnit
->TexGenEnabled
& ~STR_BITS
;
784 newenabled
|= STR_BITS
;
785 if (texUnit
->TexGenEnabled
== newenabled
)
787 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
788 texUnit
->TexGenEnabled
= newenabled
;
793 /* client-side state */
794 case GL_VERTEX_ARRAY
:
795 case GL_NORMAL_ARRAY
:
797 case GL_TEXTURE_COORD_ARRAY
:
798 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
799 goto invalid_enum_error
;
800 client_state( ctx
, cap
, state
);
803 case GL_EDGE_FLAG_ARRAY
:
804 case GL_FOG_COORDINATE_ARRAY_EXT
:
805 case GL_SECONDARY_COLOR_ARRAY_EXT
:
806 if (ctx
->API
!= API_OPENGL_COMPAT
)
807 goto invalid_enum_error
;
808 client_state( ctx
, cap
, state
);
810 case GL_POINT_SIZE_ARRAY_OES
:
811 if (ctx
->API
!= API_OPENGLES
)
812 goto invalid_enum_error
;
813 client_state( ctx
, cap
, state
);
816 /* GL_ARB_texture_cube_map */
817 case GL_TEXTURE_CUBE_MAP
:
818 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
819 goto invalid_enum_error
;
820 CHECK_EXTENSION(ARB_texture_cube_map
, cap
);
821 if (!enable_texture(ctx
, state
, TEXTURE_CUBE_BIT
)) {
826 /* GL_EXT_secondary_color */
827 case GL_COLOR_SUM_EXT
:
828 if (ctx
->API
!= API_OPENGL_COMPAT
)
829 goto invalid_enum_error
;
830 if (ctx
->Fog
.ColorSumEnabled
== state
)
832 FLUSH_VERTICES(ctx
, _NEW_FOG
);
833 ctx
->Fog
.ColorSumEnabled
= state
;
836 /* GL_ARB_multisample */
837 case GL_MULTISAMPLE_ARB
:
838 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
839 goto invalid_enum_error
;
840 _mesa_set_multisample(ctx
, state
);
842 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
:
843 if (ctx
->Multisample
.SampleAlphaToCoverage
== state
)
845 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleAlphaToXEnable
? 0 :
847 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleAlphaToXEnable
;
848 ctx
->Multisample
.SampleAlphaToCoverage
= state
;
850 case GL_SAMPLE_ALPHA_TO_ONE_ARB
:
851 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
852 goto invalid_enum_error
;
853 if (ctx
->Multisample
.SampleAlphaToOne
== state
)
855 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleAlphaToXEnable
? 0 :
857 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleAlphaToXEnable
;
858 ctx
->Multisample
.SampleAlphaToOne
= state
;
860 case GL_SAMPLE_COVERAGE_ARB
:
861 if (ctx
->Multisample
.SampleCoverage
== state
)
863 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleMask
? 0 :
865 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleMask
;
866 ctx
->Multisample
.SampleCoverage
= state
;
868 case GL_SAMPLE_COVERAGE_INVERT_ARB
:
869 if (!_mesa_is_desktop_gl(ctx
))
870 goto invalid_enum_error
;
871 if (ctx
->Multisample
.SampleCoverageInvert
== state
)
873 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleMask
? 0 :
875 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleMask
;
876 ctx
->Multisample
.SampleCoverageInvert
= state
;
879 /* GL_ARB_sample_shading */
880 case GL_SAMPLE_SHADING
:
881 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
882 goto invalid_enum_error
;
883 CHECK_EXTENSION(ARB_sample_shading
, cap
);
884 if (ctx
->Multisample
.SampleShading
== state
)
886 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleShading
? 0 :
888 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleShading
;
889 ctx
->Multisample
.SampleShading
= state
;
892 /* GL_IBM_rasterpos_clip */
893 case GL_RASTER_POSITION_UNCLIPPED_IBM
:
894 if (ctx
->API
!= API_OPENGL_COMPAT
)
895 goto invalid_enum_error
;
896 if (ctx
->Transform
.RasterPositionUnclipped
== state
)
898 FLUSH_VERTICES(ctx
, 0);
899 ctx
->Transform
.RasterPositionUnclipped
= state
;
902 /* GL_NV_point_sprite */
903 case GL_POINT_SPRITE_NV
:
904 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
905 goto invalid_enum_error
;
906 CHECK_EXTENSION2(NV_point_sprite
, ARB_point_sprite
, cap
);
907 if (ctx
->Point
.PointSprite
== state
)
909 FLUSH_VERTICES(ctx
, _NEW_POINT
);
910 ctx
->Point
.PointSprite
= state
;
913 case GL_VERTEX_PROGRAM_ARB
:
914 if (ctx
->API
!= API_OPENGL_COMPAT
)
915 goto invalid_enum_error
;
916 CHECK_EXTENSION(ARB_vertex_program
, cap
);
917 if (ctx
->VertexProgram
.Enabled
== state
)
919 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
920 ctx
->VertexProgram
.Enabled
= state
;
922 case GL_VERTEX_PROGRAM_POINT_SIZE_ARB
:
923 /* This was added with ARB_vertex_program, but it is also used with
924 * GLSL vertex shaders on desktop.
926 if (!_mesa_is_desktop_gl(ctx
))
927 goto invalid_enum_error
;
928 CHECK_EXTENSION(ARB_vertex_program
, cap
);
929 if (ctx
->VertexProgram
.PointSizeEnabled
== state
)
931 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
932 ctx
->VertexProgram
.PointSizeEnabled
= state
;
934 case GL_VERTEX_PROGRAM_TWO_SIDE_ARB
:
935 if (ctx
->API
!= API_OPENGL_COMPAT
)
936 goto invalid_enum_error
;
937 CHECK_EXTENSION(ARB_vertex_program
, cap
);
938 if (ctx
->VertexProgram
.TwoSideEnabled
== state
)
940 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
941 ctx
->VertexProgram
.TwoSideEnabled
= state
;
944 /* GL_NV_texture_rectangle */
945 case GL_TEXTURE_RECTANGLE_NV
:
946 if (ctx
->API
!= API_OPENGL_COMPAT
)
947 goto invalid_enum_error
;
948 CHECK_EXTENSION(NV_texture_rectangle
, cap
);
949 if (!enable_texture(ctx
, state
, TEXTURE_RECT_BIT
)) {
954 /* GL_EXT_stencil_two_side */
955 case GL_STENCIL_TEST_TWO_SIDE_EXT
:
956 if (ctx
->API
!= API_OPENGL_COMPAT
)
957 goto invalid_enum_error
;
958 CHECK_EXTENSION(EXT_stencil_two_side
, cap
);
959 if (ctx
->Stencil
.TestTwoSide
== state
)
961 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewStencil
? 0 : _NEW_STENCIL
);
962 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewStencil
;
963 ctx
->Stencil
.TestTwoSide
= state
;
965 ctx
->Stencil
._BackFace
= 2;
967 ctx
->Stencil
._BackFace
= 1;
971 case GL_FRAGMENT_PROGRAM_ARB
:
972 if (ctx
->API
!= API_OPENGL_COMPAT
)
973 goto invalid_enum_error
;
974 CHECK_EXTENSION(ARB_fragment_program
, cap
);
975 if (ctx
->FragmentProgram
.Enabled
== state
)
977 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
978 ctx
->FragmentProgram
.Enabled
= state
;
981 /* GL_EXT_depth_bounds_test */
982 case GL_DEPTH_BOUNDS_TEST_EXT
:
983 if (!_mesa_is_desktop_gl(ctx
))
984 goto invalid_enum_error
;
985 CHECK_EXTENSION(EXT_depth_bounds_test
, cap
);
986 if (ctx
->Depth
.BoundsTest
== state
)
988 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewDepth
? 0 : _NEW_DEPTH
);
989 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewDepth
;
990 ctx
->Depth
.BoundsTest
= state
;
994 if (!_mesa_is_desktop_gl(ctx
))
995 goto invalid_enum_error
;
996 CHECK_EXTENSION(ARB_depth_clamp
, cap
);
997 if (ctx
->Transform
.DepthClamp
== state
)
999 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewDepthClamp
? 0 :
1001 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewDepthClamp
;
1002 ctx
->Transform
.DepthClamp
= state
;
1005 case GL_FRAGMENT_SHADER_ATI
:
1006 if (ctx
->API
!= API_OPENGL_COMPAT
)
1007 goto invalid_enum_error
;
1008 CHECK_EXTENSION(ATI_fragment_shader
, cap
);
1009 if (ctx
->ATIFragmentShader
.Enabled
== state
)
1011 FLUSH_VERTICES(ctx
, _NEW_PROGRAM
);
1012 ctx
->ATIFragmentShader
.Enabled
= state
;
1015 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1016 if (!_mesa_is_desktop_gl(ctx
))
1017 goto invalid_enum_error
;
1018 CHECK_EXTENSION(ARB_seamless_cube_map
, cap
);
1019 if (ctx
->Texture
.CubeMapSeamless
!= state
) {
1020 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
1021 ctx
->Texture
.CubeMapSeamless
= state
;
1025 case GL_RASTERIZER_DISCARD
:
1026 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
1027 goto invalid_enum_error
;
1028 CHECK_EXTENSION(EXT_transform_feedback
, cap
);
1029 if (ctx
->RasterDiscard
!= state
) {
1030 FLUSH_VERTICES(ctx
, 0);
1031 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewRasterizerDiscard
;
1032 ctx
->RasterDiscard
= state
;
1036 /* GL 3.1 primitive restart. Note: this enum is different from
1037 * GL_PRIMITIVE_RESTART_NV (which is client state).
1039 case GL_PRIMITIVE_RESTART
:
1040 if (!_mesa_is_desktop_gl(ctx
) || ctx
->Version
< 31) {
1041 goto invalid_enum_error
;
1043 if (ctx
->Array
.PrimitiveRestart
!= state
) {
1044 FLUSH_VERTICES(ctx
, 0);
1045 ctx
->Array
.PrimitiveRestart
= state
;
1046 update_derived_primitive_restart_state(ctx
);
1050 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
1051 if (!_mesa_is_gles3(ctx
) && !ctx
->Extensions
.ARB_ES3_compatibility
)
1052 goto invalid_enum_error
;
1053 if (ctx
->Array
.PrimitiveRestartFixedIndex
!= state
) {
1054 FLUSH_VERTICES(ctx
, 0);
1055 ctx
->Array
.PrimitiveRestartFixedIndex
= state
;
1056 update_derived_primitive_restart_state(ctx
);
1060 /* GL3.0 - GL_framebuffer_sRGB */
1061 case GL_FRAMEBUFFER_SRGB_EXT
:
1062 if (!_mesa_is_desktop_gl(ctx
))
1063 goto invalid_enum_error
;
1064 CHECK_EXTENSION(EXT_framebuffer_sRGB
, cap
);
1065 _mesa_set_framebuffer_srgb(ctx
, state
);
1068 /* GL_OES_EGL_image_external */
1069 case GL_TEXTURE_EXTERNAL_OES
:
1070 if (!_mesa_is_gles(ctx
))
1071 goto invalid_enum_error
;
1072 CHECK_EXTENSION(OES_EGL_image_external
, cap
);
1073 if (!enable_texture(ctx
, state
, TEXTURE_EXTERNAL_BIT
)) {
1078 /* ARB_texture_multisample */
1079 case GL_SAMPLE_MASK
:
1080 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles31(ctx
))
1081 goto invalid_enum_error
;
1082 CHECK_EXTENSION(ARB_texture_multisample
, cap
);
1083 if (ctx
->Multisample
.SampleMask
== state
)
1085 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewSampleMask
? 0 :
1087 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewSampleMask
;
1088 ctx
->Multisample
.SampleMask
= state
;
1091 case GL_BLEND_ADVANCED_COHERENT_KHR
:
1092 CHECK_EXTENSION(KHR_blend_equation_advanced_coherent
, cap
);
1093 if (ctx
->Color
.BlendCoherent
== state
)
1095 FLUSH_VERTICES(ctx
, ctx
->DriverFlags
.NewBlend
? 0 : _NEW_COLOR
);
1096 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewBlend
;
1097 ctx
->Color
.BlendCoherent
= state
;
1101 goto invalid_enum_error
;
1104 if (ctx
->Driver
.Enable
) {
1105 ctx
->Driver
.Enable( ctx
, cap
, state
);
1111 _mesa_error(ctx
, GL_INVALID_ENUM
, "gl%s(%s)",
1112 state
? "Enable" : "Disable", _mesa_enum_to_string(cap
));
1117 * Enable GL capability. Called by glEnable()
1118 * \param cap state to enable.
1121 _mesa_Enable( GLenum cap
)
1123 GET_CURRENT_CONTEXT(ctx
);
1125 _mesa_set_enable( ctx
, cap
, GL_TRUE
);
1130 * Disable GL capability. Called by glDisable()
1131 * \param cap state to disable.
1134 _mesa_Disable( GLenum cap
)
1136 GET_CURRENT_CONTEXT(ctx
);
1138 _mesa_set_enable( ctx
, cap
, GL_FALSE
);
1144 * Enable/disable an indexed state var.
1147 _mesa_set_enablei(struct gl_context
*ctx
, GLenum cap
,
1148 GLuint index
, GLboolean state
)
1150 assert(state
== 0 || state
== 1);
1153 if (!ctx
->Extensions
.EXT_draw_buffers2
) {
1154 goto invalid_enum_error
;
1156 if (index
>= ctx
->Const
.MaxDrawBuffers
) {
1157 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(index=%u)",
1158 state
? "glEnableIndexed" : "glDisableIndexed", index
);
1161 if (((ctx
->Color
.BlendEnabled
>> index
) & 1) != state
) {
1162 _mesa_flush_vertices_for_blend_state(ctx
);
1164 ctx
->Color
.BlendEnabled
|= (1 << index
);
1166 ctx
->Color
.BlendEnabled
&= ~(1 << index
);
1169 case GL_SCISSOR_TEST
:
1170 if (index
>= ctx
->Const
.MaxViewports
) {
1171 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(index=%u)",
1172 state
? "glEnablei" : "glDisablei", index
);
1175 if (((ctx
->Scissor
.EnableFlags
>> index
) & 1) != state
) {
1177 ctx
->DriverFlags
.NewScissorTest
? 0 : _NEW_SCISSOR
);
1178 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewScissorTest
;
1180 ctx
->Scissor
.EnableFlags
|= (1 << index
);
1182 ctx
->Scissor
.EnableFlags
&= ~(1 << index
);
1186 goto invalid_enum_error
;
1191 _mesa_error(ctx
, GL_INVALID_ENUM
, "%s(cap=%s)",
1192 state
? "glEnablei" : "glDisablei",
1193 _mesa_enum_to_string(cap
));
1198 _mesa_Disablei( GLenum cap
, GLuint index
)
1200 GET_CURRENT_CONTEXT(ctx
);
1201 _mesa_set_enablei(ctx
, cap
, index
, GL_FALSE
);
1206 _mesa_Enablei( GLenum cap
, GLuint index
)
1208 GET_CURRENT_CONTEXT(ctx
);
1209 _mesa_set_enablei(ctx
, cap
, index
, GL_TRUE
);
1213 GLboolean GLAPIENTRY
1214 _mesa_IsEnabledi( GLenum cap
, GLuint index
)
1216 GET_CURRENT_CONTEXT(ctx
);
1217 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
1220 if (index
>= ctx
->Const
.MaxDrawBuffers
) {
1221 _mesa_error(ctx
, GL_INVALID_VALUE
, "glIsEnabledIndexed(index=%u)",
1225 return (ctx
->Color
.BlendEnabled
>> index
) & 1;
1226 case GL_SCISSOR_TEST
:
1227 if (index
>= ctx
->Const
.MaxViewports
) {
1228 _mesa_error(ctx
, GL_INVALID_VALUE
, "glIsEnabledIndexed(index=%u)",
1232 return (ctx
->Scissor
.EnableFlags
>> index
) & 1;
1234 _mesa_error(ctx
, GL_INVALID_ENUM
, "glIsEnabledIndexed(cap=%s)",
1235 _mesa_enum_to_string(cap
));
1243 #undef CHECK_EXTENSION
1244 #define CHECK_EXTENSION(EXTNAME) \
1245 if (!ctx->Extensions.EXTNAME) { \
1246 goto invalid_enum_error; \
1249 #undef CHECK_EXTENSION2
1250 #define CHECK_EXTENSION2(EXT1, EXT2) \
1251 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
1252 goto invalid_enum_error; \
1257 * Helper function to determine whether a texture target is enabled.
1260 is_texture_enabled(struct gl_context
*ctx
, GLbitfield bit
)
1262 const struct gl_texture_unit
*const texUnit
=
1263 &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
1264 return (texUnit
->Enabled
& bit
) ? GL_TRUE
: GL_FALSE
;
1269 * Return simple enable/disable state.
1271 * \param cap state variable to query.
1273 * Returns the state of the specified capability from the current GL context.
1274 * For the capabilities associated with extensions verifies that those
1275 * extensions are effectively present before reporting.
1277 GLboolean GLAPIENTRY
1278 _mesa_IsEnabled( GLenum cap
)
1280 GET_CURRENT_CONTEXT(ctx
);
1281 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
1285 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1286 goto invalid_enum_error
;
1287 return ctx
->Color
.AlphaEnabled
;
1288 case GL_AUTO_NORMAL
:
1289 if (ctx
->API
!= API_OPENGL_COMPAT
)
1290 goto invalid_enum_error
;
1291 return ctx
->Eval
.AutoNormal
;
1293 return ctx
->Color
.BlendEnabled
& 1; /* return state for buffer[0] */
1294 case GL_CLIP_DISTANCE0
: /* aka GL_CLIP_PLANE0 */
1295 case GL_CLIP_DISTANCE1
:
1296 case GL_CLIP_DISTANCE2
:
1297 case GL_CLIP_DISTANCE3
:
1298 case GL_CLIP_DISTANCE4
:
1299 case GL_CLIP_DISTANCE5
:
1300 case GL_CLIP_DISTANCE6
:
1301 case GL_CLIP_DISTANCE7
: {
1302 const GLuint p
= cap
- GL_CLIP_DISTANCE0
;
1304 if (p
>= ctx
->Const
.MaxClipPlanes
)
1305 goto invalid_enum_error
;
1307 return (ctx
->Transform
.ClipPlanesEnabled
>> p
) & 1;
1309 case GL_COLOR_MATERIAL
:
1310 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1311 goto invalid_enum_error
;
1312 return ctx
->Light
.ColorMaterialEnabled
;
1314 return ctx
->Polygon
.CullFlag
;
1315 case GL_DEBUG_OUTPUT
:
1316 case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
:
1317 return (GLboolean
) _mesa_get_debug_state_int(ctx
, cap
);
1319 return ctx
->Depth
.Test
;
1321 return ctx
->Color
.DitherFlag
;
1323 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1324 goto invalid_enum_error
;
1325 return ctx
->Fog
.Enabled
;
1327 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1328 goto invalid_enum_error
;
1329 return ctx
->Light
.Enabled
;
1338 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1339 goto invalid_enum_error
;
1340 return ctx
->Light
.Light
[cap
-GL_LIGHT0
].Enabled
;
1341 case GL_LINE_SMOOTH
:
1342 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1343 goto invalid_enum_error
;
1344 return ctx
->Line
.SmoothFlag
;
1345 case GL_LINE_STIPPLE
:
1346 if (ctx
->API
!= API_OPENGL_COMPAT
)
1347 goto invalid_enum_error
;
1348 return ctx
->Line
.StippleFlag
;
1349 case GL_INDEX_LOGIC_OP
:
1350 if (ctx
->API
!= API_OPENGL_COMPAT
)
1351 goto invalid_enum_error
;
1352 return ctx
->Color
.IndexLogicOpEnabled
;
1353 case GL_COLOR_LOGIC_OP
:
1354 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1355 goto invalid_enum_error
;
1356 return ctx
->Color
.ColorLogicOpEnabled
;
1357 case GL_MAP1_COLOR_4
:
1358 if (ctx
->API
!= API_OPENGL_COMPAT
)
1359 goto invalid_enum_error
;
1360 return ctx
->Eval
.Map1Color4
;
1362 if (ctx
->API
!= API_OPENGL_COMPAT
)
1363 goto invalid_enum_error
;
1364 return ctx
->Eval
.Map1Index
;
1365 case GL_MAP1_NORMAL
:
1366 if (ctx
->API
!= API_OPENGL_COMPAT
)
1367 goto invalid_enum_error
;
1368 return ctx
->Eval
.Map1Normal
;
1369 case GL_MAP1_TEXTURE_COORD_1
:
1370 if (ctx
->API
!= API_OPENGL_COMPAT
)
1371 goto invalid_enum_error
;
1372 return ctx
->Eval
.Map1TextureCoord1
;
1373 case GL_MAP1_TEXTURE_COORD_2
:
1374 if (ctx
->API
!= API_OPENGL_COMPAT
)
1375 goto invalid_enum_error
;
1376 return ctx
->Eval
.Map1TextureCoord2
;
1377 case GL_MAP1_TEXTURE_COORD_3
:
1378 if (ctx
->API
!= API_OPENGL_COMPAT
)
1379 goto invalid_enum_error
;
1380 return ctx
->Eval
.Map1TextureCoord3
;
1381 case GL_MAP1_TEXTURE_COORD_4
:
1382 if (ctx
->API
!= API_OPENGL_COMPAT
)
1383 goto invalid_enum_error
;
1384 return ctx
->Eval
.Map1TextureCoord4
;
1385 case GL_MAP1_VERTEX_3
:
1386 if (ctx
->API
!= API_OPENGL_COMPAT
)
1387 goto invalid_enum_error
;
1388 return ctx
->Eval
.Map1Vertex3
;
1389 case GL_MAP1_VERTEX_4
:
1390 if (ctx
->API
!= API_OPENGL_COMPAT
)
1391 goto invalid_enum_error
;
1392 return ctx
->Eval
.Map1Vertex4
;
1393 case GL_MAP2_COLOR_4
:
1394 if (ctx
->API
!= API_OPENGL_COMPAT
)
1395 goto invalid_enum_error
;
1396 return ctx
->Eval
.Map2Color4
;
1398 if (ctx
->API
!= API_OPENGL_COMPAT
)
1399 goto invalid_enum_error
;
1400 return ctx
->Eval
.Map2Index
;
1401 case GL_MAP2_NORMAL
:
1402 if (ctx
->API
!= API_OPENGL_COMPAT
)
1403 goto invalid_enum_error
;
1404 return ctx
->Eval
.Map2Normal
;
1405 case GL_MAP2_TEXTURE_COORD_1
:
1406 if (ctx
->API
!= API_OPENGL_COMPAT
)
1407 goto invalid_enum_error
;
1408 return ctx
->Eval
.Map2TextureCoord1
;
1409 case GL_MAP2_TEXTURE_COORD_2
:
1410 if (ctx
->API
!= API_OPENGL_COMPAT
)
1411 goto invalid_enum_error
;
1412 return ctx
->Eval
.Map2TextureCoord2
;
1413 case GL_MAP2_TEXTURE_COORD_3
:
1414 if (ctx
->API
!= API_OPENGL_COMPAT
)
1415 goto invalid_enum_error
;
1416 return ctx
->Eval
.Map2TextureCoord3
;
1417 case GL_MAP2_TEXTURE_COORD_4
:
1418 if (ctx
->API
!= API_OPENGL_COMPAT
)
1419 goto invalid_enum_error
;
1420 return ctx
->Eval
.Map2TextureCoord4
;
1421 case GL_MAP2_VERTEX_3
:
1422 if (ctx
->API
!= API_OPENGL_COMPAT
)
1423 goto invalid_enum_error
;
1424 return ctx
->Eval
.Map2Vertex3
;
1425 case GL_MAP2_VERTEX_4
:
1426 if (ctx
->API
!= API_OPENGL_COMPAT
)
1427 goto invalid_enum_error
;
1428 return ctx
->Eval
.Map2Vertex4
;
1430 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1431 goto invalid_enum_error
;
1432 return ctx
->Transform
.Normalize
;
1433 case GL_POINT_SMOOTH
:
1434 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1435 goto invalid_enum_error
;
1436 return ctx
->Point
.SmoothFlag
;
1437 case GL_POLYGON_SMOOTH
:
1438 if (!_mesa_is_desktop_gl(ctx
))
1439 goto invalid_enum_error
;
1440 return ctx
->Polygon
.SmoothFlag
;
1441 case GL_POLYGON_STIPPLE
:
1442 if (ctx
->API
!= API_OPENGL_COMPAT
)
1443 goto invalid_enum_error
;
1444 return ctx
->Polygon
.StippleFlag
;
1445 case GL_POLYGON_OFFSET_POINT
:
1446 if (!_mesa_is_desktop_gl(ctx
))
1447 goto invalid_enum_error
;
1448 return ctx
->Polygon
.OffsetPoint
;
1449 case GL_POLYGON_OFFSET_LINE
:
1450 if (!_mesa_is_desktop_gl(ctx
))
1451 goto invalid_enum_error
;
1452 return ctx
->Polygon
.OffsetLine
;
1453 case GL_POLYGON_OFFSET_FILL
:
1454 return ctx
->Polygon
.OffsetFill
;
1455 case GL_RESCALE_NORMAL_EXT
:
1456 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1457 goto invalid_enum_error
;
1458 return ctx
->Transform
.RescaleNormals
;
1459 case GL_SCISSOR_TEST
:
1460 return ctx
->Scissor
.EnableFlags
& 1; /* return state for index 0 */
1461 case GL_STENCIL_TEST
:
1462 return ctx
->Stencil
.Enabled
;
1464 if (ctx
->API
!= API_OPENGL_COMPAT
)
1465 goto invalid_enum_error
;
1466 return is_texture_enabled(ctx
, TEXTURE_1D_BIT
);
1468 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1469 goto invalid_enum_error
;
1470 return is_texture_enabled(ctx
, TEXTURE_2D_BIT
);
1472 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1473 goto invalid_enum_error
;
1474 return is_texture_enabled(ctx
, TEXTURE_3D_BIT
);
1475 case GL_TEXTURE_GEN_S
:
1476 case GL_TEXTURE_GEN_T
:
1477 case GL_TEXTURE_GEN_R
:
1478 case GL_TEXTURE_GEN_Q
:
1480 const struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
1482 if (ctx
->API
!= API_OPENGL_COMPAT
)
1483 goto invalid_enum_error
;
1486 GLbitfield coordBit
= S_BIT
<< (cap
- GL_TEXTURE_GEN_S
);
1487 return (texUnit
->TexGenEnabled
& coordBit
) ? GL_TRUE
: GL_FALSE
;
1491 case GL_TEXTURE_GEN_STR_OES
:
1493 const struct gl_texture_unit
*texUnit
= get_texcoord_unit(ctx
);
1495 if (ctx
->API
!= API_OPENGLES
)
1496 goto invalid_enum_error
;
1499 return (texUnit
->TexGenEnabled
& STR_BITS
) == STR_BITS
1500 ? GL_TRUE
: GL_FALSE
;
1504 /* client-side state */
1505 case GL_VERTEX_ARRAY
:
1506 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1507 goto invalid_enum_error
;
1508 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_POS
].Enabled
;
1509 case GL_NORMAL_ARRAY
:
1510 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1511 goto invalid_enum_error
;
1512 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_NORMAL
].Enabled
;
1513 case GL_COLOR_ARRAY
:
1514 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1515 goto invalid_enum_error
;
1516 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_COLOR0
].Enabled
;
1517 case GL_INDEX_ARRAY
:
1518 if (ctx
->API
!= API_OPENGL_COMPAT
)
1519 goto invalid_enum_error
;
1520 return ctx
->Array
.VAO
->
1521 VertexAttrib
[VERT_ATTRIB_COLOR_INDEX
].Enabled
;
1522 case GL_TEXTURE_COORD_ARRAY
:
1523 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1524 goto invalid_enum_error
;
1525 return ctx
->Array
.VAO
->
1526 VertexAttrib
[VERT_ATTRIB_TEX(ctx
->Array
.ActiveTexture
)].Enabled
;
1527 case GL_EDGE_FLAG_ARRAY
:
1528 if (ctx
->API
!= API_OPENGL_COMPAT
)
1529 goto invalid_enum_error
;
1530 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_EDGEFLAG
].Enabled
;
1531 case GL_FOG_COORDINATE_ARRAY_EXT
:
1532 if (ctx
->API
!= API_OPENGL_COMPAT
)
1533 goto invalid_enum_error
;
1534 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_FOG
].Enabled
;
1535 case GL_SECONDARY_COLOR_ARRAY_EXT
:
1536 if (ctx
->API
!= API_OPENGL_COMPAT
)
1537 goto invalid_enum_error
;
1538 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_COLOR1
].Enabled
;
1539 case GL_POINT_SIZE_ARRAY_OES
:
1540 if (ctx
->API
!= API_OPENGLES
)
1541 goto invalid_enum_error
;
1542 return ctx
->Array
.VAO
->VertexAttrib
[VERT_ATTRIB_POINT_SIZE
].Enabled
;
1544 /* GL_ARB_texture_cube_map */
1545 case GL_TEXTURE_CUBE_MAP
:
1546 CHECK_EXTENSION(ARB_texture_cube_map
);
1547 return is_texture_enabled(ctx
, TEXTURE_CUBE_BIT
);
1549 /* GL_EXT_secondary_color */
1550 case GL_COLOR_SUM_EXT
:
1551 if (ctx
->API
!= API_OPENGL_COMPAT
)
1552 goto invalid_enum_error
;
1553 return ctx
->Fog
.ColorSumEnabled
;
1555 /* GL_ARB_multisample */
1556 case GL_MULTISAMPLE_ARB
:
1557 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1558 goto invalid_enum_error
;
1559 return ctx
->Multisample
.Enabled
;
1560 case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
:
1561 return ctx
->Multisample
.SampleAlphaToCoverage
;
1562 case GL_SAMPLE_ALPHA_TO_ONE_ARB
:
1563 if (!_mesa_is_desktop_gl(ctx
) && ctx
->API
!= API_OPENGLES
)
1564 goto invalid_enum_error
;
1565 return ctx
->Multisample
.SampleAlphaToOne
;
1566 case GL_SAMPLE_COVERAGE_ARB
:
1567 return ctx
->Multisample
.SampleCoverage
;
1568 case GL_SAMPLE_COVERAGE_INVERT_ARB
:
1569 if (!_mesa_is_desktop_gl(ctx
))
1570 goto invalid_enum_error
;
1571 return ctx
->Multisample
.SampleCoverageInvert
;
1573 /* GL_IBM_rasterpos_clip */
1574 case GL_RASTER_POSITION_UNCLIPPED_IBM
:
1575 if (ctx
->API
!= API_OPENGL_COMPAT
)
1576 goto invalid_enum_error
;
1577 return ctx
->Transform
.RasterPositionUnclipped
;
1579 /* GL_NV_point_sprite */
1580 case GL_POINT_SPRITE_NV
:
1581 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
1582 goto invalid_enum_error
;
1583 CHECK_EXTENSION2(NV_point_sprite
, ARB_point_sprite
)
1584 return ctx
->Point
.PointSprite
;
1586 case GL_VERTEX_PROGRAM_ARB
:
1587 if (ctx
->API
!= API_OPENGL_COMPAT
)
1588 goto invalid_enum_error
;
1589 CHECK_EXTENSION(ARB_vertex_program
);
1590 return ctx
->VertexProgram
.Enabled
;
1591 case GL_VERTEX_PROGRAM_POINT_SIZE_ARB
:
1592 /* This was added with ARB_vertex_program, but it is also used with
1593 * GLSL vertex shaders on desktop.
1595 if (!_mesa_is_desktop_gl(ctx
))
1596 goto invalid_enum_error
;
1597 CHECK_EXTENSION(ARB_vertex_program
);
1598 return ctx
->VertexProgram
.PointSizeEnabled
;
1599 case GL_VERTEX_PROGRAM_TWO_SIDE_ARB
:
1600 if (ctx
->API
!= API_OPENGL_COMPAT
)
1601 goto invalid_enum_error
;
1602 CHECK_EXTENSION(ARB_vertex_program
);
1603 return ctx
->VertexProgram
.TwoSideEnabled
;
1605 /* GL_NV_texture_rectangle */
1606 case GL_TEXTURE_RECTANGLE_NV
:
1607 if (ctx
->API
!= API_OPENGL_COMPAT
)
1608 goto invalid_enum_error
;
1609 CHECK_EXTENSION(NV_texture_rectangle
);
1610 return is_texture_enabled(ctx
, TEXTURE_RECT_BIT
);
1612 /* GL_EXT_stencil_two_side */
1613 case GL_STENCIL_TEST_TWO_SIDE_EXT
:
1614 if (ctx
->API
!= API_OPENGL_COMPAT
)
1615 goto invalid_enum_error
;
1616 CHECK_EXTENSION(EXT_stencil_two_side
);
1617 return ctx
->Stencil
.TestTwoSide
;
1619 case GL_FRAGMENT_PROGRAM_ARB
:
1620 if (ctx
->API
!= API_OPENGL_COMPAT
)
1621 goto invalid_enum_error
;
1622 return ctx
->FragmentProgram
.Enabled
;
1624 /* GL_EXT_depth_bounds_test */
1625 case GL_DEPTH_BOUNDS_TEST_EXT
:
1626 if (!_mesa_is_desktop_gl(ctx
))
1627 goto invalid_enum_error
;
1628 CHECK_EXTENSION(EXT_depth_bounds_test
);
1629 return ctx
->Depth
.BoundsTest
;
1631 /* GL_ARB_depth_clamp */
1632 case GL_DEPTH_CLAMP
:
1633 if (!_mesa_is_desktop_gl(ctx
))
1634 goto invalid_enum_error
;
1635 CHECK_EXTENSION(ARB_depth_clamp
);
1636 return ctx
->Transform
.DepthClamp
;
1638 case GL_FRAGMENT_SHADER_ATI
:
1639 if (ctx
->API
!= API_OPENGL_COMPAT
)
1640 goto invalid_enum_error
;
1641 CHECK_EXTENSION(ATI_fragment_shader
);
1642 return ctx
->ATIFragmentShader
.Enabled
;
1644 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1645 if (!_mesa_is_desktop_gl(ctx
))
1646 goto invalid_enum_error
;
1647 CHECK_EXTENSION(ARB_seamless_cube_map
);
1648 return ctx
->Texture
.CubeMapSeamless
;
1650 case GL_RASTERIZER_DISCARD
:
1651 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
1652 goto invalid_enum_error
;
1653 CHECK_EXTENSION(EXT_transform_feedback
);
1654 return ctx
->RasterDiscard
;
1656 /* GL_NV_primitive_restart */
1657 case GL_PRIMITIVE_RESTART_NV
:
1658 if (ctx
->API
!= API_OPENGL_COMPAT
|| !ctx
->Extensions
.NV_primitive_restart
) {
1659 goto invalid_enum_error
;
1661 return ctx
->Array
.PrimitiveRestart
;
1663 /* GL 3.1 primitive restart */
1664 case GL_PRIMITIVE_RESTART
:
1665 if (!_mesa_is_desktop_gl(ctx
) || ctx
->Version
< 31) {
1666 goto invalid_enum_error
;
1668 return ctx
->Array
.PrimitiveRestart
;
1670 case GL_PRIMITIVE_RESTART_FIXED_INDEX
:
1671 if (!_mesa_is_gles3(ctx
) && !ctx
->Extensions
.ARB_ES3_compatibility
) {
1672 goto invalid_enum_error
;
1674 return ctx
->Array
.PrimitiveRestartFixedIndex
;
1676 /* GL3.0 - GL_framebuffer_sRGB */
1677 case GL_FRAMEBUFFER_SRGB_EXT
:
1678 if (!_mesa_is_desktop_gl(ctx
))
1679 goto invalid_enum_error
;
1680 CHECK_EXTENSION(EXT_framebuffer_sRGB
);
1681 return ctx
->Color
.sRGBEnabled
;
1683 /* GL_OES_EGL_image_external */
1684 case GL_TEXTURE_EXTERNAL_OES
:
1685 if (!_mesa_is_gles(ctx
))
1686 goto invalid_enum_error
;
1687 CHECK_EXTENSION(OES_EGL_image_external
);
1688 return is_texture_enabled(ctx
, TEXTURE_EXTERNAL_BIT
);
1690 /* ARB_texture_multisample */
1691 case GL_SAMPLE_MASK
:
1692 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles31(ctx
))
1693 goto invalid_enum_error
;
1694 CHECK_EXTENSION(ARB_texture_multisample
);
1695 return ctx
->Multisample
.SampleMask
;
1697 /* ARB_sample_shading */
1698 case GL_SAMPLE_SHADING
:
1699 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
1700 goto invalid_enum_error
;
1701 CHECK_EXTENSION(ARB_sample_shading
);
1702 return ctx
->Multisample
.SampleShading
;
1704 case GL_BLEND_ADVANCED_COHERENT_KHR
:
1705 CHECK_EXTENSION(KHR_blend_equation_advanced_coherent
);
1706 return ctx
->Color
.BlendCoherent
;
1708 case GL_CONSERVATIVE_RASTERIZATION_INTEL
:
1709 CHECK_EXTENSION(INTEL_conservative_rasterization
);
1710 return ctx
->IntelConservativeRasterization
;
1713 goto invalid_enum_error
;
1719 _mesa_error(ctx
, GL_INVALID_ENUM
, "glIsEnabled(%s)",
1720 _mesa_enum_to_string(cap
));