summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common/meta_blit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/common/meta_blit.c')
-rw-r--r--src/mesa/drivers/common/meta_blit.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 6322b64696d..66714b1ea5a 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -841,30 +841,36 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
struct gl_texture_object *const texObj =
_mesa_get_current_tex_object(ctx, target);
- /* Restore texture object state, the texture binding will
- * be restored by _mesa_meta_end().
- *
- * If the target restricts values for base level or max level, we assume
- * that the original values were valid.
- */
- if (blit->baseLevelSave != texObj->BaseLevel)
- _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL,
- &blit->baseLevelSave, false);
-
- if (blit->maxLevelSave != texObj->MaxLevel)
- _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL,
- &blit->maxLevelSave, false);
+ /* Either there is no temporary texture or the temporary texture is bound. */
+ assert(blit->tempTex == 0 || texObj->Name == blit->tempTex);
- /* If ARB_stencil_texturing is not supported, the mode won't have changed. */
- if (texObj->StencilSampling != blit->stencilSamplingSave) {
- /* GLint so the compiler won't complain about type signedness mismatch
- * in the call to _mesa_texture_parameteriv below.
+ /* Restore texture object state, the texture binding will be restored by
+ * _mesa_meta_end(). If the texture is the temporary texture that is about
+ * to be destroyed, don't bother restoring its state.
+ */
+ if (blit->tempTex == 0) {
+ /* If the target restricts values for base level or max level, we assume
+ * that the original values were valid.
*/
- const GLint param = blit->stencilSamplingSave ?
- GL_STENCIL_INDEX : GL_DEPTH_COMPONENT;
+ if (blit->baseLevelSave != texObj->BaseLevel)
+ _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_BASE_LEVEL,
+ &blit->baseLevelSave, false);
+
+ if (blit->maxLevelSave != texObj->MaxLevel)
+ _mesa_texture_parameteriv(ctx, texObj, GL_TEXTURE_MAX_LEVEL,
+ &blit->maxLevelSave, false);
+
+ /* If ARB_stencil_texturing is not supported, the mode won't have changed. */
+ if (texObj->StencilSampling != blit->stencilSamplingSave) {
+ /* GLint so the compiler won't complain about type signedness mismatch
+ * in the call to _mesa_texture_parameteriv below.
+ */
+ const GLint param = blit->stencilSamplingSave ?
+ GL_STENCIL_INDEX : GL_DEPTH_COMPONENT;
- _mesa_texture_parameteriv(ctx, texObj, GL_DEPTH_STENCIL_TEXTURE_MODE,
- &param, false);
+ _mesa_texture_parameteriv(ctx, texObj, GL_DEPTH_STENCIL_TEXTURE_MODE,
+ &param, false);
+ }
}
_mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, blit->samp_obj_save);