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

Author: Erik Faye-Lund <erik.faye-l...@collabora.com>
Date:   Tue Nov 14 15:19:42 2023 +0100

panfrost: do not handle NONE-swizzle

Neigher PIPE_SWIZZLE_NONE nor PIPE_SWIZZLE_MAX are legal here, so let's
not even try to handle it. If we ever get either here, we're triggering
a bug anyway.

Reviewed-by: Boris Brezillon <boris.brezil...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26192>

---

 src/panfrost/lib/pan_util.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/panfrost/lib/pan_util.c b/src/panfrost/lib/pan_util.c
index ee0ed615c60..baaee5f728f 100644
--- a/src/panfrost/lib/pan_util.c
+++ b/src/panfrost/lib/pan_util.c
@@ -35,9 +35,8 @@ panfrost_translate_swizzle_4(const unsigned char swizzle[4])
    unsigned out = 0;
 
    for (unsigned i = 0; i < 4; ++i) {
-      unsigned translated =
-         (swizzle[i] > PIPE_SWIZZLE_1) ? PIPE_SWIZZLE_0 : swizzle[i];
-      out |= (translated << (3 * i));
+      assert(swizzle[i] <= PIPE_SWIZZLE_1);
+      out |= (swizzle[i] << (3 * i));
    }
 
    return out;

Reply via email to