llvmpipe: fix color rendering on big endian.

Some colors were missing/inverted on big endian machine(s390x).
because blend_type.length > src_fmt->nr_channels.
In my case, blend_type has 4 channels (rgba) but src_fmt has only 3.

So the from_lsb was wrong by 1, and channels got messed up.
(blue was always 255, green -> red, and blue -> green).

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6204
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15556>
This commit is contained in:
Jocelyn Falempe 2022-03-24 22:55:05 +01:00 committed by Marge Bot
parent 960119008b
commit fbe392d16b
1 changed files with 2 additions and 2 deletions

View File

@ -1961,7 +1961,7 @@ convert_to_blend_type(struct gallivm_state *gallivm,
#if UTIL_ARCH_LITTLE_ENDIAN
unsigned from_lsb = j;
#else
unsigned from_lsb = src_fmt->nr_channels - j - 1;
unsigned from_lsb = (blend_type.length / pixels) - j - 1;
#endif
mask = (1 << src_fmt->channel[j].size) - 1;
@ -2144,7 +2144,7 @@ convert_from_blend_type(struct gallivm_state *gallivm,
#if UTIL_ARCH_LITTLE_ENDIAN
unsigned from_lsb = j;
#else
unsigned from_lsb = src_fmt->nr_channels - j - 1;
unsigned from_lsb = blend_type.length - j - 1;
#endif
assert(blend_type.width > src_fmt->channel[j].size);