[Mesa-dev] [PATCH 08/12] mesa: move gl_texture_image::FetchTexel fields to swrast

Brian Paul brian.e.paul at gmail.com
Sat Sep 10 10:55:13 PDT 2011


From: Brian Paul <brianp at vmware.com>

This also involves passing swrast_texture_image instead of gl_texture_image
into all the fetch functions.
---
 src/mesa/main/mtypes.h           |   34 ----
 src/mesa/main/texcompress.c      |    9 +-
 src/mesa/main/texcompress_fxt1.c |    9 +-
 src/mesa/main/texcompress_fxt1.h |    6 +-
 src/mesa/main/texcompress_rgtc.c |   42 +++--
 src/mesa/main/texcompress_rgtc.h |   18 +-
 src/mesa/main/texcompress_s3tc.c |   39 +++--
 src/mesa/main/texcompress_s3tc.h |   18 +-
 src/mesa/main/teximage.c         |    2 -
 src/mesa/swrast/s_context.h      |   42 ++++-
 src/mesa/swrast/s_texfetch.c     |   22 ++-
 src/mesa/swrast/s_texfetch.h     |    3 -
 src/mesa/swrast/s_texfetch_tmp.h |  370 +++++++++++++++++++-------------------
 src/mesa/swrast/s_texfilter.c    |   92 ++++++----
 src/mesa/swrast/s_texrender.c    |   27 ++--
 15 files changed, 378 insertions(+), 355 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ae500b4..40335a8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1243,37 +1243,6 @@ typedef enum
 
 
 /**
- * Texel fetch function prototype.  We use texel fetch functions to
- * extract RGBA, color indexes and depth components out of 1D, 2D and 3D
- * texture images.  These functions help to isolate us from the gritty
- * details of all the various texture image encodings.
- * 
- * \param texImage texture image.
- * \param col texel column.
- * \param row texel row.
- * \param img texel image level/layer.
- * \param texelOut output texel (up to 4 GLchans)
- */
-typedef void (*FetchTexelFuncC)( const struct gl_texture_image *texImage,
-                                 GLint col, GLint row, GLint img,
-                                 GLchan *texelOut );
-
-/**
- * As above, but returns floats.
- * Used for depth component images and for upcoming signed/float
- * texture images.
- */
-typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage,
-                                 GLint col, GLint row, GLint img,
-                                 GLfloat *texelOut );
-
-
-typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage,
-                               GLint col, GLint row, GLint img,
-                               const void *texel);
-
-
-/**
  * Texture image state.  Describes the dimensions of a texture image,
  * the texel format and pointers to Texel Fetch functions.
  */
@@ -1310,9 +1279,6 @@ struct gl_texture_image
    /** Cube map face: index into gl_texture_object::Image[] array */
    GLuint Face;
 
-   FetchTexelFuncC FetchTexelc;	/**< GLchan texel fetch function pointer */
-   FetchTexelFuncF FetchTexelf;	/**< Float texel fetch function pointer */
-
    GLuint RowStride;		/**< Padded width in units of texels */
    GLuint *ImageOffsets;        /**< if 3D texture: array [Depth] of offsets to
                                      each 2D slice in 'Data', in texels */
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 4e5c14c..b49d1b1 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -40,6 +40,7 @@
 #include "texcompress_fxt1.h"
 #include "texcompress_rgtc.h"
 #include "texcompress_s3tc.h"
+#include "swrast/s_context.h"
 
 
 /**
@@ -451,15 +452,15 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
                        const GLubyte *src, GLint srcRowStride,
                        GLfloat *dest)
 {
-   void (*fetch)(const struct gl_texture_image *texImage,
+   void (*fetch)(const struct swrast_texture_image *texImage,
                  GLint i, GLint j, GLint k, GLfloat *texel);
-   struct gl_texture_image texImage;  /* dummy teximage */
+   struct swrast_texture_image texImage;  /* dummy teximage */
    GLuint i, j;
 
    /* setup dummy texture image info */
    memset(&texImage, 0, sizeof(texImage));
-   texImage.Data = (void *) src;
-   texImage.RowStride = srcRowStride;
+   texImage.Base.Data = (void *) src;
+   texImage.Base.RowStride = srcRowStride;
 
    switch (format) {
    /* DXT formats */
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index bb7fb56..a75487c 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -39,6 +39,7 @@
 #include "texcompress.h"
 #include "texcompress_fxt1.h"
 #include "texstore.h"
+#include "swrast/s_context.h"
 
 
 #if FEATURE_texture_fxt1
@@ -167,13 +168,13 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
 
 
 void
-_mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_fxt1( const struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
    (void) k;
-   fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
+   fxt1_decode_1(texImage->Base.Data, texImage->Base.RowStride, i, j, rgba);
    texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
    texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
    texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
@@ -182,13 +183,13 @@ _mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
 
 
 void
-_mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgb_fxt1( const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
    GLchan rgba[4];
    (void) k;
-   fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
+   fxt1_decode_1(texImage->Base.Data, texImage->Base.RowStride, i, j, rgba);
    texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
    texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
    texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
diff --git a/src/mesa/main/texcompress_fxt1.h b/src/mesa/main/texcompress_fxt1.h
index b991f4c..bd84082 100644
--- a/src/mesa/main/texcompress_fxt1.h
+++ b/src/mesa/main/texcompress_fxt1.h
@@ -29,7 +29,7 @@
 #include "mfeatures.h"
 #include "texstore.h"
 
-struct gl_texture_image;
+struct swrast_texture_image;
 
 #if FEATURE_texture_fxt1
 
@@ -40,11 +40,11 @@ extern GLboolean
 _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
 
 extern void
-_mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_fxt1(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgb_fxt1(const struct swrast_texture_image *texImage,
                                 GLint i, GLint j, GLint k, GLfloat *texel);
 
 #else /* FEATURE_texture_fxt1 */
diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c
index d9de9be..7af3d67 100644
--- a/src/mesa/main/texcompress_rgtc.c
+++ b/src/mesa/main/texcompress_rgtc.c
@@ -43,6 +43,8 @@
 #include "texcompress.h"
 #include "texcompress_rgtc.h"
 #include "texstore.h"
+#include "swrast/s_context.h"
+
 
 #define RGTC_DEBUG 0
 
@@ -323,11 +325,11 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
 }
 
 void
-_mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
 				 GLint i, GLint j, GLint k, GLfloat *texel)
 {
    GLubyte red;
-   unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
+   unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
 		       i, j, &red, 1);
    texel[RCOMP] = UBYTE_TO_FLOAT(red);
    texel[GCOMP] = 0.0;
@@ -336,11 +338,11 @@ _mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texImage,
 					GLint i, GLint j, GLint k, GLfloat *texel)
 {
    GLbyte red;
-   signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+   signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
 		       i, j, &red, 1);
    texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
    texel[GCOMP] = 0.0;
@@ -349,13 +351,13 @@ _mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
 				 GLint i, GLint j, GLint k, GLfloat *texel)
 {
    GLubyte red, green;
-   unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
+   unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
 		     i, j, &red, 2);
-   unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data) + 8,
+   unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data) + 8,
 		     i, j, &green, 2);
    texel[RCOMP] = UBYTE_TO_FLOAT(red);
    texel[GCOMP] = UBYTE_TO_FLOAT(green);
@@ -364,13 +366,13 @@ _mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
 				       GLint i, GLint j, GLint k, GLfloat *texel)
 {
    GLbyte red, green;
-   signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+   signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
 		     i, j, &red, 2);
-   signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8,
+   signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data) + 8,
 		     i, j, &green, 2);
    texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
    texel[GCOMP] = BYTE_TO_FLOAT_TEX(green);
@@ -379,11 +381,11 @@ _mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel)
 {
    GLubyte red;
-   unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
+   unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
                        i, j, &red, 1);
    texel[RCOMP] =
    texel[GCOMP] =
@@ -392,11 +394,11 @@ _mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImage,
                                         GLint i, GLint j, GLint k, GLfloat *texel)
 {
    GLbyte red;
-   signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+   signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
                        i, j, &red, 1);
    texel[RCOMP] =
    texel[GCOMP] =
@@ -405,13 +407,13 @@ _mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel)
 {
    GLubyte red, green;
-   unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
+   unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
                      i, j, &red, 2);
