pan/mdg: Implement condense_writemask for 8-bit

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5151>
This commit is contained in:
Alyssa Rosenzweig 2020-05-14 13:29:54 -04:00 committed by Marge Bot
parent f768cb04ed
commit ca48143ec4

View file

@ -56,8 +56,17 @@ static inline unsigned
condense_writemask(unsigned expanded_mask,
unsigned bits_per_component)
{
if (bits_per_component == 8)
unreachable("XXX TODO: sort out how 8-bit constant encoding works");
if (bits_per_component == 8) {
/* Duplicate every bit to go from 8 to 16-channel wrmask */
unsigned omask = 0;
for (unsigned i = 0; i < 8; ++i) {
if (expanded_mask & (1 << i))
omask |= (3 << (2 * i));
}
return omask;
}
unsigned slots_per_component = bits_per_component / 16;
unsigned max_comp = (16 * 8) / bits_per_component;