summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-04-07 13:17:42 -0600
committerBrian Paul <brianp@vmware.com>2009-04-07 13:17:42 -0600
commitd03053688f7370064ded6dfc4912841eae39a4a9 (patch)
tree33f5597614c2a7dd7cea093db40e2b73e85b6886
parent0f0e24f6ef9c3ea44eba21ed3678361dc6c2ae6f (diff)
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.
-rw-r--r--src/mesa/main/texformat_tmp.h11
1 files changed, 6 insertions, 5 deletions
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