mesa: fixes for srgb formats

swizzling in fetch/store srgba/sargb functions fixed (consistent with
equivalent non-srgb formats now).
This commit is contained in:
Roland Scheidegger
2009-02-09 23:10:16 +01:00
committed by Roland Scheidegger
parent cb3c54ea86
commit 93da69def4
+14 -20
View File
@@ -1223,11 +1223,11 @@ static void store_texel_srgb8(struct gl_texture_image *texImage,
static void FETCH(srgba8)(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
texel[RCOMP] = nonlinear_to_linear(src[0]);
texel[GCOMP] = nonlinear_to_linear(src[1]);
texel[BCOMP] = nonlinear_to_linear(src[2]);
texel[ACOMP] = UBYTE_TO_FLOAT(src[3]); /* linear! */
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s >> 24) );
texel[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
texel[BCOMP] = nonlinear_to_linear( (s >> 8) & 0xff );
texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); /* linear! */
}
#if DIM == 3
@@ -1235,11 +1235,8 @@ static void store_texel_srgba8(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
dst[0] = rgba[RCOMP];
dst[1] = rgba[GCOMP];
dst[2] = rgba[BCOMP];
dst[3] = rgba[ACOMP];
GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
*dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
}
#endif
@@ -1247,11 +1244,11 @@ static void store_texel_srgba8(struct gl_texture_image *texImage,
static void FETCH(sargb8)(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
texel[RCOMP] = nonlinear_to_linear(src[1]);
texel[GCOMP] = nonlinear_to_linear(src[2]);
texel[BCOMP] = nonlinear_to_linear(src[3]);
texel[ACOMP] = UBYTE_TO_FLOAT(src[0]); /* linear! */
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
texel[GCOMP] = nonlinear_to_linear( (s >> 8) & 0xff );
texel[BCOMP] = nonlinear_to_linear( (s ) & 0xff );
texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); /* linear! */
}
#if DIM == 3
@@ -1259,11 +1256,8 @@ static void store_texel_sargb8(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLubyte *rgba = (const GLubyte *) texel;
GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
dst[0] = rgba[ACOMP];
dst[1] = rgba[RCOMP];
dst[2] = rgba[GCOMP];
dst[3] = rgba[BCOMP];
GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
*dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
}
#endif