Re: [Mesa-dev] [PATCH] format_utils: Use a more precise conversion when decreasing bits

2015-01-14 Thread Neil Roberts
Neil Roberts writes: > + assert(src_bits + dst_bits <= sizeof(x) * 8); Erm, actually I didn't realise there were places calling this with dst_bits set to 32, so this isn't going to work. I probably should have waited for Piglit to finish before sending the patch. Sorry. - Neil

[Mesa-dev] [PATCH] format_utils: Use a more precise conversion when decreasing bits

2015-01-14 Thread Neil Roberts
When converting to a format that has fewer bits the previous code was just shifting off the bits. This doesn't provide very accurate results. For example when converting from 8 bits to 5 bits it is equivalent to doing this: x * 32 / 256 This works as if it's taking a value from a range where 256