From d01cbced85211bfd3141f5ccf8c46106bdd1bdcc Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 31 Aug 2022 15:13:28 +0200 Subject: [PATCH] mesa/st: do not blit when using compressed fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we're using the blit-path, we don't update the compressed image, which will be needed if an application try to download the texture-image again afterwards. I previously fixed this for the memcpy-codepath, but we actually need to fall back for the blit code-path as well. So let's move this early-out earlier to catch both. Fixes: 8f446322e1b ("mesa/st: do not use memcpy when using compressed fallback") Reviewed-by: Marek Olšák Part-of: --- src/mesa/state_tracker/st_cb_texture.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 7705a315220..4ab756957c5 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1991,6 +1991,11 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims, goto fallback; } + /* We need both the compressed and non-compressed textures updated, + * which neither the PBO nor memcpy code-paths does */ + if (st_compressed_format_fallback(st, texImage->TexFormat)) { + goto fallback; + } /* See if the destination format is supported. */ if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL) @@ -2040,8 +2045,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims, * etc. */ if (!_mesa_texstore_can_use_memcpy(ctx, _mesa_get_format_base_format(mesa_src_format), - mesa_src_format, format, type, unpack) || - st_compressed_format_fallback(st, texImage->TexFormat)) { + mesa_src_format, format, type, unpack)) { goto fallback; }