From 37d6ce4ebb43b9876683e1a7a38ab97634c65879 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 18 Oct 2021 17:14:41 +1000 Subject: [PATCH] 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 Part-of: --- 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: