+ texel[RCOMP] = CLAMP(r, 0, CHAN_MAX);
+ texel[GCOMP] = CLAMP(g, 0, CHAN_MAX);
+ texel[BCOMP] = CLAMP(b, 0, CHAN_MAX);
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch color texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats */
+/* We convert YCbCr to RGB here */
+static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
+ const GLushort *src1 = src0 + 1; /* odd */
+ const GLubyte y0 = *src0 & 0xff; /* luminance */
+ const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */
+ const GLubyte y1 = *src1 & 0xff; /* luminance */
+ const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */
+ GLfloat r, g, b;
+ if (i & 1) {
+ /* odd pixel: use y1,cr,cb */
+ r = (1.164 * (y1-16) + 1.596 * (cr-128));
+ g = (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y1-16) + 2.018 * (cb-128));
+ }
+ else {
+ /* even pixel: use y0,cr,cb */
+ r = (1.164 * (y0-16) + 1.596 * (cr-128));
+ g = (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y0-16) + 2.018 * (cb-128));
+ }
+ /* XXX remove / 255 here by tweaking arithmetic above */
+ r /= 255.0;
+ g /= 255.0;
+ b /= 255.0;
+ /* XXX should we really clamp??? */
+ texel[RCOMP] = CLAMP(r, 0.0, 1.0);
+ texel[GCOMP] = CLAMP(g, 0.0, 1.0);
+ texel[BCOMP] = CLAMP(b, 0.0, 1.0);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+#if DIM == 2 /* Only 2D compressed textures possible */
+
+static void FETCH(rgb_fxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+static void FETCH(f_rgb_fxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+static void FETCH(rgba_fxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+static void FETCH(f_rgba_fxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+#endif /* if DIM == 2 */
+
+
+#if DIM == 2 /* only 2D is valid */
+
+static void FETCH(rgb_dxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+static void FETCH(f_rgb_dxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+
+static void FETCH(rgba_dxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+static void FETCH(f_rgba_dxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+
+static void FETCH(rgba_dxt3)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */