From d03053688f7370064ded6dfc4912841eae39a4a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 7 Apr 2009 13:17:42 -0600 Subject: mesa: fix incorrect component ordering for sRGB8 texture fetch/store This format is layered on MESA_FORMAT_RGB888 so the component order is actually BGR. Fixes glean pixelFormat failures. --- src/mesa/main/texformat_tmp.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index ef5bb34db6..f3b2fb9c9c 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1164,14 +1164,15 @@ static void store_texel_ci8(struct gl_texture_image *texImage, #if FEATURE_EXT_texture_sRGB /* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */ +/* Note: component order is same as for MESA_FORMAT_RGB888 */ static void FETCH(srgb8)(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); - texel[RCOMP] = nonlinear_to_linear(src[0]); + texel[RCOMP] = nonlinear_to_linear(src[2]); texel[GCOMP] = nonlinear_to_linear(src[1]); - texel[BCOMP] = nonlinear_to_linear(src[2]); - texel[ACOMP] = CHAN_MAX; + texel[BCOMP] = nonlinear_to_linear(src[0]); + texel[ACOMP] = 1.0F; } #if DIM == 3 @@ -1180,9 +1181,9 @@ static void store_texel_srgb8(struct gl_texture_image *texImage, { const GLubyte *rgba = (const GLubyte *) texel; GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); - dst[0] = rgba[RCOMP]; /* no conversion */ + dst[0] = rgba[BCOMP]; /* no conversion */ dst[1] = rgba[GCOMP]; - dst[2] = rgba[BCOMP]; + dst[2] = rgba[RCOMP]; } #endif -- cgit v1.2.3