radeon: Fix memory leak in radeonCreateScreen2.
[mesa.git] / src / mesa / swrast / s_texfetch_tmp.h
index dbed3dba99b4a574333eb770caef7440b4e92ed6..b65d33f0410d22783206a9926dc61b97ec7b41f3 100644 (file)
@@ -43,7 +43,7 @@
 #if DIM == 1
 
 #define TEXEL_ADDR( type, image, i, j, k, size ) \
-       ((void) (j), (void) (k), ((type *)(image)->Data + (i) * (size)))
+       ((void) (j), (void) (k), ((type *)(image)->Map + (i) * (size)))
 
 #define FETCH(x) fetch_texel_1d_##x
 
 
 #define TEXEL_ADDR( type, image, i, j, k, size )                       \
        ((void) (k),                                                    \
-        ((type *)(image)->Data + ((image)->RowStride * (j) + (i)) * (size)))
+        ((type *)(image)->Map + ((image)->RowStride * (j) + (i)) * (size)))
 
 #define FETCH(x) fetch_texel_2d_##x
 
 #elif DIM == 3
 
 #define TEXEL_ADDR( type, image, i, j, k, size )                       \
-       ((type *)(image)->Data + ((image)->ImageOffsets[k]              \
+       ((type *)(image)->Map + ((image)->ImageOffsets[k]               \
              + (image)->RowStride * (j) + (i)) * (size))
 
 #define FETCH(x) fetch_texel_3d_##x
  * returning 1 GLfloat.
  * Note: no GLchan version of this function.
  */
-static void FETCH(f_z32)( const struct gl_texture_image *texImage,
+static void FETCH(f_z32)( const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
    texel[0] = src[0] * (1.0F / 0xffffffff);
 }
 
-#if DIM == 3
-static void store_texel_z32(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLuint *depth = (const GLuint *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   dst[0] = *depth;
-}
-#endif
-
 
 /* MESA_FORMAT_Z16 ***********************************************************/
 
@@ -98,29 +88,20 @@ static void store_texel_z32(struct gl_texture_image *texImage,
  * returning 1 GLfloat.
  * Note: no GLchan version of this function.
  */
-static void FETCH(f_z16)(const struct gl_texture_image *texImage,
+static void FETCH(f_z16)(const struct swrast_texture_image *texImage,
                          GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    texel[0] = src[0] * (1.0F / 65535.0F);
 }
 
-#if DIM == 3
-static void store_texel_z16(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLushort *depth = (const GLushort *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   dst[0] = *depth;
-}
-#endif
 
 
 /* MESA_FORMAT_RGBA_F32 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats.
  */
-static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba_f32)( const struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
@@ -130,18 +111,7 @@ static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
    texel[ACOMP] = src[3];
 }
 
-#if DIM == 3
-static void store_texel_rgba_f32(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *depth = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
-   dst[0] = depth[RCOMP];
-   dst[1] = depth[GCOMP];
-   dst[2] = depth[BCOMP];
-   dst[3] = depth[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGBA_F16 ******************************************************/
@@ -149,7 +119,7 @@ static void store_texel_rgba_f32(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba_f16)( const struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
@@ -159,25 +129,14 @@ static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = _mesa_half_to_float(src[3]);
 }
 
-#if DIM == 3
-static void store_texel_rgba_f16(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *src = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
-   dst[0] = _mesa_float_to_half(src[RCOMP]);
-   dst[1] = _mesa_float_to_half(src[GCOMP]);
-   dst[2] = _mesa_float_to_half(src[BCOMP]);
-   dst[3] = _mesa_float_to_half(src[ACOMP]);
-}
-#endif
+
 
 /* MESA_FORMAT_RGB_F32 *******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb_f32)( const struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
@@ -187,17 +146,7 @@ static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rgb_f32(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *src = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
-   dst[0] = src[RCOMP];
-   dst[1] = src[GCOMP];
-   dst[2] = src[BCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGB_F16 *******************************************************/
@@ -205,7 +154,7 @@ static void store_texel_rgb_f32(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb_f16)( const struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
@@ -215,17 +164,7 @@ static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rgb_f16(struct gl_texture_image *texImage,
-                                GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *src = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
-   dst[0] = _mesa_float_to_half(src[RCOMP]);
-   dst[1] = _mesa_float_to_half(src[GCOMP]);
-   dst[2] = _mesa_float_to_half(src[BCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_ALPHA_F32 *****************************************************/
@@ -233,7 +172,7 @@ static void store_texel_rgb_f16(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_alpha_f32)( const struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
@@ -243,15 +182,7 @@ static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
    texel[ACOMP] = src[0];
 }
 
-#if DIM == 3
-static void store_texel_alpha_f32(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_ALPHA_F32 *****************************************************/
@@ -259,7 +190,7 @@ static void store_texel_alpha_f32(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_alpha_f16)( const struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
@@ -269,15 +200,7 @@ static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = _mesa_half_to_float(src[0]);
 }
 
-#if DIM == 3
-static void store_texel_alpha_f16(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(rgba[ACOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_LUMINANCE_F32 *************************************************/
@@ -285,7 +208,7 @@ static void store_texel_alpha_f16(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_luminance_f32)( const struct swrast_texture_image *texImage,
                                     GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
@@ -295,15 +218,7 @@ static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_luminance_f32(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_LUMINANCE_F16 *************************************************/
@@ -311,7 +226,7 @@ static void store_texel_luminance_f32(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_luminance_f16)( const struct swrast_texture_image *texImage,
                                     GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
@@ -321,15 +236,7 @@ static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_luminance_f16(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/
@@ -337,7 +244,7 @@ static void store_texel_luminance_f16(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_luminance_alpha_f32)( const struct swrast_texture_image *texImage,
                                     GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
@@ -347,16 +254,7 @@ static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImag
    texel[ACOMP] = src[1];
 }
 
-#if DIM == 3
-static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/
@@ -364,7 +262,7 @@ static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_luminance_alpha_f16)( const struct swrast_texture_image *texImage,
                                     GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
@@ -374,16 +272,7 @@ static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImag
    texel[ACOMP] = _mesa_half_to_float(src[1]);
 }
 
-#if DIM == 3
-static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
-   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-   dst[1] = _mesa_float_to_half(rgba[ACOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_INTENSITY_F32 *************************************************/
@@ -391,7 +280,7 @@ static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_intensity_f32)( const struct swrast_texture_image *texImage,
                                     GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
@@ -401,15 +290,7 @@ static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
    texel[ACOMP] = src[0];
 }
 
-#if DIM == 3
-static void store_texel_intensity_f32(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_INTENSITY_F16 *************************************************/
@@ -417,7 +298,7 @@ static void store_texel_intensity_f32(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_intensity_f16)( const struct swrast_texture_image *texImage,
                                     GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
@@ -427,15 +308,7 @@ static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = _mesa_half_to_float(src[0]);
 }
 
-#if DIM == 3
-static void store_texel_intensity_f16(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_R_FLOAT32 *****************************************************/
@@ -443,7 +316,7 @@ static void store_texel_intensity_f16(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D R_FLOAT32 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_r_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_r_f32)( const struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
@@ -453,15 +326,7 @@ static void FETCH(f_r_f32)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_r_f32(struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
-   dst[0] = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_R_FLOAT16 *****************************************************/
@@ -469,7 +334,7 @@ static void store_texel_r_f32(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D R_FLOAT16 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_r_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_r_f16)( const struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
@@ -479,15 +344,7 @@ static void FETCH(f_r_f16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_r_f16(struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
-   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_RG_FLOAT32 ****************************************************/
@@ -495,7 +352,7 @@ static void store_texel_r_f16(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D RG_FLOAT32 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_rg_f32)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg_f32)( const struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
@@ -505,16 +362,7 @@ static void FETCH(f_rg_f32)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rg_f32(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_RG_FLOAT16 ****************************************************/
@@ -522,7 +370,7 @@ static void store_texel_rg_f32(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D RG_FLOAT16 texture,
  * returning 4 GLfloats.
  */
-static void FETCH(f_rg_f16)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
@@ -532,16 +380,7 @@ static void FETCH(f_rg_f16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rg_f16(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *rgba = (const GLfloat *) texel;
-   GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
-   dst[0] = _mesa_float_to_half(rgba[RCOMP]);
-   dst[1] = _mesa_float_to_half(rgba[GCOMP]);
-}
-#endif
+
 
 
 /*
@@ -551,7 +390,7 @@ static void store_texel_rg_f16(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RGBA8888 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
-static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -563,21 +402,13 @@ static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
 
 
 
-#if DIM == 3
-static void store_texel_rgba8888(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGBA888_REV ***************************************************/
 
 /* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
-static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage,
                                    GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -587,21 +418,13 @@ static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
 }
 
-#if DIM == 3
-static void store_texel_rgba8888_rev(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_ARGB8888 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
-static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -611,21 +434,13 @@ static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
 }
 
-#if DIM == 3
-static void store_texel_argb8888(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_ARGB8888_REV **************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage,
                                    GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -635,21 +450,45 @@ static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
 }
 
-#if DIM == 3
-static void store_texel_argb8888_rev(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
+
+
+
+/* MESA_FORMAT_RGBX8888 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rgbx8888 texture, return 4 GLfloats */
+static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], rgba[ACOMP]);
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[ACOMP] = 1.0f;
 }
-#endif
+
+
+
+
+/* MESA_FORMAT_RGBX888_REV ***************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rgbx8888_rev texture, return 4 GLchans */
+static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[ACOMP] = 1.0f;
+}
+
+
 
 
 /* MESA_FORMAT_XRGB8888 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */
-static void FETCH(f_xrgb8888)( const struct gl_texture_image *texImage,
+static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -659,21 +498,13 @@ static void FETCH(f_xrgb8888)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0f;
 }
 
-#if DIM == 3
-static void store_texel_xrgb8888(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(0xff, rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_XRGB8888_REV **************************************************/
 
 /* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_xrgb8888_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage,
                                    GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -683,21 +514,13 @@ static void FETCH(f_xrgb8888_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0f;
 }
 
-#if DIM == 3
-static void store_texel_xrgb8888_rev(struct gl_texture_image *texImage,
-                                     GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], 0xff);
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGB888 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
-static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
@@ -707,23 +530,13 @@ static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rgb888(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, 3);
-   dst[0] = rgba[BCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_BGR888 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
-static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
+static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
@@ -733,17 +546,7 @@ static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_bgr888(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, 3);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
-}
-#endif
+
 
 
 /* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding)
@@ -752,7 +555,7 @@ static void store_texel_bgr888(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RGB565 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
-static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -763,21 +566,13 @@ static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rgb565(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_565(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGB565_REV ****************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
-static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -788,24 +583,13 @@ static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   GLushort p = PACK_COLOR_565(CHAN_TO_UBYTE(rgba[RCOMP]),
-                               CHAN_TO_UBYTE(rgba[GCOMP]),
-                               CHAN_TO_UBYTE(rgba[BCOMP]));
-   *dst = (p >> 8) | (p << 8); /* byte swap */
-}
-#endif
+
 
 
 /* MESA_FORMAT_ARGB4444 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
-static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -816,24 +600,13 @@ static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
    texel[ACOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
 }
 
-#if DIM == 3
-static void store_texel_argb4444(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_4444(CHAN_TO_UBYTE(rgba[ACOMP]),
-                          CHAN_TO_UBYTE(rgba[RCOMP]),
-                          CHAN_TO_UBYTE(rgba[GCOMP]),
-                          CHAN_TO_UBYTE(rgba[BCOMP]));
-}
-#endif
+
 
 
 /* MESA_FORMAT_ARGB4444_REV **************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
-static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage,
                                    GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -843,23 +616,12 @@ static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
 }
 
-#if DIM == 3
-static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_4444(CHAN_TO_UBYTE(rgba[GCOMP]),
-                          CHAN_TO_UBYTE(rgba[BCOMP]),
-                          CHAN_TO_UBYTE(rgba[ACOMP]),
-                          CHAN_TO_UBYTE(rgba[RCOMP]));
-}
-#endif
+
 
 /* MESA_FORMAT_RGBA5551 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -870,20 +632,12 @@ static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage,
    texel[ACOMP] = ((s      ) & 0x01) * 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rgba5551(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_5551(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
+
 
 /* MESA_FORMAT_ARGB1555 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -894,21 +648,13 @@ static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
    texel[ACOMP] = ((s >> 15) & 0x01) * 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_argb1555(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_1555(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_ARGB1555_REV **************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
-static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage,
                                    GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -919,21 +665,13 @@ static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 );
 }
 
-#if DIM == 3
-static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_1555_REV(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_ARGB2101010 ***************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb2101010 texture, return 4 GLchans */
-static void FETCH(f_argb2101010)( const struct gl_texture_image *texImage,
+static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -944,25 +682,13 @@ static void FETCH(f_argb2101010)( const struct gl_texture_image *texImage,
    texel[ACOMP] = ((s >> 30) & 0x03) * (1.0F / 3.0F);
 }
 
-#if DIM == 3
-static void store_texel_argb2101010(struct gl_texture_image *texImage,
-                                    GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   GLushort r = CHAN_TO_USHORT(rgba[RCOMP]);
-   GLushort g = CHAN_TO_USHORT(rgba[GCOMP]);
-   GLushort b = CHAN_TO_USHORT(rgba[BCOMP]);
-   GLushort a = CHAN_TO_USHORT(rgba[ACOMP]);
-   *dst = PACK_COLOR_2101010_US(a, r, g, b);
-}
-#endif
 
 
-/* MESA_FORMAT_RG88 **********************************************************/
+
+/* MESA_FORMAT_GR88 **********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_rg88)( const struct gl_texture_image *texImage,
+static void FETCH(f_gr88)( const struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -972,47 +698,29 @@ static void FETCH(f_rg88)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0;
 }
 
-#if DIM == 3
-static void store_texel_rg88(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   GLubyte r = CHAN_TO_UBYTE(rgba[RCOMP]);
-   GLubyte g = CHAN_TO_UBYTE(rgba[GCOMP]);
-   *dst = PACK_COLOR_88(g, r);
-}
-#endif
 
 
-/* MESA_FORMAT_RG88_REV ******************************************************/
+
+/* MESA_FORMAT_RG88 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rg88_rev texture, return 4 GLchans */
-static void FETCH(f_rg88_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg88)( const struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff );
-   texel[GCOMP] = UBYTE_TO_FLOAT( s >> 8 );
+   texel[RCOMP] = UBYTE_TO_FLOAT( s >> 8 );
+   texel[GCOMP] = UBYTE_TO_FLOAT( s & 0xff );
    texel[BCOMP] = 0.0;
    texel[ACOMP] = 1.0;
 }
 
-#if DIM == 3
-static void store_texel_rg88_rev(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_88(rgba[GCOMP], rgba[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_AL44 **********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D al44 texture, return 4 GLchans */
-static void FETCH(f_al44)( const struct gl_texture_image *texImage,
+static void FETCH(f_al44)( const struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1022,21 +730,13 @@ static void FETCH(f_al44)( const struct gl_texture_image *texImage,
    texel[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
 }
 
-#if DIM == 3
-static void store_texel_al44(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, 1);
-   *dst = PACK_COLOR_44(rgba[ACOMP], rgba[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_AL88 **********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
-static void FETCH(f_al88)( const struct gl_texture_image *texImage,
+static void FETCH(f_al88)( const struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1046,21 +746,13 @@ static void FETCH(f_al88)( const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
 }
 
-#if DIM == 3
-static void store_texel_al88(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_88(rgba[ACOMP], rgba[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_R8 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_r8)(const struct gl_texture_image *texImage,
+static void FETCH(f_r8)(const struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1070,21 +762,13 @@ static void FETCH(f_r8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0;
 }
 
-#if DIM == 3
-static void store_texel_r8(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, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_R16 ***********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */
-static void FETCH(f_r16)(const struct gl_texture_image *texImage,
+static void FETCH(f_r16)(const struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1094,21 +778,13 @@ static void FETCH(f_r16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0;
 }
 
-#if DIM == 3
-static void store_texel_r16(struct gl_texture_image *texImage,
-                           GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = CHAN_TO_USHORT(rgba[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_AL88_REV ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
-static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_al88_rev)( const struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1118,21 +794,13 @@ static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
 }
 
-#if DIM == 3
-static void store_texel_al88_rev(struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_88(rgba[RCOMP], rgba[ACOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_RG1616 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rg1616 texture, return 4 GLchans */
-static void FETCH(f_rg1616)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1142,23 +810,13 @@ static void FETCH(f_rg1616)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0;
 }
 
-#if DIM == 3
-static void store_texel_rg1616(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   GLushort r = CHAN_TO_USHORT(rgba[RCOMP]);
-   GLushort g = CHAN_TO_USHORT(rgba[GCOMP]);
-   *dst = PACK_COLOR_1616(g, r);
-}
-#endif
+
 
 
 /* MESA_FORMAT_RG1616_REV ****************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rg1616_rev texture, return 4 GLchans */
-static void FETCH(f_rg1616_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1168,21 +826,13 @@ static void FETCH(f_rg1616_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0;
 }
 
-#if DIM == 3
-static void store_texel_rg1616_rev(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_1616(rgba[GCOMP], rgba[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_AL1616 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */
-static void FETCH(f_al1616)( const struct gl_texture_image *texImage,
+static void FETCH(f_al1616)( const struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1192,23 +842,13 @@ static void FETCH(f_al1616)( const struct gl_texture_image *texImage,
    texel[ACOMP] = USHORT_TO_FLOAT( s >> 16 );
 }
 
-#if DIM == 3
-static void store_texel_al1616(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   GLushort l = CHAN_TO_USHORT(rgba[RCOMP]);
-   GLushort a = CHAN_TO_USHORT(rgba[ACOMP]);
-   *dst = PACK_COLOR_1616(a, l);
-}
-#endif
+
 
 
 /* MESA_FORMAT_AL1616_REV ****************************************************/
 
 /* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */
-static void FETCH(f_al1616_rev)( const struct gl_texture_image *texImage,
+static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage,
                                 GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1218,21 +858,13 @@ static void FETCH(f_al1616_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = USHORT_TO_FLOAT( s & 0xffff );
 }
 
-#if DIM == 3
-static void store_texel_al1616_rev(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLushort *rgba = (const GLushort *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_1616(rgba[RCOMP], rgba[ACOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGB332 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
-static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
+static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1243,21 +875,13 @@ static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rgb332(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, 1);
-   *dst = PACK_COLOR_332(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_A8 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a8)( const struct gl_texture_image *texImage,
+static void FETCH(f_a8)( const struct swrast_texture_image *texImage,
                          GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1267,21 +891,13 @@ static void FETCH(f_a8)( const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
 }
 
-#if DIM == 3
-static void store_texel_a8(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, 1);
-   *dst = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_A16 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a16)( const struct gl_texture_image *texImage,
+static void FETCH(f_a16)( const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1291,21 +907,13 @@ static void FETCH(f_a16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = USHORT_TO_FLOAT( src[0] );
 }
 
-#if DIM == 3
-static void store_texel_a16(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = CHAN_TO_USHORT(rgba[ACOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_L8 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
-static void FETCH(f_l8)( const struct gl_texture_image *texImage,
+static void FETCH(f_l8)( const struct swrast_texture_image *texImage,
                          GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1315,21 +923,13 @@ static void FETCH(f_l8)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_l8(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, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_L16 ***********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */
-static void FETCH(f_l16)( const struct gl_texture_image *texImage,
+static void FETCH(f_l16)( const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1339,21 +939,13 @@ static void FETCH(f_l16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_l16(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLushort *rgba = (const GLushort *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_I8 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
-static void FETCH(f_i8)( const struct gl_texture_image *texImage,
+static void FETCH(f_i8)( const struct swrast_texture_image *texImage,
                          GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1363,21 +955,13 @@ static void FETCH(f_i8)( const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
 }
 
-#if DIM == 3
-static void store_texel_i8(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, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_I16 ***********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */
-static void FETCH(f_i16)( const struct gl_texture_image *texImage,
+static void FETCH(f_i16)( const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
@@ -1387,20 +971,12 @@ static void FETCH(f_i16)( const struct gl_texture_image *texImage,
    texel[ACOMP] = USHORT_TO_FLOAT( src[0] );
 }
 
-#if DIM == 3
-static void store_texel_i16(struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLushort *rgba = (const GLushort *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* 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,
+static void FETCH(srgb8)(const struct swrast_texture_image *texImage,
                          GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
@@ -1410,20 +986,10 @@ static void FETCH(srgb8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_srgb8(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, 3);
-   dst[0] = rgba[BCOMP]; /* no conversion */
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[RCOMP];
-}
-#endif
+
 
 /* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */
-static void FETCH(srgba8)(const struct gl_texture_image *texImage,
+static void FETCH(srgba8)(const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1433,18 +999,10 @@ static void FETCH(srgba8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff ); /* linear! */
 }
 
-#if DIM == 3
-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;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
+
 
 /* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */
-static void FETCH(sargb8)(const struct gl_texture_image *texImage,
+static void FETCH(sargb8)(const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1454,18 +1012,10 @@ static void FETCH(sargb8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); /* linear! */
 }
 
-#if DIM == 3
-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;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
-}
-#endif
+
 
 /* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */
-static void FETCH(sl8)(const struct gl_texture_image *texImage,
+static void FETCH(sl8)(const struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
@@ -1475,18 +1025,10 @@ static void FETCH(sl8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_sl8(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, 1);
-   dst[0] = rgba[RCOMP];
-}
-#endif
+
 
 /* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */
-static void FETCH(sla8)(const struct gl_texture_image *texImage,
+static void FETCH(sla8)(const struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
@@ -1496,22 +1038,13 @@ static void FETCH(sla8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = UBYTE_TO_FLOAT(src[1]); /* linear */
 }
 
-#if DIM == 3
-static void store_texel_sla8(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, 2);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGBA_INT8 **************************************************/
 
 static void
-FETCH(rgba_int8)(const struct gl_texture_image *texImage,
+FETCH(rgba_int8)(const struct swrast_texture_image *texImage,
                  GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 4);
@@ -1521,25 +1054,13 @@ FETCH(rgba_int8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = (GLfloat) src[3];
 }
 
-#if DIM == 3
-static void
-store_texel_rgba_int8(struct gl_texture_image *texImage,
-                      GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rgba = (const GLbyte *) texel;
-   GLbyte *dst = TEXEL_ADDR(GLbyte, texImage, i, j, k, 4);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
-   dst[3] = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGBA_INT16 **************************************************/
 
 static void
-FETCH(rgba_int16)(const struct gl_texture_image *texImage,
+FETCH(rgba_int16)(const struct swrast_texture_image *texImage,
                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLshort *src = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
@@ -1549,25 +1070,13 @@ FETCH(rgba_int16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = (GLfloat) src[3];
 }
 
-#if DIM == 3
-static void
-store_texel_rgba_int16(struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLshort *rgba = (const GLshort *) texel;
-   GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
-   dst[3] = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGBA_INT32 **************************************************/
 
 static void
-FETCH(rgba_int32)(const struct gl_texture_image *texImage,
+FETCH(rgba_int32)(const struct swrast_texture_image *texImage,
                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLint *src = TEXEL_ADDR(GLint, texImage, i, j, k, 4);
@@ -1577,25 +1086,13 @@ FETCH(rgba_int32)(const struct gl_texture_image *texImage,
    texel[ACOMP] = (GLfloat) src[3];
 }
 
-#if DIM == 3
-static void
-store_texel_rgba_int32(struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLint *rgba = (const GLint *) texel;
-   GLint *dst = TEXEL_ADDR(GLint, texImage, i, j, k, 4);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
-   dst[3] = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGBA_UINT8 **************************************************/
 
 static void
-FETCH(rgba_uint8)(const struct gl_texture_image *texImage,
+FETCH(rgba_uint8)(const struct swrast_texture_image *texImage,
                  GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
@@ -1605,25 +1102,13 @@ FETCH(rgba_uint8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = (GLfloat) src[3];
 }
 
-#if DIM == 3
-static void
-store_texel_rgba_uint8(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];
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGBA_UINT16 **************************************************/
 
 static void
-FETCH(rgba_uint16)(const struct gl_texture_image *texImage,
+FETCH(rgba_uint16)(const struct swrast_texture_image *texImage,
                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
@@ -1633,25 +1118,13 @@ FETCH(rgba_uint16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = (GLfloat) src[3];
 }
 
-#if DIM == 3
-static void
-store_texel_rgba_uint16(struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLushort *rgba = (const GLushort *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
-   dst[3] = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGBA_UINT32 **************************************************/
 
 static void
-FETCH(rgba_uint32)(const struct gl_texture_image *texImage,
+FETCH(rgba_uint32)(const struct swrast_texture_image *texImage,
                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 4);
@@ -1661,26 +1134,14 @@ FETCH(rgba_uint32)(const struct gl_texture_image *texImage,
    texel[ACOMP] = (GLfloat) src[3];
 }
 
-#if DIM == 3
-static void
-store_texel_rgba_uint32(struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLuint *rgba = (const GLuint *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 4);
-   dst[0] = rgba[RCOMP];
-   dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
-   dst[3] = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_DUDV8 ********************************************************/
 
 /* this format by definition produces 0,0,0,1 as rgba values,
    however we'll return the dudv values as rg and fix up elsewhere */
-static void FETCH(dudv8)(const struct gl_texture_image *texImage,
+static void FETCH(dudv8)(const struct swrast_texture_image *texImage,
                          GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2);
@@ -1693,7 +1154,7 @@ static void FETCH(dudv8)(const struct gl_texture_image *texImage,
 
 /* MESA_FORMAT_SIGNED_R8 ***********************************************/
 
-static void FETCH(signed_r8)( const struct gl_texture_image *texImage,
+static void FETCH(signed_r8)( const struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
@@ -1703,20 +1164,12 @@ static void FETCH(signed_r8)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_signed_r8(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rgba = (const GLbyte *) texel;
-   GLbyte *dst = TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_A8 ***********************************************/
 
-static void FETCH(signed_a8)( const struct gl_texture_image *texImage,
+static void FETCH(signed_a8)( const struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
@@ -1726,20 +1179,12 @@ static void FETCH(signed_a8)( const struct gl_texture_image *texImage,
    texel[ACOMP] = BYTE_TO_FLOAT_TEX( s );
 }
 
-#if DIM == 3
-static void store_texel_signed_a8(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rgba = (const GLbyte *) texel;
-   GLbyte *dst = TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
-   *dst = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_L8 ***********************************************/
 
-static void FETCH(signed_l8)( const struct gl_texture_image *texImage,
+static void FETCH(signed_l8)( const struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
@@ -1749,20 +1194,12 @@ static void FETCH(signed_l8)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_signed_l8(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rgba = (const GLbyte *) texel;
-   GLbyte *dst = TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_I8 ***********************************************/
 
-static void FETCH(signed_i8)( const struct gl_texture_image *texImage,
+static void FETCH(signed_i8)( const struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
@@ -1772,20 +1209,12 @@ static void FETCH(signed_i8)( const struct gl_texture_image *texImage,
    texel[ACOMP] = BYTE_TO_FLOAT_TEX( s );
 }
 
-#if DIM == 3
-static void store_texel_signed_i8(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rgba = (const GLbyte *) texel;
-   GLbyte *dst = TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_RG88_REV ***********************************************/
 
-static void FETCH(signed_rg88_rev)( const struct gl_texture_image *texImage,
+static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage,
                                     GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1795,20 +1224,12 @@ static void FETCH(signed_rg88_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_signed_rg88_rev(struct gl_texture_image *texImage,
-                                        GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rg = (const GLbyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   dst[0] = PACK_COLOR_88(rg[GCOMP], rg[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_AL88 ***********************************************/
 
-static void FETCH(signed_al88)( const struct gl_texture_image *texImage,
+static void FETCH(signed_al88)( const struct swrast_texture_image *texImage,
                                 GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1818,20 +1239,12 @@ static void FETCH(signed_al88)( const struct gl_texture_image *texImage,
    texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
 }
 
-#if DIM == 3
-static void store_texel_signed_al88(struct gl_texture_image *texImage,
-                                    GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rg = (const GLbyte *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   dst[0] = PACK_COLOR_88(rg[ACOMP], rg[RCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_RGBX8888 ***********************************************/
 
-static void FETCH(signed_rgbx8888)( const struct gl_texture_image *texImage,
+static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage,
                                    GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1841,20 +1254,12 @@ static void FETCH(signed_rgbx8888)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0f;
 }
 
-#if DIM == 3
-static void store_texel_signed_rgbx8888(struct gl_texture_image *texImage,
-                                        GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rgba = (const GLbyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], 255);
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/
 
-static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
+static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage,
                                    GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1864,17 +1269,9 @@ static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
    texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s      ) );
 }
 
-#if DIM == 3
-static void store_texel_signed_rgba8888(struct gl_texture_image *texImage,
-                                        GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLbyte *rgba = (const GLbyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
 
-static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
+
+static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texImage,
                                         GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1884,22 +1281,14 @@ static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
 }
 
-#if DIM == 3
-static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
-                                            GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLubyte *rgba = (const GLubyte *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
-}
-#endif
+
 
 
 
 /* MESA_FORMAT_SIGNED_R16 ***********************************************/
 
 static void
-FETCH(signed_r16)(const struct gl_texture_image *texImage,
+FETCH(signed_r16)(const struct swrast_texture_image *texImage,
                   GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1909,22 +1298,13 @@ FETCH(signed_r16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void
-store_texel_signed_r16(struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLshort *rgba = (const GLshort *) texel;
-   GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
-   *dst = rgba[0];
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_A16 ***********************************************/
 
 static void
-FETCH(signed_a16)(const struct gl_texture_image *texImage,
+FETCH(signed_a16)(const struct swrast_texture_image *texImage,
                   GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1934,22 +1314,13 @@ FETCH(signed_a16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = SHORT_TO_FLOAT_TEX( s );
 }
 
-#if DIM == 3
-static void
-store_texel_signed_a16(struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLshort *rgba = (const GLshort *) texel;
-   GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
-   *dst = rgba[ACOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_L16 ***********************************************/
 
 static void
-FETCH(signed_l16)(const struct gl_texture_image *texImage,
+FETCH(signed_l16)(const struct swrast_texture_image *texImage,
                   GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1959,22 +1330,13 @@ FETCH(signed_l16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void
-store_texel_signed_l16(struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLshort *rgba = (const GLshort *) texel;
-   GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_I16 ***********************************************/
 
 static void
-FETCH(signed_i16)(const struct gl_texture_image *texImage,
+FETCH(signed_i16)(const struct swrast_texture_image *texImage,
                   GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
@@ -1984,22 +1346,13 @@ FETCH(signed_i16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = SHORT_TO_FLOAT_TEX( s );
 }
 
-#if DIM == 3
-static void
-store_texel_signed_i16(struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLshort *rgba = (const GLshort *) texel;
-   GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
-   *dst = rgba[RCOMP];
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_RG1616 ***********************************************/
 
 static void
-FETCH(signed_rg1616)(const struct gl_texture_image *texImage,
+FETCH(signed_rg1616)(const struct swrast_texture_image *texImage,
                     GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
@@ -2009,23 +1362,13 @@ FETCH(signed_rg1616)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void
-store_texel_signed_rg1616(struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
-   dst[0] = CHAN_TO_SHORT(rgba[RCOMP]);
-   dst[1] = CHAN_TO_SHORT(rgba[GCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_AL1616 ***********************************************/
 
 static void
-FETCH(signed_al1616)(const struct gl_texture_image *texImage,
+FETCH(signed_al1616)(const struct swrast_texture_image *texImage,
                     GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
@@ -2035,23 +1378,13 @@ FETCH(signed_al1616)(const struct gl_texture_image *texImage,
    texel[ACOMP] = SHORT_TO_FLOAT_TEX( s[1] );
 }
 
-#if DIM == 3
-static void
-store_texel_signed_al1616(struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
-   dst[0] = CHAN_TO_SHORT(rgba[RCOMP]);
-   dst[1] = CHAN_TO_SHORT(rgba[ACOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_RGB_16 ***********************************************/
 
 static void 
-FETCH(signed_rgb_16)(const struct gl_texture_image *texImage,
+FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage,
                      GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 3);
@@ -2061,24 +1394,13 @@ FETCH(signed_rgb_16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void
-store_texel_signed_rgb_16(struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 3);
-   dst[0] = CHAN_TO_SHORT(rgba[RCOMP]);
-   dst[1] = CHAN_TO_SHORT(rgba[GCOMP]);
-   dst[2] = CHAN_TO_SHORT(rgba[BCOMP]);
-}
-#endif
+
 
 
 /* MESA_FORMAT_SIGNED_RGBA_16 ***********************************************/
 
 static void
-FETCH(signed_rgba_16)(const struct gl_texture_image *texImage,
+FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage,
                       GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
@@ -2088,26 +1410,14 @@ FETCH(signed_rgba_16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = SHORT_TO_FLOAT_TEX( s[3] );
 }
 
-#if DIM == 3
-static void
-store_texel_signed_rgba_16(struct gl_texture_image *texImage,
-                           GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
-   dst[0] = CHAN_TO_SHORT(rgba[RCOMP]);
-   dst[1] = CHAN_TO_SHORT(rgba[GCOMP]);
-   dst[2] = CHAN_TO_SHORT(rgba[BCOMP]);
-   dst[3] = CHAN_TO_SHORT(rgba[ACOMP]);
-}
-#endif
+
 
 
 
 /* MESA_FORMAT_RGBA_16 ***********************************************/
 
 static void
-FETCH(rgba_16)(const struct gl_texture_image *texImage,
+FETCH(rgba_16)(const struct swrast_texture_image *texImage,
                GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
@@ -2117,19 +1427,7 @@ FETCH(rgba_16)(const struct gl_texture_image *texImage,
    texel[ACOMP] = USHORT_TO_FLOAT( s[3] );
 }
 
-#if DIM == 3
-static void
-store_texel_rgba_16(struct gl_texture_image *texImage,
-                    GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLchan *rgba = (const GLchan *) texel;
-   GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
-   dst[0] = CHAN_TO_USHORT(rgba[RCOMP]);
-   dst[1] = CHAN_TO_USHORT(rgba[GCOMP]);
-   dst[2] = CHAN_TO_USHORT(rgba[BCOMP]);
-   dst[3] = CHAN_TO_USHORT(rgba[ACOMP]);
-}
-#endif
+
 
 
 
@@ -2138,7 +1436,7 @@ store_texel_rgba_16(struct gl_texture_image *texImage,
 /* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats.
  * We convert YCbCr to RGB here.
  */
-static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
+static void FETCH(f_ycbcr)( const struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
@@ -2160,18 +1458,7 @@ static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_ycbcr(struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, const void *texel)
-{
-   (void) texImage;
-   (void) i;
-   (void) j;
-   (void) k;
-   (void) texel;
-   /* XXX to do */
-}
-#endif
+
 
 
 /* MESA_FORMAT_YCBCR_REV *****************************************************/
@@ -2179,7 +1466,7 @@ static void store_texel_ycbcr(struct gl_texture_image *texImage,
 /* Fetch 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,
+static void FETCH(f_ycbcr_rev)( const struct swrast_texture_image *texImage,
                                 GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
@@ -2201,79 +1488,48 @@ static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_ycbcr_rev(struct gl_texture_image *texImage,
-                                  GLint i, GLint j, GLint k, const void *texel)
-{
-   (void) texImage;
-   (void) i;
-   (void) j;
-   (void) k;
-   (void) texel;
-   /* XXX to do */
-}
-#endif
+
 
 
 /* MESA_TEXFORMAT_Z24_S8 ***************************************************/
 
-static void FETCH(f_z24_s8)( const struct gl_texture_image *texImage,
+static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* only return Z, not stencil data */
    const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
+   const GLdouble scale = 1.0 / (GLdouble) 0xffffff;
    texel[0] = ((*src) >> 8) * scale;
-   ASSERT(texImage->TexFormat == MESA_FORMAT_Z24_S8 ||
-         texImage->TexFormat == MESA_FORMAT_Z24_X8);
+   ASSERT(texImage->Base.TexFormat == MESA_FORMAT_Z24_S8 ||
+         texImage->Base.TexFormat == MESA_FORMAT_Z24_X8);
    ASSERT(texel[0] >= 0.0F);
    ASSERT(texel[0] <= 1.0F);
 }
 
-#if DIM == 3
-static void store_texel_z24_s8(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   /* only store Z, not stencil */
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   GLfloat depth = *((GLfloat *) texel);
-   GLuint zi = ((GLuint) (depth * 0xffffff)) << 8;
-   *dst = zi | (*dst & 0xff);
-}
-#endif
+
 
 
 /* MESA_TEXFORMAT_S8_Z24 ***************************************************/
 
-static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage,
+static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* only return Z, not stencil data */
    const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
+   const GLdouble scale = 1.0 / (GLdouble) 0xffffff;
    texel[0] = ((*src) & 0x00ffffff) * scale;
-   ASSERT(texImage->TexFormat == MESA_FORMAT_S8_Z24 ||
-         texImage->TexFormat == MESA_FORMAT_X8_Z24);
+   ASSERT(texImage->Base.TexFormat == MESA_FORMAT_S8_Z24 ||
+         texImage->Base.TexFormat == MESA_FORMAT_X8_Z24);
    ASSERT(texel[0] >= 0.0F);
    ASSERT(texel[0] <= 1.0F);
 }
 
-#if DIM == 3
-static void store_texel_s8_z24(struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, const void *texel)
-{
-   /* only store Z, not stencil */
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   GLfloat depth = *((GLfloat *) texel);
-   GLuint zi = (GLuint) (depth * 0xffffff);
-   *dst = zi | (*dst & 0xff000000);
-}
-#endif
+
 
 
 /* MESA_FORMAT_RGB9_E5 ******************************************************/
 
-static void FETCH(rgb9_e5)( const struct gl_texture_image *texImage,
+static void FETCH(rgb9_e5)( const struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -2281,20 +1537,12 @@ static void FETCH(rgb9_e5)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_rgb9_e5(struct gl_texture_image *texImage,
-                                GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *src = (const GLfloat *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = float3_to_rgb9e5(src);
-}
-#endif
+
 
 
 /* MESA_FORMAT_R11_G11_B10_FLOAT *********************************************/
 
-static void FETCH(r11_g11_b10f)( const struct gl_texture_image *texImage,
+static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -2302,20 +1550,12 @@ static void FETCH(r11_g11_b10f)( const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_r11_g11_b10f(struct gl_texture_image *texImage,
-                                     GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *src = (const GLfloat *) texel;
-   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   *dst = float3_to_r11g11b10f(src);
-}
-#endif
+
 
 
 /* MESA_FORMAT_Z32_FLOAT_X24S8 ***********************************************/
 
-static void FETCH(z32f_x24s8)(const struct gl_texture_image *texImage,
+static void FETCH(z32f_x24s8)(const struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
@@ -2325,15 +1565,6 @@ static void FETCH(z32f_x24s8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 1.0F;
 }
 
-#if DIM == 3
-static void store_texel_z32f_x24s8(struct gl_texture_image *texImage,
-                                   GLint i, GLint j, GLint k, const void *texel)
-{
-   const GLfloat *src = (const GLfloat *) texel;
-   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
-   dst[0] = src[0];
-}
-#endif
 
 
 #undef TEXEL_ADDR