diff options
author | Jason Ekstrand <[email protected]> | 2014-08-22 20:32:27 -0700 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2015-01-12 11:20:27 +0100 |
commit | 96fe6191cb8c61ca5ae7c49f54db83f3b44ed126 (patch) | |
tree | 2fb827970e9532c18d18be63c5b7a60602612f96 /src/mesa/swrast/s_texfetch_tmp.h | |
parent | 3e4669a8f3f61dab54faf1ae8512569bca1e54da (diff) |
mesa: Fix A1R5G5B5 packing/unpacking
As with B5G6R5, these have been left broken with comments saying they are.
Signed-off-by: Jason Ekstrand <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/swrast/s_texfetch_tmp.h')
-rw-r--r-- | src/mesa/swrast/s_texfetch_tmp.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h index 23db48d969e..e3a3cfe361a 100644 --- a/src/mesa/swrast/s_texfetch_tmp.h +++ b/src/mesa/swrast/s_texfetch_tmp.h @@ -482,10 +482,10 @@ FETCH(A1R5G5B5_UNORM)(const struct swrast_texture_image *texImage, { const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */ - texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) ); - texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) ); - texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); - texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 ); + texel[RCOMP] = ((s >> 1) & 0x1f) * (1.0F / 31.0F); + texel[GCOMP] = ((s >> 6) & 0x1f) * (1.0F / 31.0F); + texel[BCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F); + texel[ACOMP] = ((s ) & 0x01) * 1.0F; } |