save->RasterDiscard = ctx->RasterDiscard;
if (ctx->RasterDiscard)
_mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_FALSE);
+
+ save->DrawBufferName = ctx->DrawBuffer->Name;
+ save->ReadBufferName = ctx->ReadBuffer->Name;
+ save->RenderbufferName = (ctx->CurrentRenderbuffer ?
+ ctx->CurrentRenderbuffer->Name : 0);
}
}
if (save->TransformFeedbackNeedsResume)
_mesa_ResumeTransformFeedback();
+ if (ctx->DrawBuffer->Name != save->DrawBufferName)
+ _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, save->DrawBufferName);
+
+ if (ctx->ReadBuffer->Name != save->ReadBufferName)
+ _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, save->ReadBufferName);
+
+ if (!ctx->CurrentRenderbuffer ||
+ ctx->CurrentRenderbuffer->Name != save->RenderbufferName)
+ _mesa_BindRenderbuffer(GL_RENDERBUFFER, save->RenderbufferName);
+
ctx->Meta->SaveStackDepth--;
ctx->API = save->API;
}
}
-
/**
* Helper for _mesa_meta_CopyTexSubImage1/2/3D() functions.
* Have to be careful with locking and meta state for pixel transfer.
const GLenum target = texObj->Target;
GLenum faceTarget;
struct vertex verts[4];
- GLuint fboDrawSave, fboReadSave;
- GLuint rbSave;
GLuint samplerSave;
const bool use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
ctx->Extensions.ARB_fragment_shader;
break;
}
- /* save fbo bindings (not saved by _mesa_meta_begin()) */
- fboDrawSave = ctx->DrawBuffer->Name;
- fboReadSave = ctx->ReadBuffer->Name;
- rbSave = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0;
-
_mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_PIXEL_STORE);
samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
_mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave);
_mesa_meta_end(ctx);
-
- /* restore fbo bindings */
- if (fboDrawSave == fboReadSave) {
- _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboDrawSave);
- }
- else {
- _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, fboDrawSave);
- _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER_EXT, fboReadSave);
- }
- _mesa_BindRenderbuffer(GL_RENDERBUFFER_EXT, rbSave);
}
const GLuint maxLevel = texObj->MaxLevel;
const GLint maxLevelSave = texObj->MaxLevel;
const GLboolean genMipmapSave = texObj->GenerateMipmap;
- const GLuint fboSave = ctx->DrawBuffer->Name;
const GLuint currentTexUnitSave = ctx->Texture.CurrentUnit;
const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
ctx->Extensions.ARB_fragment_shader;
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
if (genMipmapSave)
_mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
-
- _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboSave);
}