From: Brian Paul Date: Thu, 22 Apr 2010 14:46:46 +0000 (-0600) Subject: mesa: fix conversion errors in signed_rgba8888[rev] texel fetch X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d7ef6e06b45c75bc24f8f238bcc3d2328e53c7d;p=mesa.git mesa: fix conversion errors in signed_rgba8888[rev] texel fetch Without the cast the returned texel colors were wrong. Also, we don't need the "& 0xff" part anymore. Bug found by Vinson Lee. --- diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index e6772c89f36..b11ed5c39a3 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -1215,10 +1215,10 @@ static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s >> 24) ); - texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff ); - texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 8) & 0xff ); - texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s ) & 0xff ); + texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) ); + texel[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) ); + texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) ); + texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) ); } #if DIM == 3 @@ -1235,10 +1235,10 @@ static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s ) & 0xff ); - texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 8) & 0xff ); - texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff ); - texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s >> 24) ); + texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) ); + texel[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) ); + texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) ); + texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) ); } #if DIM == 3