mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
pan/clear: Stop packing undefined bits in colors
The util code doesn't actually fill things with zeros so the high bits
are undefined. If we really want things replicated, we need to mask off
just the bits we care about.
Cc: mesa-stable
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Eric R. Smith <eric.smith@collabora.com>
(cherry picked from commit 4d8551552e)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
parent
61f09295f3
commit
897f5814ed
2 changed files with 9 additions and 7 deletions
|
|
@ -1504,7 +1504,7 @@
|
|||
"description": "pan/clear: Stop packing undefined bits in colors",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -84,13 +84,15 @@ pan_pack_raw(uint32_t *packed, const union pipe_color_union *color,
|
|||
util_pack_color(color->f, format, &out);
|
||||
|
||||
if (size == 1) {
|
||||
unsigned s = out.ui[0] | (out.ui[0] << 8);
|
||||
pan_pack_color_32(packed, s | (s << 16));
|
||||
} else if (size == 2)
|
||||
pan_pack_color_32(packed, out.ui[0] | (out.ui[0] << 16));
|
||||
else if (size <= 4)
|
||||
unsigned b = out.ui[0] & 0xff;
|
||||
unsigned w = b | (b << 8);
|
||||
pan_pack_color_32(packed, w | (w << 16));
|
||||
} else if (size == 2) {
|
||||
unsigned w = out.ui[0] & 0xffff;
|
||||
pan_pack_color_32(packed, w | (w << 16));
|
||||
} else if (size <= 4) {
|
||||
pan_pack_color_32(packed, out.ui[0]);
|
||||
else if (size <= 8) {
|
||||
} else if (size <= 8) {
|
||||
memcpy(packed + 0, out.ui, 8);
|
||||
memcpy(packed + 2, out.ui, 8);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue