Lines Matching refs:ctx

46    if (!ctx->Extensions.EXTNAME) {					\
52 update_derived_primitive_restart_state(struct gl_context *ctx)
56 ctx->Array._PrimitiveRestart = ctx->Array.PrimitiveRestart
57 || ctx->Array.PrimitiveRestartFixedIndex;
64 client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
66 struct gl_vertex_array_object *vao = ctx->Array.VAO;
88 var = &vao->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].Enabled;
89 flag = VERT_BIT_TEX(ctx->Array.ActiveTexture);
107 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
108 ctx->VertexProgram.PointSizeEnabled = state;
113 if (!ctx->Extensions.NV_primitive_restart) {
116 var = &ctx->Array.PrimitiveRestart;
127 FLUSH_VERTICES(ctx, _NEW_ARRAY);
129 _ae_invalidate_state(ctx, _NEW_ARRAY);
133 update_derived_primitive_restart_state(ctx);
142 if (ctx->Driver.Enable) {
143 ctx->Driver.Enable( ctx, cap, state );
149 _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(%s)",
164 GET_CURRENT_CONTEXT(ctx);
165 client_state( ctx, cap, GL_TRUE );
179 GET_CURRENT_CONTEXT(ctx);
180 client_state( ctx, cap, GL_FALSE );
186 if (!ctx->Extensions.EXTNAME) { \
191 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
202 get_texcoord_unit(struct gl_context *ctx)
204 if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
205 _mesa_error(ctx, GL_INVALID_OPERATION, "glEnable/Disable(texcoord unit)");
209 return &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
220 enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit)
222 struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
229 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
240 _mesa_set_multisample(struct gl_context *ctx, GLboolean state)
242 if (ctx->Multisample.Enabled == state)
244 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
245 ctx->Multisample.Enabled = state;
247 if (ctx->Driver.Enable) {
248 ctx->Driver.Enable(ctx, GL_MULTISAMPLE, state);
257 _mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state)
259 if (ctx->Color.sRGBEnabled == state)
261 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
262 ctx->Color.sRGBEnabled = state;
264 if (ctx->Driver.Enable) {
265 ctx->Driver.Enable(ctx, GL_FRAMEBUFFER_SRGB, state);
272 * \param ctx GL context.
282 _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
285 _mesa_debug(ctx, "%s %s (newstate is %x)\n",
288 ctx->NewState);
292 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
294 if (ctx->Color.AlphaEnabled == state)
296 FLUSH_VERTICES(ctx, _NEW_COLOR);
297 ctx->Color.AlphaEnabled = state;
300 if (ctx->API != API_OPENGL_COMPAT)
302 if (ctx->Eval.AutoNormal == state)
304 FLUSH_VERTICES(ctx, _NEW_EVAL);
305 ctx->Eval.AutoNormal = state;
310 state * ((1 << ctx->Const.MaxDrawBuffers) - 1);
311 if (newEnabled != ctx->Color.BlendEnabled) {
312 FLUSH_VERTICES(ctx, _NEW_COLOR);
313 ctx->Color.BlendEnabled = newEnabled;
328 if (p >= ctx->Const.MaxClipPlanes)
331 if ((ctx->Transform.ClipPlanesEnabled & (1 << p))
335 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
338 ctx->Transform.ClipPlanesEnabled |= (1 << p);
339 _mesa_update_clip_plane(ctx, p);
342 ctx->Transform.ClipPlanesEnabled &= ~(1 << p);
347 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
349 if (ctx->Light.ColorMaterialEnabled == state)
351 FLUSH_VERTICES(ctx, _NEW_LIGHT);
352 FLUSH_CURRENT(ctx, 0);
353 ctx->Light.ColorMaterialEnabled = state;
355 _mesa_update_color_material( ctx,
356 ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
360 if (ctx->Polygon.CullFlag == state)
362 FLUSH_VERTICES(ctx, _NEW_POLYGON);
363 ctx->Polygon.CullFlag = state;
366 if (ctx->Depth.Test == state)
368 FLUSH_VERTICES(ctx, _NEW_DEPTH);
369 ctx->Depth.Test = state;
373 _mesa_set_debug_state_int(ctx, cap, state);
376 if (ctx->Color.DitherFlag == state)
378 FLUSH_VERTICES(ctx, _NEW_COLOR);
379 ctx->Color.DitherFlag = state;
382 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
384 if (ctx->Fog.Enabled == state)
386 FLUSH_VERTICES(ctx, _NEW_FOG);
387 ctx->Fog.Enabled = state;
397 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
399 if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
401 FLUSH_VERTICES(ctx, _NEW_LIGHT);
402 ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
404 ctx->Light._EnabledLights |= 1u << (cap - GL_LIGHT0);
407 ctx->Light._EnabledLights &= ~(1u << (cap - GL_LIGHT0));
411 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
413 if (ctx->Light.Enabled == state)
415 FLUSH_VERTICES(ctx, _NEW_LIGHT);
416 ctx->Light.Enabled = state;
419 if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
421 if (ctx->Line.SmoothFlag == state)
423 FLUSH_VERTICES(ctx, _NEW_LINE);
424 ctx->Line.SmoothFlag = state;
427 if (ctx->API != API_OPENGL_COMPAT)
429 if (ctx->Line.StippleFlag == state)
431 FLUSH_VERTICES(ctx, _NEW_LINE);
432 ctx->Line.StippleFlag = state;
435 if (ctx->API != API_OPENGL_COMPAT)
437 if (ctx->Color.IndexLogicOpEnabled == state)
439 FLUSH_VERTICES(ctx, _NEW_COLOR);
440 ctx->Color.IndexLogicOpEnabled = state;
443 if (!_mesa_has_INTEL_conservative_rasterization(ctx))
445 if (ctx->IntelConservativeRasterization == state)
447 FLUSH_VERTICES(ctx, 0);
448 ctx->NewDriverState |=
449 ctx->DriverFlags.NewIntelConservativeRasterization;
450 ctx->IntelConservativeRasterization = state;
453 if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
455 if (ctx->Color.ColorLogicOpEnabled == state)
457 FLUSH_VERTICES(ctx, _NEW_COLOR);
458 ctx->Color.ColorLogicOpEnabled = state;
461 if (ctx->API != API_OPENGL_COMPAT)
463 if (ctx->Eval.Map1Color4 == state)
465 FLUSH_VERTICES(ctx, _NEW_EVAL);
466 ctx->Eval.Map1Color4 = state;
469 if (ctx->API != API_OPENGL_COMPAT)
471 if (ctx->Eval.Map1Index == state)
473 FLUSH_VERTICES(ctx, _NEW_EVAL);
474 ctx->Eval.Map1Index = state;
477 if (ctx->API != API_OPENGL_COMPAT)
479 if (ctx->Eval.Map1Normal == state)
481 FLUSH_VERTICES(ctx, _NEW_EVAL);
482 ctx->Eval.Map1Normal = state;
485 if (ctx->API != API_OPENGL_COMPAT)
487 if (ctx->Eval.Map1TextureCoord1 == state)
489 FLUSH_VERTICES(ctx, _NEW_EVAL);
490 ctx->Eval.Map1TextureCoord1 = state;
493 if (ctx->API != API_OPENGL_COMPAT)
495 if (ctx->Eval.Map1TextureCoord2 == state)
497 FLUSH_VERTICES(ctx, _NEW_EVAL);
498 ctx->Eval.Map1TextureCoord2 = state;
501 if (ctx->API != API_OPENGL_COMPAT)
503 if (ctx->Eval.Map1TextureCoord3 == state)
505 FLUSH_VERTICES(ctx, _NEW_EVAL);
506 ctx->Eval.Map1TextureCoord3 = state;
509 if (ctx->API != API_OPENGL_COMPAT)
511 if (ctx->Eval.Map1TextureCoord4 == state)
513 FLUSH_VERTICES(ctx, _NEW_EVAL);
514 ctx->Eval.Map1TextureCoord4 = state;
517 if (ctx->API != API_OPENGL_COMPAT)
519 if (ctx->Eval.Map1Vertex3 == state)
521 FLUSH_VERTICES(ctx, _NEW_EVAL);
522 ctx->Eval.Map1Vertex3 = state;
525 if (ctx->API != API_OPENGL_COMPAT)
527 if (ctx->Eval.Map1Vertex4 == state)
529 FLUSH_VERTICES(ctx, _NEW_EVAL);
530 ctx->Eval.Map1Vertex4 = state;
533 if (ctx->API != API_OPENGL_COMPAT)
535 if (ctx->Eval.Map2Color4 == state)
537 FLUSH_VERTICES(ctx, _NEW_EVAL);
538 ctx->Eval.Map2Color4 = state;
541 if (ctx->API != API_OPENGL_COMPAT)
543 if (ctx->Eval.Map2Index == state)
545 FLUSH_VERTICES(ctx, _NEW_EVAL);
546 ctx->Eval.Map2Index = state;
549 if (ctx->API != API_OPENGL_COMPAT)
551 if (ctx->Eval.Map2Normal == state)
553 FLUSH_VERTICES(ctx, _NEW_EVAL);
554 ctx->Eval.Map2Normal = state;
557 if (ctx->API != API_OPENGL_COMPAT)
559 if (ctx->Eval.Map2TextureCoord1 == state)
561 FLUSH_VERTICES(ctx, _NEW_EVAL);
562 ctx->Eval.Map2TextureCoord1 = state;
565 if (ctx->API != API_OPENGL_COMPAT)
567 if (ctx->Eval.Map2TextureCoord2 == state)
569 FLUSH_VERTICES(ctx, _NEW_EVAL);
570 ctx->Eval.Map2TextureCoord2 = state;
573 if (ctx->API != API_OPENGL_COMPAT)
575 if (ctx->Eval.Map2TextureCoord3 == state)
577 FLUSH_VERTICES(ctx, _NEW_EVAL);
578 ctx->Eval.Map2TextureCoord3 = state;
581 if (ctx->API != API_OPENGL_COMPAT)
583 if (ctx->Eval.Map2TextureCoord4 == state)
585 FLUSH_VERTICES(ctx, _NEW_EVAL);
586 ctx->Eval.Map2TextureCoord4 = state;
589 if (ctx->API != API_OPENGL_COMPAT)
591 if (ctx->Eval.Map2Vertex3 == state)
593 FLUSH_VERTICES(ctx, _NEW_EVAL);
594 ctx->Eval.Map2Vertex3 = state;
597 if (ctx->API != API_OPENGL_COMPAT)
599 if (ctx->Eval.Map2Vertex4 == state)
601 FLUSH_VERTICES(ctx, _NEW_EVAL);
602 ctx->Eval.Map2Vertex4 = state;
605 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
607 if (ctx->Transform.Normalize == state)
609 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
610 ctx->Transform.Normalize = state;
613 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
615 if (ctx->Point.SmoothFlag == state)
617 FLUSH_VERTICES(ctx, _NEW_POINT);
618 ctx->Point.SmoothFlag = state;
621 if (!_mesa_is_desktop_gl(ctx))
623 if (ctx->Polygon.SmoothFlag == state)
625 FLUSH_VERTICES(ctx, _NEW_POLYGON);
626 ctx->Polygon.SmoothFlag = state;
629 if (ctx->API != API_OPENGL_COMPAT)
631 if (ctx->Polygon.StippleFlag == state)
633 FLUSH_VERTICES(ctx, _NEW_POLYGON);
634 ctx->Polygon.StippleFlag = state;
637 if (!_mesa_is_desktop_gl(ctx))
639 if (ctx->Polygon.OffsetPoint == state)
641 FLUSH_VERTICES(ctx, _NEW_POLYGON);
642 ctx->Polygon.OffsetPoint = state;
645 if (!_mesa_is_desktop_gl(ctx))
647 if (ctx->Polygon.OffsetLine == state)
649 FLUSH_VERTICES(ctx, _NEW_POLYGON);
650 ctx->Polygon.OffsetLine = state;
653 if (ctx->Polygon.OffsetFill == state)
655 FLUSH_VERTICES(ctx, _NEW_POLYGON);
656 ctx->Polygon.OffsetFill = state;
659 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
661 if (ctx->Transform.RescaleNormals == state)
663 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
664 ctx->Transform.RescaleNormals = state;
670 state * ((1 << ctx->Const.MaxViewports) - 1);
671 if (newEnabled != ctx->Scissor.EnableFlags) {
672 FLUSH_VERTICES(ctx, _NEW_SCISSOR);
673 ctx->Scissor.EnableFlags = newEnabled;
678 if (ctx->Stencil.Enabled == state)
680 FLUSH_VERTICES(ctx, _NEW_STENCIL);
681 ctx->Stencil.Enabled = state;
684 if (ctx->API != API_OPENGL_COMPAT)
686 if (!enable_texture(ctx, state, TEXTURE_1D_BIT)) {
691 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
693 if (!enable_texture(ctx, state, TEXTURE_2D_BIT)) {
698 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
700 if (!enable_texture(ctx, state, TEXTURE_3D_BIT)) {
709 struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
711 if (ctx->API != API_OPENGL_COMPAT)
721 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
730 struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
732 if (ctx->API != API_OPENGLES)
742 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
753 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
755 client_state( ctx, cap, state );
761 if (ctx->API != API_OPENGL_COMPAT)
763 client_state( ctx, cap, state );
766 if (ctx->API != API_OPENGLES)
768 client_state( ctx, cap, state );
773 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
776 if (!enable_texture(ctx, state, TEXTURE_CUBE_BIT)) {
783 if (ctx->API != API_OPENGL_COMPAT)
785 if (ctx->Fog.ColorSumEnabled == state)
787 FLUSH_VERTICES(ctx, _NEW_FOG);
788 ctx->Fog.ColorSumEnabled = state;
793 if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
795 _mesa_set_multisample(ctx, state);
798 if (ctx->Multisample.SampleAlphaToCoverage == state)
800 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
801 ctx->Multisample.SampleAlphaToCoverage = state;
804 if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
806 if (ctx->Multisample.SampleAlphaToOne == state)
808 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
809 ctx->Multisample.SampleAlphaToOne = state;
812 if (ctx->Multisample.SampleCoverage == state)
814 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
815 ctx->Multisample.SampleCoverage = state;
818 if (!_mesa_is_desktop_gl(ctx))
820 if (ctx->Multisample.SampleCoverageInvert == state)
822 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
823 ctx->Multisample.SampleCoverageInvert = state;
828 if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
831 if (ctx->Multisample.SampleShading == state)
833 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
834 ctx->Multisample.SampleShading = state;
839 if (ctx->API != API_OPENGL_COMPAT)
841 if (ctx->Transform.RasterPositionUnclipped == state)
843 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
844 ctx->Transform.RasterPositionUnclipped = state;
849 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
852 if (ctx->Point.PointSprite == state)
854 FLUSH_VERTICES(ctx, _NEW_POINT);
855 ctx->Point.PointSprite = state;
859 if (ctx->API != API_OPENGL_COMPAT)
862 if (ctx->VertexProgram.Enabled == state)
864 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
865 ctx->VertexProgram.Enabled = state;
871 if (!_mesa_is_desktop_gl(ctx))
874 if (ctx->VertexProgram.PointSizeEnabled == state)
876 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
877 ctx->VertexProgram.PointSizeEnabled = state;
880 if (ctx->API != API_OPENGL_COMPAT)
883 if (ctx->VertexProgram.TwoSideEnabled == state)
885 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
886 ctx->VertexProgram.TwoSideEnabled = state;
891 if (ctx->API != API_OPENGL_COMPAT)
894 if (!enable_texture(ctx, state, TEXTURE_RECT_BIT)) {
901 if (ctx->API != API_OPENGL_COMPAT)
904 if (ctx->Stencil.TestTwoSide == state)
906 FLUSH_VERTICES(ctx, _NEW_STENCIL);
907 ctx->Stencil.TestTwoSide = state;
909 ctx->Stencil._BackFace = 2;
911 ctx->Stencil._BackFace = 1;
916 if (ctx->API != API_OPENGL_COMPAT)
919 if (ctx->FragmentProgram.Enabled == state)
921 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
922 ctx->FragmentProgram.Enabled = state;
927 if (!_mesa_is_desktop_gl(ctx))
930 if (ctx->Depth.BoundsTest == state)
932 FLUSH_VERTICES(ctx, _NEW_DEPTH);
933 ctx->Depth.BoundsTest = state;
937 if (!_mesa_is_desktop_gl(ctx))
940 if (ctx->Transform.DepthClamp == state)
942 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
943 ctx->Transform.DepthClamp = state;
947 if (ctx->API != API_OPENGL_COMPAT)
950 if (ctx->ATIFragmentShader.Enabled == state)
952 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
953 ctx->ATIFragmentShader.Enabled = state;
957 if (!_mesa_is_desktop_gl(ctx))
960 if (ctx->Texture.CubeMapSeamless != state) {
961 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
962 ctx->Texture.CubeMapSeamless = state;
967 if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
970 if (ctx->RasterDiscard != state) {
971 FLUSH_VERTICES(ctx, 0);
972 ctx->NewDriverState |= ctx->DriverFlags.NewRasterizerDiscard;
973 ctx->RasterDiscard = state;
981 if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 31) {
984 if (ctx->Array.PrimitiveRestart != state) {
985 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
986 ctx->Array.PrimitiveRestart = state;
987 update_derived_primitive_restart_state(ctx);
992 if (!_mesa_is_gles3(ctx) && !ctx->Extensions.ARB_ES3_compatibility)
994 if (ctx->Array.PrimitiveRestartFixedIndex != state) {
995 FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
996 ctx->Array.PrimitiveRestartFixedIndex = state;
997 update_derived_primitive_restart_state(ctx);
1003 if (!_mesa_is_desktop_gl(ctx))
1006 _mesa_set_framebuffer_srgb(ctx, state);
1011 if (!_mesa_is_gles(ctx))
1014 if (!enable_texture(ctx, state, TEXTURE_EXTERNAL_BIT)) {
1021 if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles31(ctx))
1024 if (ctx->Multisample.SampleMask == state)
1026 FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
1027 ctx->Multisample.SampleMask = state;
1032 if (ctx->Color.BlendCoherent == state)
1034 FLUSH_VERTICES(ctx, _NEW_COLOR);
1035 ctx->Color.BlendCoherent = state;
1042 if (ctx->Driver.Enable) {
1043 ctx->Driver.Enable( ctx, cap, state );
1049 _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(%s)",
1061 GET_CURRENT_CONTEXT(ctx);
1063 _mesa_set_enable( ctx, cap, GL_TRUE );
1074 GET_CURRENT_CONTEXT(ctx);
1076 _mesa_set_enable( ctx, cap, GL_FALSE );
1085 _mesa_set_enablei(struct gl_context *ctx, GLenum cap,
1091 if (!ctx->Extensions.EXT_draw_buffers2) {
1094 if (index >= ctx->Const.MaxDrawBuffers) {
1095 _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)",
1099 if (((ctx->Color.BlendEnabled >> index) & 1) != state) {
1100 FLUSH_VERTICES(ctx, _NEW_COLOR);
1102 ctx->Color.BlendEnabled |= (1 << index);
1104 ctx->Color.BlendEnabled &= ~(1 << index);
1108 if (index >= ctx->Const.MaxViewports) {
1109 _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)",
1113 if (((ctx->Scissor.EnableFlags >> index) & 1) != state) {
1114 FLUSH_VERTICES(ctx, _NEW_SCISSOR);
1116 ctx->Scissor.EnableFlags |= (1 << index);
1118 ctx->Scissor.EnableFlags &= ~(1 << index);
1127 _mesa_error(ctx, GL_INVALID_ENUM, "%s(cap=%s)",
1136 GET_CURRENT_CONTEXT(ctx);
1137 _mesa_set_enablei(ctx, cap, index, GL_FALSE);
1144 GET_CURRENT_CONTEXT(ctx);
1145 _mesa_set_enablei(ctx, cap, index, GL_TRUE);
1152 GET_CURRENT_CONTEXT(ctx);
1153 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
1156 if (index >= ctx->Const.MaxDrawBuffers) {
1157 _mesa_error(ctx, GL_INVALID_VALUE, "glIsEnabledIndexed(index=%u)",
1161 return (ctx->Color.BlendEnabled >> index) & 1;
1163 if (index >= ctx->Const.MaxViewports) {
1164 _mesa_error(ctx, GL_INVALID_VALUE, "glIsEnabledIndexed(index=%u)",
1168 return (ctx->Scissor.EnableFlags >> index) & 1;
1170 _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabledIndexed(cap=%s)",
1181 if (!ctx->Extensions.EXTNAME) { \
1187 if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \
1196 is_texture_enabled(struct gl_context *ctx, GLbitfield bit)
1199 &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
1216 GET_CURRENT_CONTEXT(ctx);
1217 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
1221 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1223 return ctx->Color.AlphaEnabled;
1225 if (ctx->API != API_OPENGL_COMPAT)
1227 return ctx->Eval.AutoNormal;
1229 return ctx->Color.BlendEnabled & 1; /* return state for buffer[0] */
1240 if (p >= ctx->Const.MaxClipPlanes)
1243 return (ctx->Transform.ClipPlanesEnabled >> p) & 1;
1246 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1248 return ctx->Light.ColorMaterialEnabled;
1250 return ctx->Polygon.CullFlag;
1253 return (GLboolean) _mesa_get_debug_state_int(ctx, cap);
1255 return ctx->Depth.Test;
1257 return ctx->Color.DitherFlag;
1259 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1261 return ctx->Fog.Enabled;
1263 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1265 return ctx->Light.Enabled;
1274 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1276 return ctx->Light.Light[cap-GL_LIGHT0].Enabled;
1278 if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
1280 return ctx->Line.SmoothFlag;
1282 if (ctx->API != API_OPENGL_COMPAT)
1284 return ctx->Line.StippleFlag;
1286 if (ctx->API != API_OPENGL_COMPAT)
1288 return ctx->Color.IndexLogicOpEnabled;
1290 if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
1292 return ctx->Color.ColorLogicOpEnabled;
1294 if (ctx->API != API_OPENGL_COMPAT)
1296 return ctx->Eval.Map1Color4;
1298 if (ctx->API != API_OPENGL_COMPAT)
1300 return ctx->Eval.Map1Index;
1302 if (ctx->API != API_OPENGL_COMPAT)
1304 return ctx->Eval.Map1Normal;
1306 if (ctx->API != API_OPENGL_COMPAT)
1308 return ctx->Eval.Map1TextureCoord1;
1310 if (ctx->API != API_OPENGL_COMPAT)
1312 return ctx->Eval.Map1TextureCoord2;
1314 if (ctx->API != API_OPENGL_COMPAT)
1316 return ctx->Eval.Map1TextureCoord3;
1318 if (ctx->API != API_OPENGL_COMPAT)
1320 return ctx->Eval.Map1TextureCoord4;
1322 if (ctx->API != API_OPENGL_COMPAT)
1324 return ctx->Eval.Map1Vertex3;
1326 if (ctx->API != API_OPENGL_COMPAT)
1328 return ctx->Eval.Map1Vertex4;
1330 if (ctx->API != API_OPENGL_COMPAT)
1332 return ctx->Eval.Map2Color4;
1334 if (ctx->API != API_OPENGL_COMPAT)
1336 return ctx->Eval.Map2Index;
1338 if (ctx->API != API_OPENGL_COMPAT)
1340 return ctx->Eval.Map2Normal;
1342 if (ctx->API != API_OPENGL_COMPAT)
1344 return ctx->Eval.Map2TextureCoord1;
1346 if (ctx->API != API_OPENGL_COMPAT)
1348 return ctx->Eval.Map2TextureCoord2;
1350 if (ctx->API != API_OPENGL_COMPAT)
1352 return ctx->Eval.Map2TextureCoord3;
1354 if (ctx->API != API_OPENGL_COMPAT)
1356 return ctx->Eval.Map2TextureCoord4;
1358 if (ctx->API != API_OPENGL_COMPAT)
1360 return ctx->Eval.Map2Vertex3;
1362 if (ctx->API != API_OPENGL_COMPAT)
1364 return ctx->Eval.Map2Vertex4;
1366 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1368 return ctx->Transform.Normalize;
1370 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1372 return ctx->Point.SmoothFlag;
1374 if (!_mesa_is_desktop_gl(ctx))
1376 return ctx->Polygon.SmoothFlag;
1378 if (ctx->API != API_OPENGL_COMPAT)
1380 return ctx->Polygon.StippleFlag;
1382 if (!_mesa_is_desktop_gl(ctx))
1384 return ctx->Polygon.OffsetPoint;
1386 if (!_mesa_is_desktop_gl(ctx))
1388 return ctx->Polygon.OffsetLine;
1390 return ctx->Polygon.OffsetFill;
1392 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1394 return ctx->Transform.RescaleNormals;
1396 return ctx->Scissor.EnableFlags & 1; /* return state for index 0 */
1398 return ctx->Stencil.Enabled;
1400 if (ctx->API != API_OPENGL_COMPAT)
1402 return is_texture_enabled(ctx, TEXTURE_1D_BIT);
1404 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1406 return is_texture_enabled(ctx, TEXTURE_2D_BIT);
1408 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1410 return is_texture_enabled(ctx, TEXTURE_3D_BIT);
1416 const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
1418 if (ctx->API != API_OPENGL_COMPAT)
1429 const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
1431 if (ctx->API != API_OPENGLES)
1442 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1444 return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled;
1446 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1448 return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled;
1450 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1452 return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled;
1454 if (ctx->API != API_OPENGL_COMPAT)
1456 return ctx->Array.VAO->
1459 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1461 return ctx->Array.VAO->
1462 VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].Enabled;
1464 if (ctx->API != API_OPENGL_COMPAT)
1466 return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled;
1468 if (ctx->API != API_OPENGL_COMPAT)
1470 return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_FOG].Enabled;
1472 if (ctx->API != API_OPENGL_COMPAT)
1474 return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled;
1476 if (ctx->API != API_OPENGLES)
1478 return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled;
1483 return is_texture_enabled(ctx, TEXTURE_CUBE_BIT);
1487 if (ctx->API != API_OPENGL_COMPAT)
1489 return ctx->Fog.ColorSumEnabled;
1493 if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
1495 return ctx->Multisample.Enabled;
1497 return ctx->Multisample.SampleAlphaToCoverage;
1499 if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
1501 return ctx->Multisample.SampleAlphaToOne;
1503 return ctx->Multisample.SampleCoverage;
1505 if (!_mesa_is_desktop_gl(ctx))
1507 return ctx->Multisample.SampleCoverageInvert;
1511 if (ctx->API != API_OPENGL_COMPAT)
1513 return ctx->Transform.RasterPositionUnclipped;
1517 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
1520 return ctx->Point.PointSprite;
1523 if (ctx->API != API_OPENGL_COMPAT)
1526 return ctx->VertexProgram.Enabled;
1531 if (!_mesa_is_desktop_gl(ctx))
1534 return ctx->VertexProgram.PointSizeEnabled;
1536 if (ctx->API != API_OPENGL_COMPAT)
1539 return ctx->VertexProgram.TwoSideEnabled;
1543 if (ctx->API != API_OPENGL_COMPAT)
1546 return is_texture_enabled(ctx, TEXTURE_RECT_BIT);
1550 if (ctx->API != API_OPENGL_COMPAT)
1553 return ctx->Stencil.TestTwoSide;
1556 if (ctx->API != API_OPENGL_COMPAT)
1558 return ctx->FragmentProgram.Enabled;
1562 if (!_mesa_is_desktop_gl(ctx))
1565 return ctx->Depth.BoundsTest;
1569 if (!_mesa_is_desktop_gl(ctx))
1572 return ctx->Transform.DepthClamp;
1575 if (ctx->API != API_OPENGL_COMPAT)
1578 return ctx->ATIFragmentShader.Enabled;
1581 if (!_mesa_is_desktop_gl(ctx))
1584 return ctx->Texture.CubeMapSeamless;
1587 if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
1590 return ctx->RasterDiscard;
1594 if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.NV_primitive_restart) {
1597 return ctx->Array.PrimitiveRestart;
1601 if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 31) {
1604 return ctx->Array.PrimitiveRestart;
1607 if (!_mesa_is_gles3(ctx) && !ctx->Extensions.ARB_ES3_compatibility) {
1610 return ctx->Array.PrimitiveRestartFixedIndex;
1614 if (!_mesa_is_desktop_gl(ctx))
1617 return ctx->Color.sRGBEnabled;
1621 if (!_mesa_is_gles(ctx))
1624 return is_texture_enabled(ctx, TEXTURE_EXTERNAL_BIT);
1628 if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles31(ctx))
1631 return ctx->Multisample.SampleMask;
1635 if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
1638 return ctx->Multisample.SampleShading;
1642 return ctx->Color.BlendCoherent;
1646 return ctx->IntelConservativeRasterization;
1655 _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(%s)",