summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-01-12 17:39:54 -0800
committerIan Romanick <[email protected]>2018-01-02 16:23:51 -0800
commit9de64d0baa0d4404721aa09fd665252b759a8f28 (patch)
treee5af4c6deb78c2ce1b735d507c3e04101978a832 /src/mesa/drivers
parenta232df15235ca0e7d4c36762cfb5b51038d71849 (diff)
meta/blit: Don't restore state of the temporary texture
It's about to be destroyed, so there's no point. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-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);