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:
parent
960119008b
commit
fbe392d16b
|
@ -1961,7 +1961,7 @@ convert_to_blend_type(struct gallivm_state *gallivm,
|
||||||
#if UTIL_ARCH_LITTLE_ENDIAN
|
#if UTIL_ARCH_LITTLE_ENDIAN
|
||||||
unsigned from_lsb = j;
|
unsigned from_lsb = j;
|
||||||
#else
|
#else
|
||||||
unsigned from_lsb = src_fmt->nr_channels - j - 1;
|
unsigned from_lsb = (blend_type.length / pixels) - j - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mask = (1 << src_fmt->channel[j].size) - 1;
|
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
|
#if UTIL_ARCH_LITTLE_ENDIAN
|
||||||
unsigned from_lsb = j;
|
unsigned from_lsb = j;
|
||||||
#else
|
#else
|
||||||
unsigned from_lsb = src_fmt->nr_channels - j - 1;
|
unsigned from_lsb = blend_type.length - j - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert(blend_type.width > src_fmt->channel[j].size);
|
assert(blend_type.width > src_fmt->channel[j].size);
|
||||||
|
|
Loading…
Reference in New Issue