From f740af27964ef148de94fd389edf736bb488bfd0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 14 Dec 2020 09:24:58 -0800 Subject: [PATCH] mesa/st: Finalize the texture before BlitFramebuffer from it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the texture hasn't yet been validated, the current tex image contents may have been ignored in favor of the texture's main miptree. Fixes test failure on softpipe and intermittent failures on radeonsi in: https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/428 Cc: mesa-stable Tested-by: Chia-I Wu Reviewed-by: Chia-I Wu Reviewed-by: Marek Olšák Part-of: --- src/mesa/state_tracker/st_cb_blit.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index d91cc9623ac..cf55eff6e5c 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -39,6 +39,7 @@ #include "st_cb_bitmap.h" #include "st_cb_blit.h" #include "st_cb_fbo.h" +#include "st_cb_texture.h" #include "st_manager.h" #include "st_scissor.h" #include "st_util.h" @@ -180,6 +181,12 @@ st_BlitFramebuffer(struct gl_context *ctx, blit.mask = PIPE_MASK_RGBA; if (srcAtt->Type == GL_TEXTURE) { + /* Make sure that the st_texture_object->pt is the current storage for + * our miplevel. The finalize would happen at some point anyway, might + * as well be now. + */ + st_finalize_texture(ctx, st->pipe, srcAtt->Texture, srcAtt->CubeMapFace); + struct st_texture_object *srcObj = st_texture_object(srcAtt->Texture); if (!srcObj || !srcObj->pt) {