mesa: data structure updates for GL_EXT_provoking_vertex
[mesa.git] / src / mesa / main / texformat_tmp.h
index d0d38046082b0ef9d7523257b40f812195db2ac5..f3b2fb9c9c4bea87d7f1eef52fc14057b6c4fd3c 100644 (file)
@@ -1112,7 +1112,7 @@ static void FETCH(f_ci8)( const struct gl_texture_image *texImage,
          texel[GCOMP] =
          texel[BCOMP] = 0.0F;
          texel[ACOMP] = table[index];
-         break;;
+         break;
       case GL_LUMINANCE:
          texel[RCOMP] =
          texel[GCOMP] =
@@ -1124,25 +1124,25 @@ static void FETCH(f_ci8)( const struct gl_texture_image *texImage,
          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;
@@ -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