From 6a0886d170da9dc221ea7f8a5fb99f3ef29b494a Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 21 Apr 2017 15:22:14 -0400 Subject: [PATCH] gallivm: fudge channel shift logic on big endian --- src/gallium/auxiliary/gallivm/lp_bld_format_soa.c | 11 ++++++++++- 1 file changed, 10 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 98eb694..fe0dc0d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c @@ -650,7 +650,16 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm, for (i = 0; i < format_desc->nr_channels; i++) { struct util_format_channel_description chan_desc = format_desc->channel[i]; unsigned blockbits = type.width; - unsigned vec_nr = chan_desc.shift / type.width; + unsigned vec_nr; + +#ifdef PIPE_ARCH_BIG_ENDIAN + if ((format_desc->block.bits % 16) == 0 && (format_desc->block.bits % 32) != 0) + vec_nr = (fetch_width - (chan_desc.shift + chan_desc.size)) / type.width; + else + vec_nr = (format_desc->block.bits - (chan_desc.shift + chan_desc.size)) / type.width; +#else + vec_nr = chan_desc.shift / type.width; +#endif chan_desc.shift %= type.width; output[i] = lp_build_extract_soa_chan(&bld, -- 1.8.3.1