[Mesa-dev] [PATCH v2 1/5] swrast: Fix handling of MESA_FORMAT_L8A8_SRGB for big-endian

Richard Sandiford rsandifo at linux.vnet.ibm.com
Tue Jul 22 02:51:14 PDT 2014


Luminance is the least-significant byte of the uint16, rather than the
lowest byte in memory.  Other parts of mesa already handle this correctly
for big-endian, and swrast already handles other MESA_FORMAT_x8y8 formats
correctly.  This case was just an odd-one-out.

Signed-off-by: Richard Sandiford <rsandifo at linux.vnet.ibm.com>
---
 src/mesa/swrast/s_texfetch_tmp.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h
index deda592..0fce355 100644
--- a/src/mesa/swrast/s_texfetch_tmp.h
+++ b/src/mesa/swrast/s_texfetch_tmp.h
@@ -808,11 +808,11 @@ static void
 FETCH(L8A8_SRGB)(const struct swrast_texture_image *texImage,
                  GLint i, GLint j, GLint k, GLfloat *texel)
 {
-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
+   const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    texel[RCOMP] =
    texel[GCOMP] =
-   texel[BCOMP] = nonlinear_to_linear(src[0]);
-   texel[ACOMP] = UBYTE_TO_FLOAT(src[1]); /* linear */
+   texel[BCOMP] = nonlinear_to_linear(s & 0xff);
+   texel[ACOMP] = UBYTE_TO_FLOAT(s >> 8); /* linear */
 }
 
 
-- 
1.8.3.1



More information about the mesa-dev mailing list