meta/blit: Check the values instead of the target before restoring
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 13 Jan 2016 01:37:02 +0000 (17:37 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 3 Jan 2018 00:23:50 +0000 (16:23 -0800)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/mesa/drivers/common/meta_blit.c

index 7adad469aceb072cb399d0e9aade22d8e7acc0f8..6322b64696d70837e3bf43eac2b457accdbdfd77 100644 (file)
@@ -843,13 +843,17 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum 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 (target != GL_TEXTURE_RECTANGLE_ARB) {
+   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) {