From 9de64d0baa0d4404721aa09fd665252b759a8f28 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 12 Jan 2016 17:39:54 -0800 Subject: meta/blit: Don't restore state of the temporary texture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's about to be destroyed, so there's no point. Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta_blit.c | 48 +++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'src/mesa/drivers/common') 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, - ¶m, false); + _mesa_texture_parameteriv(ctx, texObj, GL_DEPTH_STENCIL_TEXTURE_MODE, + ¶m, false); + } } _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, blit->samp_obj_save); -- cgit v1.2.3