Mesa (staging/21.3): mesa/st: always use DXT5 when transcoding ASTC format

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Feb 20 17:40:40 UTC 2022


Module: Mesa
Branch: staging/21.3
Commit: 0fccf7ff7eb3476562c6f6b0c70ebc0f853969e8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0fccf7ff7eb3476562c6f6b0c70ebc0f853969e8

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Tue Feb 15 10:22:15 2022 +0200

mesa/st: always use DXT5 when transcoding ASTC format

This fixes artifacts seen in games when using ASTC transcoding,
we need to use DXT5 for proper alpha channel support.

Number of components is a block specific property, there is no easy
way to see if we will require >1bit alpha support or not, so simply
use DXT5 to have support in place.

Fixes: 91cbe8d855c ("gallium: Add a transcode_astc driconf option")
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15029>
(cherry picked from commit d3b4202b63cb3aca42bc91c5bc416acc1b7f382b)

---

 .pick_status.json                  |  2 +-
 src/mesa/state_tracker/st_format.c | 19 ++++---------------
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 93dedc47c7f..057d4a2d73f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1138,7 +1138,7 @@
         "description": "mesa/st: always use DXT5 when transcoding ASTC format",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "91cbe8d855c19d5e252fe4b29adf2a424c46a23d"
     },
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index fe399561ceb..dbf308ab11f 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -110,23 +110,12 @@ st_mesa_format_to_pipe_format(const struct st_context *st,
    }
 
    if (st_astc_format_fallback(st, mesaFormat)) {
-      const struct util_format_description *desc =
-         util_format_description(mesaFormat);
-
       if (_mesa_is_format_srgb(mesaFormat)) {
-         if (!st->transcode_astc)
-            return PIPE_FORMAT_R8G8B8A8_SRGB;
-         else if (desc->block.width * desc->block.height < 32)
-            return PIPE_FORMAT_DXT5_SRGBA;
-         else
-            return PIPE_FORMAT_DXT1_SRGBA;
+         return st->transcode_astc ? PIPE_FORMAT_DXT5_SRGBA :
+                                     PIPE_FORMAT_R8G8B8A8_SRGB;
       } else {
-         if (!st->transcode_astc)
-            return PIPE_FORMAT_R8G8B8A8_UNORM;
-         else if (desc->block.width * desc->block.height < 32)
-            return PIPE_FORMAT_DXT5_RGBA;
-         else
-            return PIPE_FORMAT_DXT1_RGBA;
+         return st->transcode_astc ? PIPE_FORMAT_DXT5_RGBA :
+                                     PIPE_FORMAT_R8G8B8A8_UNORM;
       }
    }
 



More information about the mesa-commit mailing list