Mesa (main): llvmpipe: swizzle image stores for CL BGRA

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 19 03:35:10 UTC 2021


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

Author: Dave Airlie <airlied at gmail.com>
Date:   Mon Oct 18 17:14:41 2021 +1000

llvmpipe: swizzle image stores for CL BGRA

OpenCL requires image stores to BGRA to work, so add the swizzle
code here.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13404>

---

 src/gallium/auxiliary/gallivm/lp_bld_format_soa.c | 6 +++++-
 src/gallium/drivers/llvmpipe/lp_screen.c          | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
index bedc8f87b7c..8e57a5e349e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
@@ -987,6 +987,7 @@ lp_build_pack_rgba_soa(struct gallivm_state *gallivm,
 {
    unsigned chan;
    struct lp_build_context bld;
+   LLVMValueRef rgba_swiz[4];
    assert(format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
    assert(format_desc->block.width == 1);
    assert(format_desc->block.height == 1);
@@ -995,13 +996,16 @@ lp_build_pack_rgba_soa(struct gallivm_state *gallivm,
    assert(type.width == 32);
 
    lp_build_context_init(&bld, gallivm, type);
+
+   lp_build_format_swizzle_soa(format_desc, &bld, rgba_in, rgba_swiz);
+
    for (chan = 0; chan < format_desc->nr_channels; ++chan) {
       struct util_format_channel_description chan_desc = format_desc->channel[chan];
 
       lp_build_insert_soa_chan(&bld, format_desc->block.bits,
                                chan_desc,
                                packed,
-                               rgba_in[chan]);
+                               rgba_swiz[chan]);
    }
 }
 
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 4e0756463ba..dc9ffce97e2 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -728,6 +728,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
          case PIPE_FORMAT_R8G8_SNORM:
          case PIPE_FORMAT_R16_SNORM:
          case PIPE_FORMAT_R8_SNORM:
+         case PIPE_FORMAT_B8G8R8A8_UNORM:
             break;
 
          default:



More information about the mesa-commit mailing list