<p dir="ltr"><br>
On Oct 7, 2014 12:04 PM, "Iago Toral Quiroga" <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> wrote:<br>
><br>
> There is a comment warning about the fact that this is not doing what we<br>
> expect, so fix it. This should be doing the same as unpack_B5G6R5_UNORM<br>
> but swapping B and R.<br>
> ---<br>
><br>
> Jason started some work to auto-generate the format_pack.c and<br>
> format_unpack.c files which I think has this fixed. I am continuing his<br>
> work on this at the moment, but I guess it might make sense to fix this in<br>
> the current code too while that work is on-going.</p>
<p dir="ltr">Not much time to reply right now, but I seem to recall there being a bit more to fix here. What about packing and swrast's texel fetch implementation. Are those OK for this format?</p>
<p dir="ltr">> No piglit regressions observed.</p>
<p dir="ltr">On what drivers? It might be good to test on swrast and llvmpipe. I'm not super-concerned there but we should at least try not to break it.<br>
--Jason</p>
<p dir="ltr">><br>
> src/mesa/main/format_unpack.c | 10 +++-------<br>
> 1 file changed, 3 insertions(+), 7 deletions(-)<br>
><br>
> diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c<br>
> index d5628a9..11b028c 100644<br>
> --- a/src/mesa/main/format_unpack.c<br>
> +++ b/src/mesa/main/format_unpack.c<br>
> @@ -207,16 +207,12 @@ unpack_B5G6R5_UNORM(const void *src, GLfloat dst[][4], GLuint n)<br>
> static void<br>
> unpack_R5G6B5_UNORM(const void *src, GLfloat dst[][4], GLuint n)<br>
> {<br>
> - /* Warning: this function does not match the current Mesa definition<br>
> - * of MESA_FORMAT_R5G6B5_UNORM.<br>
> - */<br>
> const GLushort *s = ((const GLushort *) src);<br>
> GLuint i;<br>
> for (i = 0; i < n; i++) {<br>
> - GLuint t = (s[i] >> 8) | (s[i] << 8); /* byte swap */<br>
> - dst[i][RCOMP] = UBYTE_TO_FLOAT( ((t >> 8) & 0xf8) | ((t >> 13) & 0x7) );<br>
> - dst[i][GCOMP] = UBYTE_TO_FLOAT( ((t >> 3) & 0xfc) | ((t >> 9) & 0x3) );<br>
> - dst[i][BCOMP] = UBYTE_TO_FLOAT( ((t << 3) & 0xf8) | ((t >> 2) & 0x7) );<br>
> + dst[i][RCOMP] = ((s[i] ) & 0x1f) * (1.0F / 31.0F);<br>
> + dst[i][GCOMP] = ((s[i] >> 5 ) & 0x3f) * (1.0F / 63.0F);<br>
> + dst[i][BCOMP] = ((s[i] >> 11) & 0x1f) * (1.0F / 31.0F);<br>
> dst[i][ACOMP] = 1.0F;<br>
> }<br>
> }<br>
> --<br>
> 1.9.1<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a></p>