save->PolygonCull = ctx->Polygon.CullFlag;
_mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL);
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, GL_FALSE);
- _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, GL_FALSE);
- _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, GL_FALSE);
+ if (ctx->API == API_OPENGL) {
+ _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, GL_FALSE);
+ _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, GL_FALSE);
+ }
_mesa_set_enable(ctx, GL_CULL_FACE, GL_FALSE);
}
}
if (state & MESA_META_SHADER) {
- if (ctx->Extensions.ARB_vertex_program) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_vertex_program) {
save->VertexProgramEnabled = ctx->VertexProgram.Enabled;
_mesa_reference_vertprog(ctx, &save->VertexProgram,
ctx->VertexProgram.Current);
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE);
}
- if (ctx->Extensions.ARB_fragment_program) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_fragment_program) {
save->FragmentProgramEnabled = ctx->FragmentProgram.Enabled;
_mesa_reference_fragprog(ctx, &save->FragmentProgram,
ctx->FragmentProgram.Current);
save->EnvMode = ctx->Texture.Unit[0].EnvMode;
/* Disable all texture units */
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled;
- save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled;
- if (ctx->Texture.Unit[u].Enabled ||
- ctx->Texture.Unit[u].TexGenEnabled) {
- _mesa_ActiveTextureARB(GL_TEXTURE0 + u);
- _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
- if (ctx->Extensions.ARB_texture_cube_map)
- _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
- if (ctx->Extensions.NV_texture_rectangle)
- _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
- if (ctx->Extensions.OES_EGL_image_external)
- _mesa_set_enable(ctx, GL_TEXTURE_EXTERNAL_OES, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled;
+ save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled;
+ if (ctx->Texture.Unit[u].Enabled ||
+ ctx->Texture.Unit[u].TexGenEnabled) {
+ _mesa_ActiveTextureARB(GL_TEXTURE0 + u);
+ _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
+ if (ctx->Extensions.ARB_texture_cube_map)
+ _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
+ if (ctx->Extensions.NV_texture_rectangle)
+ _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
+ if (ctx->Extensions.OES_EGL_image_external)
+ _mesa_set_enable(ctx, GL_TEXTURE_EXTERNAL_OES, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
+ }
}
}
/* set defaults for unit[0] */
_mesa_ActiveTextureARB(GL_TEXTURE0);
_mesa_ClientActiveTextureARB(GL_TEXTURE0);
- _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ }
}
if (state & MESA_META_TRANSFORM) {
void
_mesa_meta_end(struct gl_context *ctx)
{
- struct save_state *save = &ctx->Meta->Save[--ctx->Meta->SaveStackDepth];
+ struct save_state *save = &ctx->Meta->Save[ctx->Meta->SaveStackDepth - 1];
const GLbitfield state = save->SavedState;
if (state & MESA_META_ALPHA_TEST) {
if (state & MESA_META_RASTERIZATION) {
_mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode);
_mesa_PolygonMode(GL_BACK, save->BackPolygonMode);
- _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, save->PolygonStipple);
+ if (ctx->API == API_OPENGL) {
+ _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, save->PolygonStipple);
+ _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, save->PolygonSmooth);
+ }
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, save->PolygonOffset);
- _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, save->PolygonSmooth);
_mesa_set_enable(ctx, GL_CULL_FACE, save->PolygonCull);
}
}
if (state & MESA_META_SHADER) {
- if (ctx->Extensions.ARB_vertex_program) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_vertex_program) {
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB,
save->VertexProgramEnabled);
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
_mesa_reference_vertprog(ctx, &save->VertexProgram, NULL);
}
- if (ctx->Extensions.ARB_fragment_program) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_fragment_program) {
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB,
save->FragmentProgramEnabled);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
_mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled);
_mesa_ClearStencil(stencil->Clear);
- if (ctx->Extensions.EXT_stencil_two_side) {
+ if (ctx->API == API_OPENGL && ctx->Extensions.EXT_stencil_two_side) {
_mesa_set_enable(ctx, GL_STENCIL_TEST_TWO_SIDE_EXT,
stencil->TestTwoSide);
_mesa_ActiveStencilFaceEXT(stencil->ActiveFace
ASSERT(ctx->Texture.CurrentUnit == 0);
/* restore texenv for unit[0] */
- _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, save->EnvMode);
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, save->EnvMode);
+ }
/* restore texture objects for unit[0] only */
for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
}
/* Restore fixed function texture enables, texgen */
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- if (ctx->Texture.Unit[u].Enabled != save->TexEnabled[u]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- ctx->Texture.Unit[u].Enabled = save->TexEnabled[u];
- }
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
+ if (ctx->Texture.Unit[u].Enabled != save->TexEnabled[u]) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.Unit[u].Enabled = save->TexEnabled[u];
+ }
- if (ctx->Texture.Unit[u].TexGenEnabled != save->TexGenEnabled[u]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- ctx->Texture.Unit[u].TexGenEnabled = save->TexGenEnabled[u];
- }
+ if (ctx->Texture.Unit[u].TexGenEnabled != save->TexGenEnabled[u]) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ ctx->Texture.Unit[u].TexGenEnabled = save->TexGenEnabled[u];
+ }
+ }
}
/* restore current unit state */
if (save->TransformFeedbackNeedsResume)
_mesa_ResumeTransformFeedback();
#endif
+
+ ctx->Meta->SaveStackDepth--;
}
_mesa_SamplerParameteri(sampler, GL_TEXTURE_SRGB_DECODE_EXT,
GL_SKIP_DECODE_EXT);
}
- if (ctx->Extensions.EXT_framebuffer_sRGB) {
+ if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_framebuffer_sRGB
+ || _mesa_is_gles3(ctx)) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
}
}
/* No sRGB decode or encode.*/
- if (ctx->Extensions.EXT_framebuffer_sRGB) {
+ if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_framebuffer_sRGB
+ || _mesa_is_gles3(ctx)) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
}