Lines Matching full:ctx
211 GET_CURRENT_CONTEXT(ctx);
212 ASSERT_OUTSIDE_BEGIN_END(ctx);
215 _mesa_debug(ctx, "glPushAttrib %x\n", (int) mask);
217 if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) {
218 _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" );
229 memcpy( attr, &ctx->Accum, sizeof(struct gl_accum_attrib) );
237 memcpy( attr, &ctx->Color, sizeof(struct gl_colorbuffer_attrib) );
238 /* push the Draw FBO's DrawBuffer[] state, not ctx->Color.DrawBuffer[] */
239 for (i = 0; i < ctx->Const.MaxDrawBuffers; i ++)
240 attr->DrawBuffer[i] = ctx->DrawBuffer->ColorDrawBuffer[i];
246 FLUSH_CURRENT( ctx, 0 );
248 memcpy( attr, &ctx->Current, sizeof(struct gl_current_attrib) );
255 memcpy( attr, &ctx->Depth, sizeof(struct gl_depthbuffer_attrib) );
264 attr->AlphaTest = ctx->Color.AlphaEnabled;
265 attr->AutoNormal = ctx->Eval.AutoNormal;
266 attr->Blend = ctx->Color.BlendEnabled;
267 attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled;
268 attr->ColorMaterial = ctx->Light.ColorMaterialEnabled;
269 attr->CullFace = ctx->Polygon.CullFlag;
270 attr->DepthClamp = ctx->Transform.DepthClamp;
271 attr->DepthTest = ctx->Depth.Test;
272 attr->Dither = ctx->Color.DitherFlag;
273 attr->Fog = ctx->Fog.Enabled;
274 for (i = 0; i < ctx->Const.MaxLights; i++) {
275 attr->Light[i] = ctx->Light.Light[i].Enabled;
277 attr->Lighting = ctx->Light.Enabled;
278 attr->LineSmooth = ctx->Line.SmoothFlag;
279 attr->LineStipple = ctx->Line.StippleFlag;
280 attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled;
281 attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled;
282 attr->Map1Color4 = ctx->Eval.Map1Color4;
283 attr->Map1Index = ctx->Eval.Map1Index;
284 attr->Map1Normal = ctx->Eval.Map1Normal;
285 attr->Map1TextureCoord1 = ctx->Eval.Map1TextureCoord1;
286 attr->Map1TextureCoord2 = ctx->Eval.Map1TextureCoord2;
287 attr->Map1TextureCoord3 = ctx->Eval.Map1TextureCoord3;
288 attr->Map1TextureCoord4 = ctx->Eval.Map1TextureCoord4;
289 attr->Map1Vertex3 = ctx->Eval.Map1Vertex3;
290 attr->Map1Vertex4 = ctx->Eval.Map1Vertex4;
291 memcpy(attr->Map1Attrib, ctx->Eval.Map1Attrib, sizeof(ctx->Eval.Map1Attrib));
292 attr->Map2Color4 = ctx->Eval.Map2Color4;
293 attr->Map2Index = ctx->Eval.Map2Index;
294 attr->Map2Normal = ctx->Eval.Map2Normal;
295 attr->Map2TextureCoord1 = ctx->Eval.Map2TextureCoord1;
296 attr->Map2TextureCoord2 = ctx->Eval.Map2TextureCoord2;
297 attr->Map2TextureCoord3 = ctx->Eval.Map2TextureCoord3;
298 attr->Map2TextureCoord4 = ctx->Eval.Map2TextureCoord4;
299 attr->Map2Vertex3 = ctx->Eval.Map2Vertex3;
300 attr->Map2Vertex4 = ctx->Eval.Map2Vertex4;
301 memcpy(attr->Map2Attrib, ctx->Eval.Map2Attrib, sizeof(ctx->Eval.Map2Attrib));
302 attr->Normalize = ctx->Transform.Normalize;
303 attr->RasterPositionUnclipped = ctx->Transform.RasterPositionUnclipped;
304 attr->PointSmooth = ctx->Point.SmoothFlag;
305 attr->PointSprite = ctx->Point.PointSprite;
306 attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint;
307 attr->PolygonOffsetLine = ctx->Polygon.OffsetLine;
308 attr->PolygonOffsetFill = ctx->Polygon.OffsetFill;
309 attr->PolygonSmooth = ctx->Polygon.SmoothFlag;
310 attr->PolygonStipple = ctx->Polygon.StippleFlag;
311 attr->RescaleNormals = ctx->Transform.RescaleNormals;
312 attr->Scissor = ctx->Scissor.Enabled;
313 attr->Stencil = ctx->Stencil.Enabled;
314 attr->StencilTwoSide = ctx->Stencil.TestTwoSide;
315 attr->MultisampleEnabled = ctx->Multisample.Enabled;
316 attr->SampleAlphaToCoverage = ctx->Multisample.SampleAlphaToCoverage;
317 attr->SampleAlphaToOne = ctx->Multisample.SampleAlphaToOne;
318 attr->SampleCoverage = ctx->Multisample.SampleCoverage;
319 for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
320 attr->Texture[i] = ctx->Texture.Unit[i].Enabled;
321 attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled;
324 attr->VertexProgram = ctx->VertexProgram.Enabled;
325 attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled;
326 attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled;
330 attr->sRGBEnabled = ctx->Color.sRGBEnabled;
336 memcpy( attr, &ctx->Eval, sizeof(struct gl_eval_attrib) );
343 memcpy( attr, &ctx->Fog, sizeof(struct gl_fog_attrib) );
350 memcpy( attr, &ctx->Hint, sizeof(struct gl_hint_attrib) );
356 FLUSH_CURRENT(ctx, 0); /* flush material changes */
358 memcpy( attr, &ctx->Light, sizeof(struct gl_light_attrib) );
365 memcpy( attr, &ctx->Line, sizeof(struct gl_line_attrib) );
372 memcpy( attr, &ctx->List, sizeof(struct gl_list_attrib) );
379 memcpy( attr, &ctx->Pixel, sizeof(struct gl_pixel_attrib) );
380 /* push the Read FBO's ReadBuffer state, not ctx->Pixel.ReadBuffer */
381 attr->ReadBuffer = ctx->ReadBuffer->ColorReadBuffer;
388 memcpy( attr, &ctx->Point, sizeof(struct gl_point_attrib) );
395 memcpy( attr, &ctx->Polygon, sizeof(struct gl_polygon_attrib) );
402 memcpy( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) );
409 memcpy( attr, &ctx->Scissor, sizeof(struct gl_scissor_attrib) );
416 memcpy( attr, &ctx->Stencil, sizeof(struct gl_stencil_attrib) );
425 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_TEXTURE_BIT)");
429 _mesa_lock_context_textures(ctx);
432 memcpy(&texstate->Texture, &ctx->Texture, sizeof(ctx->Texture));
437 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
440 ctx->Texture.Unit[u].CurrentTex[tex]);
445 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
448 ctx->Texture.Unit[u].CurrentTex[tex]);
452 _mesa_reference_shared_state(ctx, &texstate->SharedRef, ctx->Shared);
454 _mesa_unlock_context_textures(ctx);
462 memcpy( attr, &ctx->Transform, sizeof(struct gl_transform_attrib) );
469 memcpy( attr, &ctx->Viewport, sizeof(struct gl_viewport_attrib) );
477 memcpy( attr, &ctx->Multisample, sizeof(struct gl_multisample_attrib) );
482 ctx->AttribStack[ctx->AttribStackDepth] = head;
483 ctx->AttribStackDepth++;
489 pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
491 const GLuint curTexUnitSave = ctx->Texture.CurrentUnit;
496 _mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \
499 TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST);
500 if (ctx->Color.BlendEnabled != enable->Blend) {
501 if (ctx->Extensions.EXT_draw_buffers2) {
503 for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
504 _mesa_set_enablei(ctx, GL_BLEND, i, (enable->Blend >> i) & 1);
508 _mesa_set_enable(ctx, GL_BLEND, (enable->Blend & 1));
512 for (i=0;i<ctx->Const.MaxClipPlanes;i++) {
514 if ((ctx->Transform.ClipPlanesEnabled & mask) != (enable->ClipPlanes & mask))
515 _mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i),
519 TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial,
521 TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
522 TEST_AND_UPDATE(ctx->Transform.DepthClamp, enable->DepthClamp,
524 TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
525 TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
526 TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG);
527 TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING);
528 TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH);
529 TEST_AND_UPDATE(ctx->Line.StippleFlag, enable->LineStipple,
531 TEST_AND_UPDATE(ctx->Color.IndexLogicOpEnabled, enable->IndexLogicOp,
533 TEST_AND_UPDATE(ctx->Color.ColorLogicOpEnabled, enable->ColorLogicOp,
536 TEST_AND_UPDATE(ctx->Eval.Map1Color4, enable->Map1Color4, GL_MAP1_COLOR_4);
537 TEST_AND_UPDATE(ctx->Eval.Map1Index, enable->Map1Index, GL_MAP1_INDEX);
538 TEST_AND_UPDATE(ctx->Eval.Map1Normal, enable->Map1Normal, GL_MAP1_NORMAL);
539 TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord1, enable->Map1TextureCoord1,
541 TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord2, enable->Map1TextureCoord2,
543 TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord3, enable->Map1TextureCoord3,
545 TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord4, enable->Map1TextureCoord4,
547 TEST_AND_UPDATE(ctx->Eval.Map1Vertex3, enable->Map1Vertex3,
549 TEST_AND_UPDATE(ctx->Eval.Map1Vertex4, enable->Map1Vertex4,
552 TEST_AND_UPDATE(ctx->Eval.Map1Attrib[i], enable->Map1Attrib[i],
556 TEST_AND_UPDATE(ctx->Eval.Map2Color4, enable->Map2Color4, GL_MAP2_COLOR_4);
557 TEST_AND_UPDATE(ctx->Eval.Map2Index, enable->Map2Index, GL_MAP2_INDEX);
558 TEST_AND_UPDATE(ctx->Eval.Map2Normal, enable->Map2Normal, GL_MAP2_NORMAL);
559 TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord1, enable->Map2TextureCoord1,
561 TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord2, enable->Map2TextureCoord2,
563 TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord3, enable->Map2TextureCoord3,
565 TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord4, enable->Map2TextureCoord4,
567 TEST_AND_UPDATE(ctx->Eval.Map2Vertex3, enable->Map2Vertex3,
569 TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4,
572 TEST_AND_UPDATE(ctx->Eval.Map2Attrib[i], enable->Map2Attrib[i],
576 TEST_AND_UPDATE(ctx->Eval.AutoNormal, enable->AutoNormal, GL_AUTO_NORMAL);
577 TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE);
578 TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals,
580 TEST_AND_UPDATE(ctx->Transform.RasterPositionUnclipped,
583 TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth,
585 if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) {
586 TEST_AND_UPDATE(ctx->Point.PointSprite, enable->PointSprite,
589 TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint,
591 TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine,
593 TEST_AND_UPDATE(ctx->Polygon.OffsetFill, enable->PolygonOffsetFill,
595 TEST_AND_UPDATE(ctx->Polygon.SmoothFlag, enable->PolygonSmooth,
597 TEST_AND_UPDATE(ctx->Polygon.StippleFlag, enable->PolygonStipple,
599 TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST);
600 TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST);
601 if (ctx->Extensions.EXT_stencil_two_side) {
602 TEST_AND_UPDATE(ctx->Stencil.TestTwoSide, enable->StencilTwoSide, GL_STENCIL_TEST_TWO_SIDE_EXT);
604 TEST_AND_UPDATE(ctx->Multisample.Enabled, enable->MultisampleEnabled,
606 TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage,
609 TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne,
612 TEST_AND_UPDATE(ctx->Multisample.SampleCoverage,
616 TEST_AND_UPDATE(ctx->VertexProgram.Enabled,
619 TEST_AND_UPDATE(ctx->VertexProgram.PointSizeEnabled,
622 TEST_AND_UPDATE(ctx->VertexProgram.TwoSideEnabled,
627 TEST_AND_UPDATE(ctx->Color.sRGBEnabled, enable->sRGBEnabled,
631 for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
635 if (ctx->Texture.Unit[i].Enabled != enabled) {
638 _mesa_set_enable(ctx, GL_TEXTURE_1D, !!(enabled & TEXTURE_1D_BIT));
639 _mesa_set_enable(ctx, GL_TEXTURE_2D, !!(enabled & TEXTURE_2D_BIT));
640 _mesa_set_enable(ctx, GL_TEXTURE_3D, !!(enabled & TEXTURE_3D_BIT));
641 if (ctx->Extensions.NV_texture_rectangle) {
642 _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_ARB,
645 if (ctx->Extensions.ARB_texture_cube_map) {
646 _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP,
649 if (ctx->Extensions.MESA_texture_array) {
650 _mesa_set_enable(ctx, GL_TEXTURE_1D_ARRAY_EXT,
652 _mesa_set_enable(ctx, GL_TEXTURE_2D_ARRAY_EXT,
657 if (ctx->Texture.Unit[i].TexGenEnabled != genEnabled) {
659 _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, !!(genEnabled & S_BIT));
660 _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, !!(genEnabled & T_BIT));
661 _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, !!(genEnabled & R_BIT));
662 _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, !!(genEnabled & Q_BIT));
674 pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
678 _mesa_lock_context_textures(ctx);
680 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
685 _mesa_set_enable(ctx, GL_TEXTURE_1D, !!(unit->Enabled & TEXTURE_1D_BIT));
686 _mesa_set_enable(ctx, GL_TEXTURE_2D, !!(unit->Enabled & TEXTURE_2D_BIT));
687 _mesa_set_enable(ctx, GL_TEXTURE_3D, !!(unit->Enabled & TEXTURE_3D_BIT));
688 if (ctx->Extensions.ARB_texture_cube_map) {
689 _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB,
692 if (ctx->Extensions.NV_texture_rectangle) {
693 _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV,
696 if (ctx->Extensions.MESA_texture_array) {
697 _mesa_set_enable(ctx, GL_TEXTURE_1D_ARRAY_EXT,
699 _mesa_set_enable(ctx, GL_TEXTURE_2D_ARRAY_EXT,
715 struct gl_texture_unit *destUnit = &ctx->Texture.Unit[u];
720 if (ctx->Driver.TexGen) {
721 ctx->Driver.TexGen(ctx, GL_S, GL_EYE_PLANE, unit->GenS.EyePlane);
722 ctx->Driver.TexGen(ctx, GL_T, GL_EYE_PLANE, unit->GenT.EyePlane);
723 ctx->Driver.TexGen(ctx, GL_R, GL_EYE_PLANE, unit->GenR.EyePlane);
724 ctx->Driver.TexGen(ctx, GL_Q, GL_EYE_PLANE, unit->GenQ.EyePlane);
727 _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, !!(unit->TexGenEnabled & S_BIT));
728 _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, !!(unit->TexGenEnabled & T_BIT));
729 _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, !!(unit->TexGenEnabled & R_BIT));
730 _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, !!(unit->TexGenEnabled & Q_BIT));
738 const GLuint n = ctx->Extensions.NV_texture_env_combine4 ? 4 : 3;
768 !ctx->Extensions.ARB_texture_cube_map) {
772 !ctx->Extensions.NV_texture_rectangle) {
777 !ctx->Extensions.MESA_texture_array) {
804 if (ctx->Extensions.EXT_texture_filter_anisotropic) {
808 if (ctx->Extensions.ARB_shadow) {
814 if (ctx->Extensions.ARB_depth_texture)
826 _mesa_reference_shared_state(ctx, &texstate->SharedRef, NULL);
828 _mesa_unlock_context_textures(ctx);
846 GET_CURRENT_CONTEXT(ctx);
847 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
849 if (ctx->AttribStackDepth == 0) {
850 _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" );
854 ctx->AttribStackDepth--;
855 attr = ctx->AttribStack[ctx->AttribStackDepth];
860 _mesa_debug(ctx, "glPopAttrib %s\n",
886 if (!ctx->Extensions.EXT_draw_buffers2) {
894 for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
912 for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) {
926 _mesa_DrawBuffersARB(ctx->Const.MaxDrawBuffers,
931 _mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled);
933 if (ctx->Color.BlendEnabled != color->BlendEnabled) {
934 if (ctx->Extensions.EXT_draw_buffers2) {
936 for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
937 _mesa_set_enablei(ctx, GL_BLEND, i,
942 _mesa_set_enable(ctx, GL_BLEND, (color->BlendEnabled & 1));
945 if (ctx->Color._BlendFuncPerBuffer ||
946 ctx->Color._BlendEquationPerBuffer) {
949 for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
983 _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP,
985 _mesa_set_enable(ctx, GL_INDEX_LOGIC_OP,
987 _mesa_set_enable(ctx, GL_DITHER, color->DitherFlag);
992 if (ctx->Extensions.EXT_framebuffer_sRGB)
993 _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
997 FLUSH_CURRENT( ctx, 0 );
998 memcpy( &ctx->Current, attr->data,
1007 _mesa_set_enable(ctx, GL_DEPTH_TEST, depth->Test);
1015 pop_enable_group(ctx, enable);
1016 ctx->NewState |= _NEW_ALL;
1020 memcpy( &ctx->Eval, attr->data, sizeof(struct gl_eval_attrib) );
1021 ctx->NewState |= _NEW_EVAL;
1027 _mesa_set_enable(ctx, GL_FOG, fog->Enabled);
1058 _mesa_set_enable(ctx, GL_LIGHTING, light->Enabled);
1060 if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top))
1061 _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
1063 for (i = 0; i < ctx->Const.MaxLights; i++) {
1065 _mesa_set_enable(ctx, GL_LIGHT0 + i, l->Enabled);
1066 _mesa_light(ctx, i, GL_AMBIENT, l->Ambient);
1067 _mesa_light(ctx, i, GL_DIFFUSE, l->Diffuse);
1068 _mesa_light(ctx, i, GL_SPECULAR, l->Specular );
1069 _mesa_light(ctx, i, GL_POSITION, l->EyePosition);
1070 _mesa_light(ctx, i, GL_SPOT_DIRECTION, l->SpotDirection);
1074 _mesa_light(ctx, i, GL_SPOT_EXPONENT, p);
1079 _mesa_light(ctx, i, GL_SPOT_CUTOFF, p);
1084 _mesa_light(ctx, i, GL_CONSTANT_ATTENUATION, p);
1089 _mesa_light(ctx, i, GL_LINEAR_ATTENUATION, p);
1094 _mesa_light(ctx, i, GL_QUADRATIC_ATTENUATION, p);
1111 _mesa_set_enable(ctx, GL_COLOR_MATERIAL,
1114 memcpy(&ctx->Light.Material, &light->Material,
1123 _mesa_set_enable(ctx, GL_LINE_SMOOTH, line->SmoothFlag);
1124 _mesa_set_enable(ctx, GL_LINE_STIPPLE, line->StippleFlag);
1130 memcpy( &ctx->List, attr->data, sizeof(struct gl_list_attrib) );
1133 memcpy( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) );
1135 _mesa_ReadBuffer(ctx->Pixel.ReadBuffer);
1136 ctx->NewState |= _NEW_PIXEL;
1143 _mesa_set_enable(ctx, GL_POINT_SMOOTH, point->SmoothFlag);
1144 if (ctx->Extensions.EXT_point_parameters) {
1154 if (ctx->Extensions.NV_point_sprite
1155 || ctx->Extensions.ARB_point_sprite) {
1157 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
1161 _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite);
1162 if (ctx->Extensions.NV_point_sprite)
1164 ctx->Point.SpriteRMode);
1166 if ((ctx->API == API_OPENGL && ctx->Version >= 20)
1167 || ctx->API == API_OPENGL_CORE)
1169 (GLfloat)ctx->Point.SpriteOrigin);
1183 _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, polygon->SmoothFlag);
1184 _mesa_set_enable(ctx
1185 _mesa_set_enable(ctx, GL_CULL_FACE, polygon->CullFlag);
1186 _mesa_set_enable(ctx, GL_POLYGON_OFFSET_POINT,
1188 _mesa_set_enable(ctx, GL_POLYGON_OFFSET_LINE,
1190 _mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL,
1195 memcpy( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) );
1196 ctx->NewState |= _NEW_POLYGONSTIPPLE;
1197 if (ctx->Driver.PolygonStipple)
1198 ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data );
1206 _mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->Enabled);
1213 _mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled);
1215 if (ctx->Extensions.EXT_stencil_two_side) {
1216 _mesa_set_enable(ctx, GL_STENCIL_TEST_TWO_SIDE_EXT,
1247 if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top))
1248 _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
1251 for (i = 0; i < ctx->Const.MaxClipPlanes; i++) {
1254 COPY_4V(ctx->Transform.EyeUserPlane[i], eyePlane);
1255 _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i,
1257 if (ctx->Driver.ClipPlane)
1258 ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, eyePlane );
1262 if (xform->Normalize != ctx->Transform.Normalize)
1263 _mesa_set_enable(ctx, GL_NORMALIZE,ctx->Transform.Normalize);
1264 if (xform->RescaleNormals != ctx->Transform.RescaleNormals)
1265 _mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT,
1266 ctx->Transform.RescaleNormals);
1267 if (xform->DepthClamp != ctx->Transform.DepthClamp)
1268 _mesa_set_enable(ctx, GL_DEPTH_CLAMP,
1269 ctx->Transform.DepthClamp);
1276 pop_texture_group(ctx, texstate);
1277 ctx->NewState |= _NEW_TEXTURE;
1293 TEST_AND_UPDATE(ctx->Multisample.Enabled,
1297 TEST_AND_UPDATE(ctx->Multisample.SampleCoverage,
1301 TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage,
1305 TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne,
1315 _mesa_problem( ctx, "Bad attrib flag in PopAttrib");
1332 copy_pixelstore(struct gl_context *ctx,
1345 _mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj);
1357 copy_array_object(struct gl_context *ctx,
1370 _mesa_copy_client_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]);
1382 copy_array_attrib(struct gl_context *ctx,
1398 copy_array_object(ctx, dest->ArrayObj, src->ArrayObj);
1408 save_array_attrib(struct gl_context *ctx,
1416 copy_array_attrib(ctx, dest, src, false);
1419 _mesa_reference_buffer_object(ctx, &dest->ArrayBufferObj,
1421 _mesa_reference_buffer_object(ctx, &dest->ArrayObj->ElementArrayBufferObj,
1429 restore_array_attrib(struct gl_context *ctx,
1458 copy_array_attrib(ctx, dest, src, false);
1463 copy_array_attrib(ctx, dest, src, true);
1478 init_array_attrib_data(struct gl_context *ctx,
1483 _mesa_initialize_array_object(ctx, attrib->ArrayObj, 0);
1492 free_array_attrib_data(struct gl_context *ctx,
1497 _mesa_delete_array_object(ctx, attrib->ArrayObj);
1499 _mesa_reference_buffer_object(ctx, &attrib->ArrayBufferObj, NULL);
1508 GET_CURRENT_CONTEXT(ctx);
1509 ASSERT_OUTSIDE_BEGIN_END(ctx);
1511 if (ctx->ClientAttribStackDepth >= MAX_CLIENT_ATTRIB_STACK_DEPTH) {
1512 _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" );
1525 copy_pixelstore(ctx, attr, &ctx->Pack);
1529 copy_pixelstore(ctx, attr, &ctx->Unpack);
1536 init_array_attrib_data(ctx, attr);
1537 save_array_attrib(ctx, attr, &ctx->Array);
1541 ctx->ClientAttribStack[ctx->ClientAttribStackDepth] = head;
1542 ctx->ClientAttribStackDepth++;
1553 GET_CURRENT_CONTEXT(ctx);
1554 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
1556 if (ctx->ClientAttribStackDepth == 0) {
1557 _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" );
1561 ctx->ClientAttribStackDepth--;
1562 node = ctx->ClientAttribStack[ctx->ClientAttribStackDepth];
1570 copy_pixelstore(ctx, &ctx->Pack, store);
1571 _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL);
1573 ctx->NewState |= _NEW_PACKUNPACK;
1579 copy_pixelstore(ctx, &ctx->Unpack, store);
1580 _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL);
1582 ctx->NewState |= _NEW_PACKUNPACK;
1587 restore_array_attrib(ctx, &ctx->Array, attr);
1588 free_array_attrib_data(ctx, attr);
1589 ctx->NewState |= _NEW_ARRAY;
1593 _mesa_problem( ctx, "Bad attrib flag in PopClientAttrib");
1622 _mesa_free_attrib_data(struct gl_context *ctx)
1624 while (ctx->AttribStackDepth > 0) {
1627 ctx->AttribStackDepth--;
1628 attr = ctx->AttribStack[ctx->AttribStackDepth];
1635 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
1640 _mesa_reference_shared_state(ctx, &texstate->SharedRef, NULL);
1655 void _mesa_init_attrib( struct gl_context *ctx )
1658 ctx->AttribStackDepth = 0;
1659 ctx->ClientAttribStackDepth = 0;