mesa/st: do not blit when using compressed fallback
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 31 Aug 2022 13:13:28 +0000 (15:13 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 10:42:40 +0000 (10:42 +0000)
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 <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18342>

src/mesa/state_tracker/st_cb_texture.c

index 7705a31..4ab7569 100644 (file)
@@ -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;
    }