Module: Mesa
Branch: master
Commit: bceb5f36ec9a8fdda515102c3e52f41aa6cad1c5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bceb5f36ec9a8fdda515102c3e52f41aa6cad1c5

Author: Roland Scheidegger <srol...@vmware.com>
Date:   Mon Jul 22 21:02:56 2013 +0200

mesa: fix rgtc snorm decoding

The codeword must be unsigned (otherwise will shift in 1's from above when
merging low/high parts so some texels decode wrong).
This also affects gallium's util/u_format_rgtc.

Reviewed-by: Jose Fonseca <jfons...@vmware.com>
Reviewed-by: Zack Rusin <za...@vmware.com>

---

 src/mesa/main/texcompress_rgtc_tmp.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/texcompress_rgtc_tmp.h 
b/src/mesa/main/texcompress_rgtc_tmp.h
index 277d69b..5fa9de6 100644
--- a/src/mesa/main/texcompress_rgtc_tmp.h
+++ b/src/mesa/main/texcompress_rgtc_tmp.h
@@ -37,9 +37,9 @@ static void TAG(fetch_texel_rgtc)(unsigned srcRowStride, 
const TYPE *pixdata,
    const TYPE alpha0 = blksrc[0];
    const TYPE alpha1 = blksrc[1];
    const char bit_pos = ((j&3) * 4 + (i&3)) * 3;
-   const TYPE acodelow = blksrc[2 + bit_pos / 8];
-   const TYPE acodehigh = (3 + bit_pos / 8) < 8 ? blksrc[3 + bit_pos / 8] : 0;
-   const TYPE code = (acodelow >> (bit_pos & 0x7) |
+   const unsigned char acodelow = blksrc[2 + bit_pos / 8];
+   const unsigned char acodehigh = (3 + bit_pos / 8) < 8 ? blksrc[3 + bit_pos 
/ 8] : 0;
+   const unsigned char code = (acodelow >> (bit_pos & 0x7) |
       (acodehigh  << (8 - (bit_pos & 0x7)))) & 0x7;
 
    if (code == 0)

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to