-   unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data) + 8,
+   unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data) + 8,
                      i, j, &green, 2);
    texel[RCOMP] =
    texel[GCOMP] =
@@ -420,13 +422,13 @@ _mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_signed_la_latc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texImage,
                                        GLint i, GLint j, GLint k, GLfloat *texel)
 {
    GLbyte red, green;
-   signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
+   signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
                      i, j, &red, 2);
-   signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8,
+   signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data) + 8,
                      i, j, &green, 2);
    texel[RCOMP] =
    texel[GCOMP] =
diff --git a/src/mesa/main/texcompress_rgtc.h b/src/mesa/main/texcompress_rgtc.h
index 1876677..6be6ad9 100644
--- a/src/mesa/main/texcompress_rgtc.h
+++ b/src/mesa/main/texcompress_rgtc.h
@@ -28,7 +28,7 @@
 #include "mfeatures.h"
 #include "texstore.h"
 
-struct gl_texture_image;
+struct swrast_texture_image;
 
 extern GLboolean
 _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS);
@@ -43,35 +43,35 @@ extern GLboolean
 _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS);
 
 extern void
-_mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
 				 GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texImage,
 					GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
 				 GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
 				       GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImage,
                                         GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_signed_la_latc2(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texImage,
                                        GLint i, GLint j, GLint k, GLfloat *texel);
 
 #endif
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 86f962e..36a5644 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -44,6 +44,7 @@
 #include "texcompress.h"
 #include "texcompress_s3tc.h"
 #include "texstore.h"
+#include "swrast/s_context.h"
 
 
 #if FEATURE_texture_s3tc
@@ -388,14 +389,14 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
 
 
 static void
-fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
+fetch_texel_2d_rgb_dxt1( const struct swrast_texture_image *texImage,
                          GLint i, GLint j, GLint k, GLchan *texel )
 {
    (void) k;
    if (fetch_ext_rgb_dxt1) {
       ASSERT (sizeof(GLchan) == sizeof(GLubyte));
-      fetch_ext_rgb_dxt1(texImage->RowStride,
-                         (GLubyte *)(texImage)->Data, i, j, texel);
+      fetch_ext_rgb_dxt1(texImage->Base.RowStride,
+                         (GLubyte *)(texImage)->Base.Data, i, j, texel);
    }
    else
       _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1");
@@ -403,7 +404,7 @@ fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
 
 
 void
-_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgb_dxt1(const struct swrast_texture_image *texImage,
                                 GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
@@ -417,13 +418,13 @@ _mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
 
 
 static void
-fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
+fetch_texel_2d_rgba_dxt1( const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLchan *texel )
 {
    (void) k;
    if (fetch_ext_rgba_dxt1) {
-      fetch_ext_rgba_dxt1(texImage->RowStride,
-                          (GLubyte *)(texImage)->Data, i, j, texel);
+      fetch_ext_rgba_dxt1(texImage->Base.RowStride,
+                          (GLubyte *)(texImage)->Base.Data, i, j, texel);
    }
    else
       _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n");
@@ -431,7 +432,7 @@ fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
 
 
 void
-_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_dxt1(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
@@ -445,13 +446,14 @@ _mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
 
 
 static void
-fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
+fetch_texel_2d_rgba_dxt3( const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLchan *texel )
 {
    (void) k;
    if (fetch_ext_rgba_dxt3) {
       ASSERT (sizeof(GLchan) == sizeof(GLubyte));
-      fetch_ext_rgba_dxt3(texImage->RowStride, (GLubyte *)(texImage)->Data,
+      fetch_ext_rgba_dxt3(texImage->Base.RowStride,
+                          (GLubyte *)(texImage)->Base.Data,
                           i, j, texel);
    }
    else
@@ -460,7 +462,7 @@ fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
 
 
 void
-_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_dxt3(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
@@ -474,12 +476,13 @@ _mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
 
 
 static void
-fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
+fetch_texel_2d_rgba_dxt5( const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLchan *texel )
 {
    (void) k;
    if (fetch_ext_rgba_dxt5) {
-      fetch_ext_rgba_dxt5(texImage->RowStride, (GLubyte *)(texImage)->Data,
+      fetch_ext_rgba_dxt5(texImage->Base.RowStride,
+                          (GLubyte *)(texImage)->Base.Data,
                           i, j, texel);
    }
    else
@@ -488,7 +491,7 @@ fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
 
 
 void
-_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_dxt5(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
@@ -502,7 +505,7 @@ _mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
 
 #if FEATURE_EXT_texture_sRGB
 void
-_mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgb_dxt1( const struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    /* just sample as GLchan and convert to float here */
@@ -515,7 +518,7 @@ _mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgba_dxt1(const struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
@@ -528,7 +531,7 @@ _mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgba_dxt3(const struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
@@ -541,7 +544,7 @@ _mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
 }
 
 void
-_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgba_dxt5(const struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel)
 {
    /* just sample as GLchan and convert to float here */
diff --git a/src/mesa/main/texcompress_s3tc.h b/src/mesa/main/texcompress_s3tc.h
index 74a0343..709c35a 100644
--- a/src/mesa/main/texcompress_s3tc.h
+++ b/src/mesa/main/texcompress_s3tc.h
@@ -31,7 +31,7 @@
 #include "texstore.h"
 
 struct gl_context;
-struct gl_texture_image;
+struct swrast_texture_image;
 
 #if FEATURE_texture_s3tc
 
@@ -48,35 +48,35 @@ extern GLboolean
 _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
 
 extern void
-_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgb_dxt1(const struct swrast_texture_image *texImage,
                                 GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_dxt1(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_dxt3(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_rgba_dxt5(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_srgb_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgb_dxt1(const struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgba_dxt1(const struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgba_dxt3(const struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
-_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
+_mesa_fetch_texel_2d_f_srgba_dxt5(const struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, GLfloat *texel);
 
 extern void
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 2973b6d..6113b2e 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1076,8 +1076,6 @@ clear_teximage_fields(struct gl_texture_image *img)
    img->DepthLog2 = 0;
    img->Data = NULL;
    img->TexFormat = MESA_FORMAT_NONE;
-   img->FetchTexelc = NULL;
-   img->FetchTexelf = NULL;
 }
 
 
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index 687480e..8357483 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -109,6 +109,27 @@ typedef void (*validate_texture_image_func)(struct gl_context *ctx,
 			        _NEW_DEPTH)
 
 
+struct swrast_texture_image;
+
+
+typedef void (*FetchTexelFuncC)(const struct swrast_texture_image *texImage,
+                                GLint col, GLint row, GLint img,
+                                GLchan *texelOut);
+
+/**
+ * As above, but returns floats.
+ * Used for depth component images and for upcoming signed/float
+ * texture images.
+ */
+typedef void (*FetchTexelFuncF)(const struct swrast_texture_image *texImage,
+                                GLint col, GLint row, GLint img,
+                                GLfloat *texelOut);
+
+
+typedef void (*StoreTexelFunc)(struct swrast_texture_image *texImage,
+                               GLint col, GLint row, GLint img,
+                               const void *texel);
+
 /**
  * Subclass of gl_texture_image.
  * We need extra fields/info to keep tracking of mapped texture buffers,
@@ -118,7 +139,25 @@ struct swrast_texture_image
 {
    struct gl_texture_image Base;
 
-   /* XXX new members coming soon */
+#if 0
+   /** used for mipmap LOD computation */
+   GLfloat WidthScale, HeightScale, DepthScale;
+   GLboolean _IsPowerOfTwo;  /**< Are all dimensions powers of two? */
+
+   GLubyte *Data;    /**< The actual texture data in malloc'd memory */
+
+   GLint TexelSize;  /**< bytes per texel block */
+#endif
+
+   FetchTexelFuncC FetchTexelc;
+   FetchTexelFuncF FetchTexelf;
+   StoreTexelFunc Store;
+
+#if 0
+   /** These fields only valid when texture memory is mapped */
+   GLubyte **SliceMaps;  /**< points to OneMap or a malloc'd array */
+   GLint RowStride;  /**< bytes per row of blocks */
+#endif
 };
 
 
@@ -137,7 +176,6 @@ swrast_texture_image_const(const struct gl_texture_image *img)
 }
 
 
-
 /**
  * \struct SWcontext
  * \brief  Per-context state that's private to the software rasterizer module.
diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
index cefd68b..ed17b4b 100644
--- a/src/mesa/swrast/s_texfetch.c
+++ b/src/mesa/swrast/s_texfetch.c
@@ -40,6 +40,7 @@
 #include "main/texcompress_s3tc.h"
 #include "main/texcompress_rgtc.h"
 #include "main/teximage.h"
+#include "s_context.h"
 #include "s_texfetch.h"
 #include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
 #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
@@ -90,7 +91,7 @@ nonlinear_to_linear(GLubyte cs8)
  *
  * Have to have this so the FetchTexel function pointer is never NULL.
  */
-static void fetch_null_texelf( const struct gl_texture_image *texImage,
+static void fetch_null_texelf( const struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    (void) texImage; (void) i; (void) j; (void) k;
@@ -101,7 +102,7 @@ static void fetch_null_texelf( const struct gl_texture_image *texImage,
    _mesa_warning(NULL, "fetch_null_texelf() called!");
 }
 
-static void store_null_texel(struct gl_texture_image *texImage,
+static void store_null_texel(struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, const void *texel)
 {
    (void) texImage;
@@ -964,11 +965,11 @@ _mesa_get_texel_store_func(gl_format format)
  * Adaptor for fetching a GLchan texel from a float-valued texture.
  */
 static void
-fetch_texel_float_to_chan(const struct gl_texture_image *texImage,
+fetch_texel_float_to_chan(const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLchan *texelOut)
 {
    GLfloat temp[4];
-   GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
+   GLenum baseFormat = _mesa_get_format_base_format(texImage->Base.TexFormat);
 
    ASSERT(texImage->FetchTexelf);
    texImage->FetchTexelf(texImage, i, j, k, temp);
@@ -992,7 +993,7 @@ fetch_texel_float_to_chan(const struct gl_texture_image *texImage,
  * Adaptor for fetching a float texel from a GLchan-valued texture.
  */
 static void
-fetch_texel_chan_to_float(const struct gl_texture_image *texImage,
+fetch_texel_chan_to_float(const struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLfloat *texelOut)
 {
    GLchan temp[4];
@@ -1019,14 +1020,14 @@ fetch_texel_chan_to_float(const struct gl_texture_image *texImage,
 /**
  * Initialize the texture image's FetchTexelc and FetchTexelf methods.
  */
-void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims)
+static void
+set_fetch_functions(struct swrast_texture_image *texImage, GLuint dims)
 {
-   gl_format format = texImage->TexFormat;
+   gl_format format = texImage->Base.TexFormat;
 
    ASSERT(dims == 1 || dims == 2 || dims == 3);
 
-   if (texImage->TexObject->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT &&
+   if (texImage->Base.TexObject->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT &&
        _mesa_get_format_color_encoding(format) == GL_SRGB) {
       format = _mesa_get_srgb_format_linear(format);
    }
@@ -1050,7 +1051,8 @@ _mesa_update_fetch_functions(struct gl_texture_object *texObj)
    for (face = 0; face < 6; face++) {
       for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
          if (texObj->Image[face][i]) {
-	    _mesa_set_fetch_functions(texObj->Image[face][i], dims);
+	    set_fetch_functions(swrast_texture_image(texObj->Image[face][i]),
+                                dims);
          }
       }
    }
diff --git a/src/mesa/swrast/s_texfetch.h b/src/mesa/swrast/s_texfetch.h
index 76e4e6c..19b196a 100644
--- a/src/mesa/swrast/s_texfetch.h
+++ b/src/mesa/swrast/s_texfetch.h
@@ -35,9 +35,6 @@ _mesa_get_texel_store_func(gl_format format);
 extern FetchTexelFuncF
 _mesa_get_texel_fetch_func(gl_format format, GLuint dims);
 
-extern void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
-
 void
 _mesa_update_fetch_functions(struct gl_texture_object *texObj);
 
diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h
index dbed3db..0a06dcb 100644
--- a/src/mesa/swrast/s_texfetch_tmp.h
+++ b/src/mesa/swrast/s_texfetch_tmp.h
@@ -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)->Base.Data + (i) * (size)))
 
 #define FETCH(x) fetch_texel_1d_##x
 
@@ -51,15 +51,15 @@
 
 #define TEXEL_ADDR( type, image, i, j, k, size )			\
 	((void) (k),							\
-	 ((type *)(image)->Data + ((image)->RowStride * (j) + (i)) * (size)))
+	 ((type *)(image)->Base.Data + ((image)->Base.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]		\
-             + (image)->RowStride * (j) + (i)) * (size))
+	((type *)(image)->Base.Data + ((image)->Base.ImageOffsets[k]		\
+             + (image)->Base.RowStride * (j) + (i)) * (size))
 
 #define FETCH(x) fetch_texel_3d_##x
 
@@ -74,7 +74,7 @@
  * 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);
@@ -82,7 +82,7 @@ static void FETCH(f_z32)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_z32(struct gl_texture_image *texImage,
+static void store_texel_z32(struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, const void *texel)
 {
    const GLuint *depth = (const GLuint *) texel;
@@ -98,7 +98,7 @@ 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);
@@ -106,7 +106,7 @@ static void FETCH(f_z16)(const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_z16(struct gl_texture_image *texImage,
+static void store_texel_z16(struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, const void *texel)
 {
    const GLushort *depth = (const GLushort *) texel;
@@ -120,7 +120,7 @@ static void store_texel_z16(struct gl_texture_image *texImage,
 
 /* 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);
@@ -131,7 +131,7 @@ static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgba_f32(struct gl_texture_image *texImage,
+static void store_texel_rgba_f32(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *depth = (const GLfloat *) texel;
@@ -149,7 +149,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);
@@ -160,7 +160,7 @@ static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgba_f16(struct gl_texture_image *texImage,
+static void store_texel_rgba_f16(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *src = (const GLfloat *) texel;
@@ -177,7 +177,7 @@ static void store_texel_rgba_f16(struct gl_texture_image *texImage,
 /* 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);
@@ -188,7 +188,7 @@ static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgb_f32(struct gl_texture_image *texImage,
+static void store_texel_rgb_f32(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *src = (const GLfloat *) texel;
@@ -205,7 +205,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);
@@ -216,7 +216,7 @@ static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgb_f16(struct gl_texture_image *texImage,
+static void store_texel_rgb_f16(struct swrast_texture_image *texImage,
                                 GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *src = (const GLfloat *) texel;
@@ -233,7 +233,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);
@@ -244,7 +244,7 @@ static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_alpha_f32(struct gl_texture_image *texImage,
+static void store_texel_alpha_f32(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -259,7 +259,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);
@@ -270,7 +270,7 @@ static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_alpha_f16(struct gl_texture_image *texImage,
+static void store_texel_alpha_f16(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -285,7 +285,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);
@@ -296,7 +296,7 @@ static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_luminance_f32(struct gl_texture_image *texImage,
+static void store_texel_luminance_f32(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -311,7 +311,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);
@@ -322,7 +322,7 @@ static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_luminance_f16(struct gl_texture_image *texImage,
+static void store_texel_luminance_f16(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -337,7 +337,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);
@@ -348,7 +348,7 @@ static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImag
 }
 
 #if DIM == 3
-static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage,
+static void store_texel_luminance_alpha_f32(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -364,7 +364,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);
@@ -375,7 +375,7 @@ static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImag
 }
 
 #if DIM == 3
-static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage,
+static void store_texel_luminance_alpha_f16(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -391,7 +391,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);
@@ -402,7 +402,7 @@ static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_intensity_f32(struct gl_texture_image *texImage,
+static void store_texel_intensity_f32(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -417,7 +417,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);
@@ -428,7 +428,7 @@ static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_intensity_f16(struct gl_texture_image *texImage,
+static void store_texel_intensity_f16(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -443,7 +443,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);
@@ -454,7 +454,7 @@ static void FETCH(f_r_f32)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_r_f32(struct gl_texture_image *texImage,
+static void store_texel_r_f32(struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -469,7 +469,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);
@@ -480,7 +480,7 @@ static void FETCH(f_r_f16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_r_f16(struct gl_texture_image *texImage,
+static void store_texel_r_f16(struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -495,7 +495,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);
@@ -506,7 +506,7 @@ static void FETCH(f_rg_f32)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rg_f32(struct gl_texture_image *texImage,
+static void store_texel_rg_f32(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -522,7 +522,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);
@@ -533,7 +533,7 @@ static void FETCH(f_rg_f16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rg_f16(struct gl_texture_image *texImage,
+static void store_texel_rg_f16(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *rgba = (const GLfloat *) texel;
@@ -551,7 +551,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);
@@ -564,7 +564,7 @@ static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
 
 
 #if DIM == 3
-static void store_texel_rgba8888(struct gl_texture_image *texImage,
+static void store_texel_rgba8888(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -577,7 +577,7 @@ static void store_texel_rgba8888(struct gl_texture_image *texImage,
 /* 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);
@@ -588,7 +588,7 @@ static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgba8888_rev(struct gl_texture_image *texImage,
+static void store_texel_rgba8888_rev(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -601,7 +601,7 @@ static void store_texel_rgba8888_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -612,7 +612,7 @@ static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_argb8888(struct gl_texture_image *texImage,
+static void store_texel_argb8888(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -625,7 +625,7 @@ static void store_texel_argb8888(struct gl_texture_image *texImage,
 /* 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);
@@ -636,7 +636,7 @@ static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_argb8888_rev(struct gl_texture_image *texImage,
+static void store_texel_argb8888_rev(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -649,7 +649,7 @@ static void store_texel_argb8888_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -660,7 +660,7 @@ static void FETCH(f_xrgb8888)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_xrgb8888(struct gl_texture_image *texImage,
+static void store_texel_xrgb8888(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -673,7 +673,7 @@ static void store_texel_xrgb8888(struct gl_texture_image *texImage,
 /* 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);
@@ -684,7 +684,7 @@ static void FETCH(f_xrgb8888_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_xrgb8888_rev(struct gl_texture_image *texImage,
+static void store_texel_xrgb8888_rev(struct swrast_texture_image *texImage,
                                      GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -697,7 +697,7 @@ static void store_texel_xrgb8888_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -708,7 +708,7 @@ static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgb888(struct gl_texture_image *texImage,
+static void store_texel_rgb888(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -723,7 +723,7 @@ static void store_texel_rgb888(struct gl_texture_image *texImage,
 /* 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);
@@ -734,7 +734,7 @@ static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_bgr888(struct gl_texture_image *texImage,
+static void store_texel_bgr888(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -752,7 +752,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);
@@ -764,7 +764,7 @@ static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgb565(struct gl_texture_image *texImage,
+static void store_texel_rgb565(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -777,7 +777,7 @@ static void store_texel_rgb565(struct gl_texture_image *texImage,
 /* 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);
@@ -789,7 +789,7 @@ static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
+static void store_texel_rgb565_rev(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -805,7 +805,7 @@ static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -817,7 +817,7 @@ static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_argb4444(struct gl_texture_image *texImage,
+static void store_texel_argb4444(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -833,7 +833,7 @@ static void store_texel_argb4444(struct gl_texture_image *texImage,
 /* 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);
@@ -844,7 +844,7 @@ static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
+static void store_texel_argb4444_rev(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -859,7 +859,7 @@ static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -871,7 +871,7 @@ static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgba5551(struct gl_texture_image *texImage,
+static void store_texel_rgba5551(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -883,7 +883,7 @@ static void store_texel_rgba5551(struct gl_texture_image *texImage,
 /* 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);
@@ -895,7 +895,7 @@ static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_argb1555(struct gl_texture_image *texImage,
+static void store_texel_argb1555(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -908,7 +908,7 @@ static void store_texel_argb1555(struct gl_texture_image *texImage,
 /* 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);
@@ -920,7 +920,7 @@ static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
+static void store_texel_argb1555_rev(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -933,7 +933,7 @@ static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -945,7 +945,7 @@ static void FETCH(f_argb2101010)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_argb2101010(struct gl_texture_image *texImage,
+static void store_texel_argb2101010(struct swrast_texture_image *texImage,
                                     GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -962,7 +962,7 @@ static void store_texel_argb2101010(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RG88 **********************************************************/
 
 /* 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_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);
@@ -973,7 +973,7 @@ static void FETCH(f_rg88)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rg88(struct gl_texture_image *texImage,
+static void store_texel_rg88(struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLubyte *) texel;
@@ -988,7 +988,7 @@ static void store_texel_rg88(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RG88_REV ******************************************************/
 
 /* 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_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);
@@ -999,7 +999,7 @@ static void FETCH(f_rg88_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rg88_rev(struct gl_texture_image *texImage,
+static void store_texel_rg88_rev(struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1012,7 +1012,7 @@ static void store_texel_rg88_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -1023,7 +1023,7 @@ static void FETCH(f_al44)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_al44(struct gl_texture_image *texImage,
+static void store_texel_al44(struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1036,7 +1036,7 @@ static void store_texel_al44(struct gl_texture_image *texImage,
 /* 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);
@@ -1047,7 +1047,7 @@ static void FETCH(f_al88)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_al88(struct gl_texture_image *texImage,
+static void store_texel_al88(struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1060,7 +1060,7 @@ static void store_texel_al88(struct gl_texture_image *texImage,
 /* 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);
@@ -1071,7 +1071,7 @@ static void FETCH(f_r8)(const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_r8(struct gl_texture_image *texImage,
+static void store_texel_r8(struct swrast_texture_image *texImage,
 			   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1084,7 +1084,7 @@ static void store_texel_r8(struct gl_texture_image *texImage,
 /* 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);
@@ -1095,7 +1095,7 @@ static void FETCH(f_r16)(const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_r16(struct gl_texture_image *texImage,
+static void store_texel_r16(struct swrast_texture_image *texImage,
 			    GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -1108,7 +1108,7 @@ static void store_texel_r16(struct gl_texture_image *texImage,
 /* 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);
@@ -1119,7 +1119,7 @@ static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_al88_rev(struct gl_texture_image *texImage,
+static void store_texel_al88_rev(struct swrast_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1132,7 +1132,7 @@ static void store_texel_al88_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -1143,7 +1143,7 @@ static void FETCH(f_rg1616)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rg1616(struct gl_texture_image *texImage,
+static void store_texel_rg1616(struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -1158,7 +1158,7 @@ static void store_texel_rg1616(struct gl_texture_image *texImage,
 /* 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);
@@ -1169,7 +1169,7 @@ static void FETCH(f_rg1616_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rg1616_rev(struct gl_texture_image *texImage,
+static void store_texel_rg1616_rev(struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1182,7 +1182,7 @@ static void store_texel_rg1616_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -1193,7 +1193,7 @@ static void FETCH(f_al1616)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_al1616(struct gl_texture_image *texImage,
+static void store_texel_al1616(struct swrast_texture_image *texImage,
                              GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -1208,7 +1208,7 @@ static void store_texel_al1616(struct gl_texture_image *texImage,
 /* 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);
@@ -1219,7 +1219,7 @@ static void FETCH(f_al1616_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_al1616_rev(struct gl_texture_image *texImage,
+static void store_texel_al1616_rev(struct swrast_texture_image *texImage,
 				   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLushort *rgba = (const GLushort *) texel;
@@ -1232,7 +1232,7 @@ static void store_texel_al1616_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -1244,7 +1244,7 @@ static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgb332(struct gl_texture_image *texImage,
+static void store_texel_rgb332(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1257,7 +1257,7 @@ static void store_texel_rgb332(struct gl_texture_image *texImage,
 /* 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);
@@ -1268,7 +1268,7 @@ static void FETCH(f_a8)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_a8(struct gl_texture_image *texImage,
+static void store_texel_a8(struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1281,7 +1281,7 @@ static void store_texel_a8(struct gl_texture_image *texImage,
 /* 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);
@@ -1292,7 +1292,7 @@ static void FETCH(f_a16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_a16(struct gl_texture_image *texImage,
+static void store_texel_a16(struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -1305,7 +1305,7 @@ static void store_texel_a16(struct gl_texture_image *texImage,
 /* 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);
@@ -1316,7 +1316,7 @@ static void FETCH(f_l8)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_l8(struct gl_texture_image *texImage,
+static void store_texel_l8(struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1329,7 +1329,7 @@ static void store_texel_l8(struct gl_texture_image *texImage,
 /* 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);
@@ -1340,7 +1340,7 @@ static void FETCH(f_l16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_l16(struct gl_texture_image *texImage,
+static void store_texel_l16(struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, const void *texel)
 {
    const GLushort *rgba = (const GLushort *) texel;
@@ -1353,7 +1353,7 @@ static void store_texel_l16(struct gl_texture_image *texImage,
 /* 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);
@@ -1364,7 +1364,7 @@ static void FETCH(f_i8)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_i8(struct gl_texture_image *texImage,
+static void store_texel_i8(struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1377,7 +1377,7 @@ static void store_texel_i8(struct gl_texture_image *texImage,
 /* 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);
@@ -1388,7 +1388,7 @@ static void FETCH(f_i16)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_i16(struct gl_texture_image *texImage,
+static void store_texel_i16(struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, const void *texel)
 {
    const GLushort *rgba = (const GLushort *) texel;
@@ -1400,7 +1400,7 @@ static void store_texel_i16(struct gl_texture_image *texImage,
 
 /* 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);
@@ -1411,7 +1411,7 @@ static void FETCH(srgb8)(const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_srgb8(struct gl_texture_image *texImage,
+static void store_texel_srgb8(struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1423,7 +1423,7 @@ static void store_texel_srgb8(struct gl_texture_image *texImage,
 #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);
@@ -1434,7 +1434,7 @@ static void FETCH(srgba8)(const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_srgba8(struct gl_texture_image *texImage,
+static void store_texel_srgba8(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1444,7 +1444,7 @@ static void store_texel_srgba8(struct gl_texture_image *texImage,
 #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);
@@ -1455,7 +1455,7 @@ static void FETCH(sargb8)(const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_sargb8(struct gl_texture_image *texImage,
+static void store_texel_sargb8(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1465,7 +1465,7 @@ static void store_texel_sargb8(struct gl_texture_image *texImage,
 #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);
@@ -1476,7 +1476,7 @@ static void FETCH(sl8)(const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_sl8(struct gl_texture_image *texImage,
+static void store_texel_sl8(struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1486,7 +1486,7 @@ static void store_texel_sl8(struct gl_texture_image *texImage,
 #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);
@@ -1497,7 +1497,7 @@ static void FETCH(sla8)(const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_sla8(struct gl_texture_image *texImage,
+static void store_texel_sla8(struct swrast_texture_image *texImage,
                             GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1511,7 +1511,7 @@ static void store_texel_sla8(struct gl_texture_image *texImage,
 /* 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);
@@ -1523,7 +1523,7 @@ FETCH(rgba_int8)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_rgba_int8(struct gl_texture_image *texImage,
+store_texel_rgba_int8(struct swrast_texture_image *texImage,
                       GLint i, GLint j, GLint k, const void *texel)
 {
    const GLbyte *rgba = (const GLbyte *) texel;
@@ -1539,7 +1539,7 @@ store_texel_rgba_int8(struct gl_texture_image *texImage,
 /* 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);
@@ -1551,7 +1551,7 @@ FETCH(rgba_int16)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_rgba_int16(struct gl_texture_image *texImage,
+store_texel_rgba_int16(struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, const void *texel)
 {
    const GLshort *rgba = (const GLshort *) texel;
@@ -1567,7 +1567,7 @@ store_texel_rgba_int16(struct gl_texture_image *texImage,
 /* 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);
@@ -1579,7 +1579,7 @@ FETCH(rgba_int32)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_rgba_int32(struct gl_texture_image *texImage,
+store_texel_rgba_int32(struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, const void *texel)
 {
    const GLint *rgba = (const GLint *) texel;
@@ -1595,7 +1595,7 @@ store_texel_rgba_int32(struct gl_texture_image *texImage,
 /* 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);
@@ -1607,7 +1607,7 @@ FETCH(rgba_uint8)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_rgba_uint8(struct gl_texture_image *texImage,
+store_texel_rgba_uint8(struct swrast_texture_image *texImage,
                       GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1623,7 +1623,7 @@ store_texel_rgba_uint8(struct gl_texture_image *texImage,
 /* 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);
@@ -1635,7 +1635,7 @@ FETCH(rgba_uint16)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_rgba_uint16(struct gl_texture_image *texImage,
+store_texel_rgba_uint16(struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, const void *texel)
 {
    const GLushort *rgba = (const GLushort *) texel;
@@ -1651,7 +1651,7 @@ store_texel_rgba_uint16(struct gl_texture_image *texImage,
 /* 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);
@@ -1663,7 +1663,7 @@ FETCH(rgba_uint32)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_rgba_uint32(struct gl_texture_image *texImage,
+store_texel_rgba_uint32(struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, const void *texel)
 {
    const GLuint *rgba = (const GLuint *) texel;
@@ -1680,7 +1680,7 @@ store_texel_rgba_uint32(struct gl_texture_image *texImage,
 
 /* 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 +1693,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);
@@ -1704,7 +1704,7 @@ static void FETCH(signed_r8)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_signed_r8(struct gl_texture_image *texImage,
+static void store_texel_signed_r8(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLbyte *rgba = (const GLbyte *) texel;
@@ -1716,7 +1716,7 @@ static void store_texel_signed_r8(struct gl_texture_image *texImage,
 
 /* 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);
@@ -1727,7 +1727,7 @@ static void FETCH(signed_a8)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_signed_a8(struct gl_texture_image *texImage,
+static void store_texel_signed_a8(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLbyte *rgba = (const GLbyte *) texel;
@@ -1739,7 +1739,7 @@ static void store_texel_signed_a8(struct gl_texture_image *texImage,
 
 /* 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);
@@ -1750,7 +1750,7 @@ static void FETCH(signed_l8)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_signed_l8(struct gl_texture_image *texImage,
+static void store_texel_signed_l8(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLbyte *rgba = (const GLbyte *) texel;
@@ -1762,7 +1762,7 @@ static void store_texel_signed_l8(struct gl_texture_image *texImage,
 
 /* 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);
@@ -1773,7 +1773,7 @@ static void FETCH(signed_i8)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_signed_i8(struct gl_texture_image *texImage,
+static void store_texel_signed_i8(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    const GLbyte *rgba = (const GLbyte *) texel;
@@ -1785,7 +1785,7 @@ static void store_texel_signed_i8(struct gl_texture_image *texImage,
 
 /* 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);
@@ -1796,7 +1796,7 @@ static void FETCH(signed_rg88_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_signed_rg88_rev(struct gl_texture_image *texImage,
+static void store_texel_signed_rg88_rev(struct swrast_texture_image *texImage,
                                         GLint i, GLint j, GLint k, const void *texel)
 {
    const GLbyte *rg = (const GLbyte *) texel;
@@ -1808,7 +1808,7 @@ static void store_texel_signed_rg88_rev(struct gl_texture_image *texImage,
 
 /* 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);
@@ -1819,7 +1819,7 @@ static void FETCH(signed_al88)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_signed_al88(struct gl_texture_image *texImage,
+static void store_texel_signed_al88(struct swrast_texture_image *texImage,
                                     GLint i, GLint j, GLint k, const void *texel)
 {
    const GLbyte *rg = (const GLbyte *) texel;
@@ -1831,7 +1831,7 @@ static void store_texel_signed_al88(struct gl_texture_image *texImage,
 
 /* 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);
@@ -1842,7 +1842,7 @@ static void FETCH(signed_rgbx8888)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_signed_rgbx8888(struct gl_texture_image *texImage,
+static void store_texel_signed_rgbx8888(struct swrast_texture_image *texImage,
                                         GLint i, GLint j, GLint k, const void *texel)
 {
    const GLbyte *rgba = (const GLbyte *) texel;
@@ -1854,7 +1854,7 @@ static void store_texel_signed_rgbx8888(struct gl_texture_image *texImage,
 
 /* 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);
@@ -1865,7 +1865,7 @@ static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_signed_rgba8888(struct gl_texture_image *texImage,
+static void store_texel_signed_rgba8888(struct swrast_texture_image *texImage,
                                         GLint i, GLint j, GLint k, const void *texel)
 {
    const GLbyte *rgba = (const GLbyte *) texel;
@@ -1874,7 +1874,7 @@ static void store_texel_signed_rgba8888(struct gl_texture_image *texImage,
 }
 #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);
@@ -1885,7 +1885,7 @@ static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
+static void store_texel_signed_rgba8888_rev(struct swrast_texture_image *texImage,
                                             GLint i, GLint j, GLint k, const void *texel)
 {
    const GLubyte *rgba = (const GLubyte *) texel;
@@ -1899,7 +1899,7 @@ static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
 /* 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);
@@ -1911,7 +1911,7 @@ FETCH(signed_r16)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_signed_r16(struct gl_texture_image *texImage,
+store_texel_signed_r16(struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, const void *texel)
 {
    const GLshort *rgba = (const GLshort *) texel;
@@ -1924,7 +1924,7 @@ store_texel_signed_r16(struct gl_texture_image *texImage,
 /* 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);
@@ -1936,7 +1936,7 @@ FETCH(signed_a16)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_signed_a16(struct gl_texture_image *texImage,
+store_texel_signed_a16(struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, const void *texel)
 {
    const GLshort *rgba = (const GLshort *) texel;
@@ -1949,7 +1949,7 @@ store_texel_signed_a16(struct gl_texture_image *texImage,
 /* 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);
@@ -1961,7 +1961,7 @@ FETCH(signed_l16)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_signed_l16(struct gl_texture_image *texImage,
+store_texel_signed_l16(struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, const void *texel)
 {
    const GLshort *rgba = (const GLshort *) texel;
@@ -1974,7 +1974,7 @@ store_texel_signed_l16(struct gl_texture_image *texImage,
 /* 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);
@@ -1986,7 +1986,7 @@ FETCH(signed_i16)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_signed_i16(struct gl_texture_image *texImage,
+store_texel_signed_i16(struct swrast_texture_image *texImage,
                        GLint i, GLint j, GLint k, const void *texel)
 {
    const GLshort *rgba = (const GLshort *) texel;
@@ -1999,7 +1999,7 @@ store_texel_signed_i16(struct gl_texture_image *texImage,
 /* 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);
@@ -2011,7 +2011,7 @@ FETCH(signed_rg1616)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_signed_rg1616(struct gl_texture_image *texImage,
+store_texel_signed_rg1616(struct swrast_texture_image *texImage,
                          GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -2025,7 +2025,7 @@ store_texel_signed_rg1616(struct gl_texture_image *texImage,
 /* 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);
@@ -2037,7 +2037,7 @@ FETCH(signed_al1616)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_signed_al1616(struct gl_texture_image *texImage,
+store_texel_signed_al1616(struct swrast_texture_image *texImage,
                          GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -2051,7 +2051,7 @@ store_texel_signed_al1616(struct gl_texture_image *texImage,
 /* 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);
@@ -2063,7 +2063,7 @@ FETCH(signed_rgb_16)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_signed_rgb_16(struct gl_texture_image *texImage,
+store_texel_signed_rgb_16(struct swrast_texture_image *texImage,
                           GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -2078,7 +2078,7 @@ store_texel_signed_rgb_16(struct gl_texture_image *texImage,
 /* 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);
@@ -2090,7 +2090,7 @@ FETCH(signed_rgba_16)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_signed_rgba_16(struct gl_texture_image *texImage,
+store_texel_signed_rgba_16(struct swrast_texture_image *texImage,
                            GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -2107,7 +2107,7 @@ store_texel_signed_rgba_16(struct gl_texture_image *texImage,
 /* 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);
@@ -2119,7 +2119,7 @@ FETCH(rgba_16)(const struct gl_texture_image *texImage,
 
 #if DIM == 3
 static void
-store_texel_rgba_16(struct gl_texture_image *texImage,
+store_texel_rgba_16(struct swrast_texture_image *texImage,
                     GLint i, GLint j, GLint k, const void *texel)
 {
    const GLchan *rgba = (const GLchan *) texel;
@@ -2138,7 +2138,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 */
@@ -2161,7 +2161,7 @@ static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_ycbcr(struct gl_texture_image *texImage,
+static void store_texel_ycbcr(struct swrast_texture_image *texImage,
                               GLint i, GLint j, GLint k, const void *texel)
 {
    (void) texImage;
@@ -2179,7 +2179,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 */
@@ -2202,7 +2202,7 @@ static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_ycbcr_rev(struct gl_texture_image *texImage,
+static void store_texel_ycbcr_rev(struct swrast_texture_image *texImage,
                                   GLint i, GLint j, GLint k, const void *texel)
 {
    (void) texImage;
@@ -2217,21 +2217,21 @@ static void store_texel_ycbcr_rev(struct gl_texture_image *texImage,
 
 /* 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;
    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,
+static void store_texel_z24_s8(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    /* only store Z, not stencil */
@@ -2245,21 +2245,21 @@ static void store_texel_z24_s8(struct gl_texture_image *texImage,
 
 /* 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;
    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,
+static void store_texel_s8_z24(struct swrast_texture_image *texImage,
                                GLint i, GLint j, GLint k, const void *texel)
 {
    /* only store Z, not stencil */
@@ -2273,7 +2273,7 @@ static void store_texel_s8_z24(struct gl_texture_image *texImage,
 
 /* 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);
@@ -2282,7 +2282,7 @@ static void FETCH(rgb9_e5)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_rgb9_e5(struct gl_texture_image *texImage,
+static void store_texel_rgb9_e5(struct swrast_texture_image *texImage,
                                 GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *src = (const GLfloat *) texel;
@@ -2294,7 +2294,7 @@ static void store_texel_rgb9_e5(struct gl_texture_image *texImage,
 
 /* 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);
@@ -2303,7 +2303,7 @@ static void FETCH(r11_g11_b10f)( const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_r11_g11_b10f(struct gl_texture_image *texImage,
+static void store_texel_r11_g11_b10f(struct swrast_texture_image *texImage,
                                      GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *src = (const GLfloat *) texel;
@@ -2315,7 +2315,7 @@ static void store_texel_r11_g11_b10f(struct gl_texture_image *texImage,
 
 /* 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);
@@ -2326,7 +2326,7 @@ static void FETCH(z32f_x24s8)(const struct gl_texture_image *texImage,
 }
 
 #if DIM == 3
-static void store_texel_z32f_x24s8(struct gl_texture_image *texImage,
+static void store_texel_z32f_x24s8(struct swrast_texture_image *texImage,
                                    GLint i, GLint j, GLint k, const void *texel)
 {
    const GLfloat *src = (const GLfloat *) texel;
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index ad31e37..a7a190a 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -802,6 +802,7 @@ sample_1d_nearest(struct gl_context *ctx,
                   const struct gl_texture_image *img,
                   const GLfloat texcoord[4], GLfloat rgba[4])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;  /* without border, power of two */
    GLint i;
    i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]);
@@ -812,7 +813,7 @@ sample_1d_nearest(struct gl_context *ctx,
       get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelf(img, i, 0, 0, rgba);
+      swImg->FetchTexelf(swImg, i, 0, 0, rgba);
    }
 }
 
@@ -826,6 +827,7 @@ sample_1d_linear(struct gl_context *ctx,
                  const struct gl_texture_image *img,
                  const GLfloat texcoord[4], GLfloat rgba[4])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;
    GLint i0, i1;
    GLbitfield useBorderColor = 0x0;
@@ -848,13 +850,13 @@ sample_1d_linear(struct gl_context *ctx,
       get_border_color(tObj, img, t0);
    }
    else {
-      img->FetchTexelf(img, i0, 0, 0, t0);
+      swImg->FetchTexelf(swImg, i0, 0, 0, t0);
    }
    if (useBorderColor & I1BIT) {
       get_border_color(tObj, img, t1);
    }
    else {
-      img->FetchTexelf(img, i1, 0, 0, t1);
+      swImg->FetchTexelf(swImg, i1, 0, 0, t1);
    }
 
    lerp_rgba(rgba, a, t0, t1);
@@ -1060,6 +1062,7 @@ sample_2d_nearest(struct gl_context *ctx,
                   const GLfloat texcoord[4],
                   GLfloat rgba[])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;    /* without border, power of two */
    const GLint height = img->Height2;  /* without border, power of two */
    GLint i, j;
@@ -1077,7 +1080,7 @@ sample_2d_nearest(struct gl_context *ctx,
       get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelf(img, i, j, 0, rgba);
+      swImg->FetchTexelf(swImg, i, j, 0, rgba);
    }
 }
 
@@ -1093,6 +1096,7 @@ sample_2d_linear(struct gl_context *ctx,
                  const GLfloat texcoord[4],
                  GLfloat rgba[])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;
    const GLint height = img->Height2;
    GLint i0, j0, i1, j1;
@@ -1121,25 +1125,25 @@ sample_2d_linear(struct gl_context *ctx,
       get_border_color(tObj, img, t00);
    }
    else {
-      img->FetchTexelf(img, i0, j0, 0, t00);
+      swImg->FetchTexelf(swImg, i0, j0, 0, t00);
    }
    if (useBorderColor & (I1BIT | J0BIT)) {
       get_border_color(tObj, img, t10);
    }
    else {
-      img->FetchTexelf(img, i1, j0, 0, t10);
+      swImg->FetchTexelf(swImg, i1, j0, 0, t10);
    }
    if (useBorderColor & (I0BIT | J1BIT)) {
       get_border_color(tObj, img, t01);
    }
    else {
-      img->FetchTexelf(img, i0, j1, 0, t01);
+      swImg->FetchTexelf(swImg, i0, j1, 0, t01);
    }
    if (useBorderColor & (I1BIT | J1BIT)) {
       get_border_color(tObj, img, t11);
    }
    else {
-      img->FetchTexelf(img, i1, j1, 0, t11);
+      swImg->FetchTexelf(swImg, i1, j1, 0, t11);
    }
 
    lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11);
@@ -1157,6 +1161,7 @@ sample_2d_linear_repeat(struct gl_context *ctx,
                         const GLfloat texcoord[4],
                         GLfloat rgba[])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;
    const GLint height = img->Height2;
    GLint i0, j0, i1, j1;
@@ -1173,10 +1178,10 @@ sample_2d_linear_repeat(struct gl_context *ctx,
    linear_repeat_texel_location(width,  texcoord[0], &i0, &i1, &wi);
    linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj);
 
-   img->FetchTexelf(img, i0, j0, 0, t00);
-   img->FetchTexelf(img, i1, j0, 0, t10);
-   img->FetchTexelf(img, i0, j1, 0, t01);
-   img->FetchTexelf(img, i1, j1, 0, t11);
+   swImg->FetchTexelf(swImg, i0, j0, 0, t00);
+   swImg->FetchTexelf(swImg, i1, j0, 0, t10);
+   swImg->FetchTexelf(swImg, i0, j1, 0, t01);
+   swImg->FetchTexelf(swImg, i1, j1, 0, t11);
 
    lerp_rgba_2d(rgba, wi, wj, t00, t10, t01, t11);
 }
@@ -1934,6 +1939,7 @@ sample_3d_nearest(struct gl_context *ctx,
                   const GLfloat texcoord[4],
                   GLfloat rgba[4])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;     /* without border, power of two */
    const GLint height = img->Height2;   /* without border, power of two */
    const GLint depth = img->Depth2;     /* without border, power of two */
@@ -1951,7 +1957,7 @@ sample_3d_nearest(struct gl_context *ctx,
       get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelf(img, i, j, k, rgba);
+      swImg->FetchTexelf(swImg, i, j, k, rgba);
    }
 }
 
@@ -1966,6 +1972,7 @@ sample_3d_linear(struct gl_context *ctx,
                  const GLfloat texcoord[4],
                  GLfloat rgba[4])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;
    const GLint height = img->Height2;
    const GLint depth = img->Depth2;
@@ -2002,50 +2009,50 @@ sample_3d_linear(struct gl_context *ctx,
       get_border_color(tObj, img, t000);
    }
    else {
-      img->FetchTexelf(img, i0, j0, k0, t000);
+      swImg->FetchTexelf(swImg, i0, j0, k0, t000);
    }
    if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
       get_border_color(tObj, img, t100);
    }
    else {
-      img->FetchTexelf(img, i1, j0, k0, t100);
+      swImg->FetchTexelf(swImg, i1, j0, k0, t100);
    }
    if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
       get_border_color(tObj, img, t010);
    }
    else {
-      img->FetchTexelf(img, i0, j1, k0, t010);
+      swImg->FetchTexelf(swImg, i0, j1, k0, t010);
    }
    if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
       get_border_color(tObj, img, t110);
    }
    else {
-      img->FetchTexelf(img, i1, j1, k0, t110);
+      swImg->FetchTexelf(swImg, i1, j1, k0, t110);
    }
 
    if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
       get_border_color(tObj, img, t001);
    }
    else {
-      img->FetchTexelf(img, i0, j0, k1, t001);
+      swImg->FetchTexelf(swImg, i0, j0, k1, t001);
    }
    if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
       get_border_color(tObj, img, t101);
    }
    else {
-      img->FetchTexelf(img, i1, j0, k1, t101);
+      swImg->FetchTexelf(swImg, i1, j0, k1, t101);
    }
    if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
       get_border_color(tObj, img, t011);
    }
    else {
-      img->FetchTexelf(img, i0, j1, k1, t011);
+      swImg->FetchTexelf(swImg, i0, j1, k1, t011);
    }
    if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
       get_border_color(tObj, img, t111);
    }
    else {
-      img->FetchTexelf(img, i1, j1, k1, t111);
+      swImg->FetchTexelf(swImg, i1, j1, k1, t111);
    }
 
    /* trilinear interpolation of samples */
@@ -2544,6 +2551,7 @@ sample_nearest_rect(struct gl_context *ctx,
                     GLfloat rgba[][4])
 {
    const struct gl_texture_image *img = tObj->Image[0][0];
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width;
    const GLint height = img->Height;
    GLuint i;
@@ -2565,7 +2573,7 @@ sample_nearest_rect(struct gl_context *ctx,
       if (col < 0 || col >= width || row < 0 || row >= height)
          get_border_color(tObj, img, rgba[i]);
       else
-         img->FetchTexelf(img, col, row, 0, rgba[i]);
+         swImg->FetchTexelf(swImg, col, row, 0, rgba[i]);
    }
 }
 
@@ -2577,6 +2585,7 @@ sample_linear_rect(struct gl_context *ctx,
 		   const GLfloat lambda[], GLfloat rgba[][4])
 {
    const struct gl_texture_image *img = tObj->Image[0][0];
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width;
    const GLint height = img->Height;
    GLuint i;
@@ -2612,22 +2621,22 @@ sample_linear_rect(struct gl_context *ctx,
       if (useBorderColor & (I0BIT | J0BIT))
          get_border_color(tObj, img, t00);
       else
-         img->FetchTexelf(img, i0, j0, 0, t00);
+         swImg->FetchTexelf(swImg, i0, j0, 0, t00);
 
       if (useBorderColor & (I1BIT | J0BIT))
          get_border_color(tObj, img, t10);
       else
-         img->FetchTexelf(img, i1, j0, 0, t10);
+         swImg->FetchTexelf(swImg, i1, j0, 0, t10);
 
       if (useBorderColor & (I0BIT | J1BIT))
          get_border_color(tObj, img, t01);
       else
-         img->FetchTexelf(img, i0, j1, 0, t01);
+         swImg->FetchTexelf(swImg, i0, j1, 0, t01);
 
       if (useBorderColor & (I1BIT | J1BIT))
          get_border_color(tObj, img, t11);
       else
-         img->FetchTexelf(img, i1, j1, 0, t11);
+         swImg->FetchTexelf(swImg, i1, j1, 0, t11);
 
       lerp_rgba_2d(rgba[i], a, b, t00, t10, t01, t11);
    }
@@ -2686,6 +2695,7 @@ sample_2d_array_nearest(struct gl_context *ctx,
                         const GLfloat texcoord[4],
                         GLfloat rgba[4])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;     /* without border, power of two */
    const GLint height = img->Height2;   /* without border, power of two */
    const GLint depth = img->Depth;
@@ -2704,7 +2714,7 @@ sample_2d_array_nearest(struct gl_context *ctx,
       get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelf(img, i, j, array, rgba);
+      swImg->FetchTexelf(swImg, i, j, array, rgba);
    }
 }
 
@@ -2719,6 +2729,7 @@ sample_2d_array_linear(struct gl_context *ctx,
                        const GLfloat texcoord[4],
                        GLfloat rgba[4])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;
    const GLint height = img->Height2;
    const GLint depth = img->Depth;
@@ -2755,25 +2766,25 @@ sample_2d_array_linear(struct gl_context *ctx,
          get_border_color(tObj, img, t00);
       }
       else {
-	 img->FetchTexelf(img, i0, j0, array, t00);
+	 swImg->FetchTexelf(swImg, i0, j0, array, t00);
       }
       if (useBorderColor & (I1BIT | J0BIT)) {
          get_border_color(tObj, img, t10);
       }
       else {
-	 img->FetchTexelf(img, i1, j0, array, t10);
+	 swImg->FetchTexelf(swImg, i1, j0, array, t10);
       }
       if (useBorderColor & (I0BIT | J1BIT)) {
          get_border_color(tObj, img, t01);
       }
       else {
-	 img->FetchTexelf(img, i0, j1, array, t01);
+	 swImg->FetchTexelf(swImg, i0, j1, array, t01);
       }
       if (useBorderColor & (I1BIT | J1BIT)) {
          get_border_color(tObj, img, t11);
       }
       else {
-	 img->FetchTexelf(img, i1, j1, array, t11);
+	 swImg->FetchTexelf(swImg, i1, j1, array, t11);
       }
       
       /* trilinear interpolation of samples */
@@ -2996,6 +3007,7 @@ sample_1d_array_nearest(struct gl_context *ctx,
                         const GLfloat texcoord[4],
                         GLfloat rgba[4])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;     /* without border, power of two */
    const GLint height = img->Height;
    GLint i;
@@ -3011,7 +3023,7 @@ sample_1d_array_nearest(struct gl_context *ctx,
       get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelf(img, i, array, 0, rgba);
+      swImg->FetchTexelf(swImg, i, array, 0, rgba);
    }
 }
 
@@ -3026,6 +3038,7 @@ sample_1d_array_linear(struct gl_context *ctx,
                        const GLfloat texcoord[4],
                        GLfloat rgba[4])
 {
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width2;
    const GLint height = img->Height;
    GLint i0, i1;
@@ -3054,13 +3067,13 @@ sample_1d_array_linear(struct gl_context *ctx,
       get_border_color(tObj, img, t0);
    }
    else {
-      img->FetchTexelf(img, i0, array, 0, t0);
+      swImg->FetchTexelf(swImg, i0, array, 0, t0);
    }
    if (useBorderColor & (I1BIT | K0BIT)) {
       get_border_color(tObj, img, t1);
    }
    else {
-      img->FetchTexelf(img, i1, array, 0, t1);
+      swImg->FetchTexelf(swImg, i1, array, 0, t1);
    }
 
    /* bilinear interpolation of samples */
@@ -3388,6 +3401,7 @@ sample_depth_texture( struct gl_context *ctx,
 {
    const GLint level = choose_depth_texture_level(tObj, lambda[0]);
    const struct gl_texture_image *img = tObj->Image[0][level];
+   const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
    const GLint width = img->Width;
    const GLint height = img->Height;
    const GLint depth = img->Depth;
@@ -3423,7 +3437,7 @@ sample_depth_texture( struct gl_context *ctx,
 
          if (col >= 0 && row >= 0 && col < width && row < height && 
              slice >= 0 && slice < depth) {
-            img->FetchTexelf(img, col, row, slice, &depthSample);
+            swImg->FetchTexelf(swImg, col, row, slice, &depthSample);
          }
          else {
             depthSample = tObj->Sampler.BorderColor.f[0];
@@ -3492,13 +3506,13 @@ sample_depth_texture( struct gl_context *ctx,
                depth00 = tObj->Sampler.BorderColor.f[0];
             }
             else {
-               img->FetchTexelf(img, i0, j0, slice, &depth00);
+               swImg->FetchTexelf(swImg, i0, j0, slice, &depth00);
             }
             if (useBorderTexel & (I1BIT | J0BIT)) {
                depth10 = tObj->Sampler.BorderColor.f[0];
             }
             else {
-               img->FetchTexelf(img, i1, j0, slice, &depth10);
+               swImg->FetchTexelf(swImg, i1, j0, slice, &depth10);
             }
 
             if (tObj->Target != GL_TEXTURE_1D_ARRAY_EXT) {
@@ -3506,13 +3520,13 @@ sample_depth_texture( struct gl_context *ctx,
                   depth01 = tObj->Sampler.BorderColor.f[0];
                }
                else {
-                  img->FetchTexelf(img, i0, j1, slice, &depth01);
+                  swImg->FetchTexelf(swImg, i0, j1, slice, &depth01);
                }
                if (useBorderTexel & (I1BIT | J1BIT)) {
                   depth11 = tObj->Sampler.BorderColor.f[0];
                }
                else {
-                  img->FetchTexelf(img, i1, j1, slice, &depth11);
+                  swImg->FetchTexelf(swImg, i1, j1, slice, &depth11);
                }
             }
             else {
diff --git a/src/mesa/swrast/s_texrender.c b/src/mesa/swrast/s_texrender.c
index b32b9e1..6439528 100644
--- a/src/mesa/swrast/s_texrender.c
+++ b/src/mesa/swrast/s_texrender.c
@@ -6,6 +6,7 @@
 #include "main/teximage.h"
 #include "main/renderbuffer.h"
 #include "swrast/swrast.h"
+#include "swrast/s_context.h"
 #include "swrast/s_texfetch.h"
 
 
@@ -20,7 +21,7 @@
 struct texture_renderbuffer
 {
    struct gl_renderbuffer Base;   /**< Base class object */
-   struct gl_texture_image *TexImage;
+   struct swrast_texture_image *TexImage;
    StoreTexelFunc Store;
    FetchTexelFuncF Fetchf;
    GLint Yoffset;                 /**< Layer for 1D array textures. */
@@ -42,8 +43,8 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
    const GLint z = trb->Zoffset;
    GLuint i;
 
-   ASSERT(trb->TexImage->Width == rb->Width);
-   ASSERT(trb->TexImage->Height == rb->Height);
+   ASSERT(trb->TexImage->Base.Width == rb->Width);
+   ASSERT(trb->TexImage->Base.Height == rb->Height);
 
    y += trb->Yoffset;
 
@@ -468,7 +469,7 @@ texture_put_mono_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
 
 
 static void
-store_nop(struct gl_texture_image *texImage,
+store_nop(struct swrast_texture_image *texImage,
           GLint col, GLint row, GLint img,
           const void *texel)
 {
@@ -534,17 +535,17 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
    (void) ctx;
    ASSERT(trb);
 
-   trb->TexImage = _mesa_get_attachment_teximage(att);
+   trb->TexImage = swrast_texture_image(_mesa_get_attachment_teximage(att));
    ASSERT(trb->TexImage);
 
-   trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat);
+   trb->Store = _mesa_get_texel_store_func(trb->TexImage->Base.TexFormat);
    if (!trb->Store) {
       /* we'll never draw into some textures (compressed formats) */
       trb->Store = store_nop;
    }
 
    if (!trb->TexImage->FetchTexelf) {
-      _mesa_update_fetch_functions(trb->TexImage->TexObject);
+      _mesa_update_fetch_functions(trb->TexImage->Base.TexObject);
    }
    trb->Fetchf = trb->TexImage->FetchTexelf;
    assert(trb->Fetchf);
@@ -558,13 +559,13 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
       trb->Zoffset = att->Zoffset;
    }
 
-   trb->Base.Width = trb->TexImage->Width;
-   trb->Base.Height = trb->TexImage->Height;
-   trb->Base.InternalFormat = trb->TexImage->InternalFormat;
-   trb->Base.Format = trb->TexImage->TexFormat;
+   trb->Base.Width = trb->TexImage->Base.Width;
+   trb->Base.Height = trb->TexImage->Base.Height;
+   trb->Base.InternalFormat = trb->TexImage->Base.InternalFormat;
+   trb->Base.Format = trb->TexImage->Base.TexFormat;
 
    /* XXX may need more special cases here */
-   switch (trb->TexImage->TexFormat) {
+   switch (trb->TexImage->Base.TexFormat) {
    case MESA_FORMAT_Z24_S8:
       trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
       trb->Base._BaseFormat = GL_DEPTH_STENCIL;
@@ -609,7 +610,7 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
       trb->Base.DataType = CHAN_TYPE;
       trb->Base._BaseFormat = GL_RGBA;
    }
-   trb->Base.Data = trb->TexImage->Data;
+   trb->Base.Data = trb->TexImage->Base.Data;
 }
 
 
-- 
1.7.3.4



More information about the mesa-dev mailing list