texel[GCOMP] =
texel[BCOMP] = 0.0F;
texel[ACOMP] = table[index];
- break;;
+ break;
case GL_LUMINANCE:
texel[RCOMP] =
texel[GCOMP] =
texel[GCOMP] =
texel[BCOMP] =
texel[ACOMP] = table[index];
- break;;
+ break;
case GL_LUMINANCE_ALPHA:
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = table[index * 2 + 0];
texel[ACOMP] = table[index * 2 + 1];
- break;;
+ break;
case GL_RGB:
texel[RCOMP] = table[index * 3 + 0];
texel[GCOMP] = table[index * 3 + 1];
texel[BCOMP] = table[index * 3 + 2];
texel[ACOMP] = 1.0F;
- break;;
+ break;
case GL_RGBA:
texel[RCOMP] = table[index * 4 + 0];
texel[GCOMP] = table[index * 4 + 1];
texel[BCOMP] = table[index * 4 + 2];
texel[ACOMP] = table[index * 4 + 3];
- break;;
+ break;
default:
_mesa_problem(ctx, "Bad palette format in fetch_texel_ci8");
return;
#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
{
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