Module: Mesa
Branch: main
Commit: 8f446322e1bdd7d4350138e5bd7fcd3a3ff05ab6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f446322e1bdd7d4350138e5bd7fcd3a3ff05ab6

Author: Erik Faye-Lund <[email protected]>
Date:   Thu Aug 11 16:12:00 2022 +0200

mesa/st: do not use memcpy when using compressed fallback

If we're using the memcpy-path, we don't update the compressed image,
which will be needed if an application try to download the texture-image
again afterwards.

This isn't a problem yet, because none of the current compressed formats
with fallback are copyable as per the OpenGL 4.6 Core spec, table 8.14.
However, this is about to change, when we introduce fallback for BPTC
formats.

Acked-by: Marek Olšák <[email protected]>
Acked-by: Soroush Kashani <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>

---

 src/mesa/state_tracker/st_cb_texture.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index b753db0c192..f05a9788302 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2015,7 +2015,8 @@ 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)) {
+                             mesa_src_format, format, type, unpack) ||
+       st_compressed_format_fallback(st, texImage->TexFormat)) {
       goto fallback;
    }
 

Reply via email to