Module: Mesa Branch: main Commit: fbbe00c0b7f7aa5aca42a82358332eb2de56b9af URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fbbe00c0b7f7aa5aca42a82358332eb2de56b9af
Author: Boris Brezillon <[email protected]> Date: Mon Sep 20 12:39:12 2021 +0200 panfrost: Use an identity swizzle for RAW formats When the render target format is raw, the swizzle is ignored. Let's set it to identity to avoid misleading the pandecode reader into thinking the swizzle is applied. Signed-off-by: Boris Brezillon <[email protected]> Suggested-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12793> --- src/panfrost/lib/pan_cs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c index 33461361412..709f2a47693 100644 --- a/src/panfrost/lib/pan_cs.c +++ b/src/panfrost/lib/pan_cs.c @@ -373,10 +373,9 @@ pan_rt_init_format(const struct pan_image_view *rt, /* The swizzle for rendering is inverted from texturing */ - unsigned char swizzle[4]; - panfrost_invert_swizzle(desc->swizzle, swizzle); - - cfg->swizzle = panfrost_translate_swizzle_4(swizzle); + unsigned char swizzle[4] = { + PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W, + }; /* Fill in accordingly, defaulting to 8-bit UNORM */ @@ -388,6 +387,7 @@ pan_rt_init_format(const struct pan_image_view *rt, if (fmt.internal) { cfg->internal_format = fmt.internal; cfg->writeback_format = fmt.writeback; + panfrost_invert_swizzle(desc->swizzle, swizzle); } else { /* Construct RAW internal/writeback, where internal is * specified logarithmically (round to next power-of-two). @@ -402,6 +402,8 @@ pan_rt_init_format(const struct pan_image_view *rt, cfg->writeback_format = pan_mfbd_raw_format(bits); } + + cfg->swizzle = panfrost_translate_swizzle_4(swizzle); } static void
