remove ^M chars, disable shading language extensions
[mesa.git] / src / mesa / main / texformat.c
index 31a99f5d3301ec21f3f49b1d00ac5750686fb237..3cbc7c88f8dff4d2e9d1defcd7a5a9a00dd77ecd 100644 (file)
@@ -40,8 +40,8 @@
 #include "texformat.h"
 #include "teximage.h"
 #include "texstate.h"
+#include "texstore.h"
 
-#include "newstore.h"
 
 
 /* Texel fetch routines for all supported formats
@@ -63,6 +63,7 @@
 static void fetch_null_texel( const struct gl_texture_image *texImage,
                              GLint i, GLint j, GLint k, GLchan *texel )
 {
+   (void) texImage; (void) i; (void) j; (void) k;
    texel[RCOMP] = 0;
    texel[GCOMP] = 0;
    texel[BCOMP] = 0;
@@ -73,6 +74,7 @@ static void fetch_null_texel( const struct gl_texture_image *texImage,
 static void fetch_null_texelf( const struct gl_texture_image *texImage,
                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
+   (void) texImage; (void) i; (void) j; (void) k;
    texel[RCOMP] = 0.0;
    texel[GCOMP] = 0.0;
    texel[BCOMP] = 0.0;
@@ -80,6 +82,13 @@ 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,
+                             GLint i, GLint j, GLint k, const void *texel)
+{
+   /* no-op */
+}
+
+
 
 /***************************************************************/
 /** \name Default GLchan-based formats */
@@ -97,7 +106,7 @@ const struct gl_texture_format _mesa_texformat_rgba = {
    0,                                  /* IntensityBits */
    0,                                  /* IndexBits */
    0,                                  /* DepthBits */
-   4 * CHAN_BITS / 8,                  /* TexelBytes */
+   4 * sizeof(GLchan),                 /* TexelBytes */
    _mesa_texstore_rgba,                        /* StoreTexImageFunc */
    fetch_texel_1d_rgba,                        /* FetchTexel1D */
    fetch_texel_2d_rgba,                        /* FetchTexel2D */
@@ -105,6 +114,7 @@ const struct gl_texture_format _mesa_texformat_rgba = {
    fetch_texel_1d_f_rgba,              /* FetchTexel1Df */
    fetch_texel_2d_f_rgba,              /* FetchTexel2Df */
    fetch_texel_3d_f_rgba,              /* FetchTexel3Df */
+   store_texel_rgba                    /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_rgb = {
@@ -119,7 +129,7 @@ const struct gl_texture_format _mesa_texformat_rgb = {
    0,                                  /* IntensityBits */
    0,                                  /* IndexBits */
    0,                                  /* DepthBits */
-   3 * CHAN_BITS / 8,                  /* TexelBytes */
+   3 * sizeof(GLchan),                 /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
    fetch_texel_1d_rgb,                 /* FetchTexel1D */
    fetch_texel_2d_rgb,                 /* FetchTexel2D */
@@ -127,6 +137,7 @@ const struct gl_texture_format _mesa_texformat_rgb = {
    fetch_texel_1d_f_rgb,               /* FetchTexel1Df */
    fetch_texel_2d_f_rgb,               /* FetchTexel2Df */
    fetch_texel_3d_f_rgb,               /* FetchTexel3Df */
+   store_texel_rgb                     /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_alpha = {
@@ -141,7 +152,7 @@ const struct gl_texture_format _mesa_texformat_alpha = {
    0,                                  /* IntensityBits */
    0,                                  /* IndexBits */
    0,                                  /* DepthBits */
-   CHAN_BITS / 8,                      /* TexelBytes */
+   sizeof(GLchan),                     /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
    fetch_texel_1d_alpha,               /* FetchTexel1D */
    fetch_texel_2d_alpha,               /* FetchTexel2D */
@@ -149,6 +160,7 @@ const struct gl_texture_format _mesa_texformat_alpha = {
    fetch_texel_1d_f_alpha,             /* FetchTexel1Df */
    fetch_texel_2d_f_alpha,             /* FetchTexel2Df */
    fetch_texel_3d_f_alpha,             /* FetchTexel3Df */
+   store_texel_alpha                   /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_luminance = {
@@ -163,7 +175,7 @@ const struct gl_texture_format _mesa_texformat_luminance = {
    0,                                  /* IntensityBits */
    0,                                  /* IndexBits */
    0,                                  /* DepthBits */
-   CHAN_BITS / 8,                      /* TexelBytes */
+   sizeof(GLchan),                     /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
    fetch_texel_1d_luminance,           /* FetchTexel1D */
    fetch_texel_2d_luminance,           /* FetchTexel2D */
@@ -171,6 +183,7 @@ const struct gl_texture_format _mesa_texformat_luminance = {
    fetch_texel_1d_f_luminance,         /* FetchTexel1Df */
    fetch_texel_2d_f_luminance,         /* FetchTexel2Df */
    fetch_texel_3d_f_luminance,         /* FetchTexel3Df */
+   store_texel_luminance               /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_luminance_alpha = {
@@ -185,7 +198,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = {
    0,                                  /* IntensityBits */
    0,                                  /* IndexBits */
    0,                                  /* DepthBits */
-   2 * CHAN_BITS / 8,                  /* TexelBytes */
+   2 * sizeof(GLchan),                 /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
    fetch_texel_1d_luminance_alpha,     /* FetchTexel1D */
    fetch_texel_2d_luminance_alpha,     /* FetchTexel2D */
@@ -193,6 +206,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = {
    fetch_texel_1d_f_luminance_alpha,   /* FetchTexel1Df */
    fetch_texel_2d_f_luminance_alpha,   /* FetchTexel2Df */
    fetch_texel_3d_f_luminance_alpha,   /* FetchTexel3Df */
+   store_texel_luminance_alpha         /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_intensity = {
@@ -207,7 +221,7 @@ const struct gl_texture_format _mesa_texformat_intensity = {
    CHAN_BITS,                          /* IntensityBits */
    0,                                  /* IndexBits */
    0,                                  /* DepthBits */
-   CHAN_BITS / 8,                      /* TexelBytes */
+   sizeof(GLchan),                     /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
    fetch_texel_1d_intensity,           /* FetchTexel1D */
    fetch_texel_2d_intensity,           /* FetchTexel2D */
@@ -215,28 +229,7 @@ const struct gl_texture_format _mesa_texformat_intensity = {
    fetch_texel_1d_f_intensity,         /* FetchTexel1Df */
    fetch_texel_2d_f_intensity,         /* FetchTexel2Df */
    fetch_texel_3d_f_intensity,         /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _mesa_texformat_color_index = {
-   MESA_FORMAT_COLOR_INDEX,            /* MesaFormat */
-   GL_COLOR_INDEX,                     /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   0,                                  /* RedBits */
-   0,                                  /* GreenBits */
-   0,                                  /* BlueBits */
-   0,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   CHAN_BITS,                          /* IndexBits */
-   0,                                  /* DepthBits */
-   CHAN_BITS / 8,                      /* TexelBytes */
-   _mesa_texstore_color_index,         /* StoreTexImageFunc */
-   fetch_texel_1d_color_index,         /* FetchTexel1D */
-   fetch_texel_2d_color_index,         /* FetchTexel2D */
-   fetch_texel_3d_color_index,         /* FetchTexel3D */
-   fetch_texel_1d_f_color_index,       /* FetchTexel1Df */
-   fetch_texel_2d_f_color_index,       /* FetchTexel2Df */
-   fetch_texel_3d_f_color_index,       /* FetchTexel3Df */
+   store_texel_intensity               /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_depth_component_float32 = {
@@ -259,6 +252,7 @@ const struct gl_texture_format _mesa_texformat_depth_component_float32 = {
    fetch_texel_1d_f_depth_component_f32,/* FetchTexel1Df */
    fetch_texel_2d_f_depth_component_f32,/* FetchTexel2Df */
    fetch_texel_3d_f_depth_component_f32,/* FetchTexel3Df */
+   store_texel_depth_component_f32     /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_depth_component16 = {
@@ -281,6 +275,7 @@ const struct gl_texture_format _mesa_texformat_depth_component16 = {
    fetch_texel_1d_f_depth_component16, /* FetchTexel1Df */
    fetch_texel_2d_f_depth_component16, /* FetchTexel2Df */
    fetch_texel_3d_f_depth_component16, /* FetchTexel3Df */
+   store_texel_depth_component16       /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_rgba_float32 = {
@@ -303,6 +298,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = {
    fetch_texel_1d_f_rgba_f32,          /* FetchTexel1Df */
    fetch_texel_2d_f_rgba_f32,          /* FetchTexel2Df */
    fetch_texel_3d_f_rgba_f32,          /* FetchTexel3Df */
+   store_texel_rgba_f32                        /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_rgba_float16 = {
@@ -325,6 +321,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = {
    fetch_texel_1d_f_rgba_f16,          /* FetchTexel1Df */
    fetch_texel_2d_f_rgba_f16,          /* FetchTexel2Df */
    fetch_texel_3d_f_rgba_f16,          /* FetchTexel3Df */
+   store_texel_rgba_f16                        /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_rgb_float32 = {
@@ -347,6 +344,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = {
    fetch_texel_1d_f_rgb_f32,           /* FetchTexel1Df */
    fetch_texel_2d_f_rgb_f32,           /* FetchTexel2Df */
    fetch_texel_3d_f_rgb_f32,           /* FetchTexel3Df */
+   store_texel_rgb_f32                 /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_rgb_float16 = {
@@ -368,7 +366,8 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = {
    fetch_texel_3d_rgb_f16,             /* FetchTexel1D */
    fetch_texel_1d_f_rgb_f16,           /* FetchTexel1Df */
    fetch_texel_2d_f_rgb_f16,           /* FetchTexel2Df */
-   fetch_texel_3d_f_rgb_f16            /* FetchTexel3Df */
+   fetch_texel_3d_f_rgb_f16,           /* FetchTexel3Df */
+   store_texel_rgb_f16                 /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_alpha_float32 = {
@@ -390,7 +389,8 @@ const struct gl_texture_format _mesa_texformat_alpha_float32 = {
    fetch_texel_3d_alpha_f32,           /* FetchTexel1D */
    fetch_texel_1d_f_alpha_f32,         /* FetchTexel1Df */
    fetch_texel_2d_f_alpha_f32,         /* FetchTexel2Df */
-   fetch_texel_3d_f_alpha_f32          /* FetchTexel3Df */
+   fetch_texel_3d_f_alpha_f32,         /* FetchTexel3Df */
+   store_texel_alpha_f32               /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_alpha_float16 = {
@@ -412,7 +412,8 @@ const struct gl_texture_format _mesa_texformat_alpha_float16 = {
    fetch_texel_3d_alpha_f16,           /* FetchTexel1D */
    fetch_texel_1d_f_alpha_f16,         /* FetchTexel1Df */
    fetch_texel_2d_f_alpha_f16,         /* FetchTexel2Df */
-   fetch_texel_3d_f_alpha_f16          /* FetchTexel3Df */
+   fetch_texel_3d_f_alpha_f16,         /* FetchTexel3Df */
+   store_texel_alpha_f16               /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_luminance_float32 = {
@@ -434,7 +435,8 @@ const struct gl_texture_format _mesa_texformat_luminance_float32 = {
    fetch_texel_3d_luminance_f32,       /* FetchTexel3D */
    fetch_texel_1d_f_luminance_f32,     /* FetchTexel1Df */
    fetch_texel_2d_f_luminance_f32,     /* FetchTexel2Df */
-   fetch_texel_3d_f_luminance_f32      /* FetchTexel3Df */
+   fetch_texel_3d_f_luminance_f32,     /* FetchTexel3Df */
+   store_texel_luminance_f32           /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_luminance_float16 = {
@@ -456,7 +458,8 @@ const struct gl_texture_format _mesa_texformat_luminance_float16 = {
    fetch_texel_3d_luminance_f16,       /* FetchTexel3D */
    fetch_texel_1d_f_luminance_f16,     /* FetchTexel1Df */
    fetch_texel_2d_f_luminance_f16,     /* FetchTexel2Df */
-   fetch_texel_3d_f_luminance_f16      /* FetchTexel3Df */
+   fetch_texel_3d_f_luminance_f16,     /* FetchTexel3Df */
+   store_texel_luminance_f16           /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = {
@@ -478,7 +481,8 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = {
    fetch_texel_3d_luminance_alpha_f32, /* FetchTexel3D */
    fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */
    fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */
-   fetch_texel_3d_f_luminance_alpha_f32        /* FetchTexel3Df */
+   fetch_texel_3d_f_luminance_alpha_f32,/* FetchTexel3Df */
+   store_texel_luminance_alpha_f32     /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = {
@@ -500,7 +504,8 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = {
    fetch_texel_3d_luminance_alpha_f16, /* FetchTexel3D */
    fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */
    fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */
-   fetch_texel_3d_f_luminance_alpha_f16        /* FetchTexel3Df */
+   fetch_texel_3d_f_luminance_alpha_f16,/* FetchTexel3Df */
+   store_texel_luminance_alpha_f16     /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_intensity_float32 = {
@@ -522,7 +527,8 @@ const struct gl_texture_format _mesa_texformat_intensity_float32 = {
    fetch_texel_3d_intensity_f32,       /* FetchTexel3D */
    fetch_texel_1d_f_intensity_f32,     /* FetchTexel1Df */
    fetch_texel_2d_f_intensity_f32,     /* FetchTexel2Df */
-   fetch_texel_3d_f_intensity_f32      /* FetchTexel3Df */
+   fetch_texel_3d_f_intensity_f32,     /* FetchTexel3Df */
+   store_texel_intensity_f32           /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_intensity_float16 = {
@@ -544,7 +550,8 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = {
    fetch_texel_3d_intensity_f16,       /* FetchTexel3D */
    fetch_texel_1d_f_intensity_f16,     /* FetchTexel1Df */
    fetch_texel_2d_f_intensity_f16,     /* FetchTexel2Df */
-   fetch_texel_3d_f_intensity_f16      /* FetchTexel3Df */
+   fetch_texel_3d_f_intensity_f16,     /* FetchTexel3Df */
+   store_texel_intensity_f16           /* StoreTexel */
 };
 
 
@@ -575,6 +582,30 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = {
    fetch_texel_1d_f_rgba8888,          /* FetchTexel1Df */
    fetch_texel_2d_f_rgba8888,          /* FetchTexel2Df */
    fetch_texel_3d_f_rgba8888,          /* FetchTexel3Df */
+   store_texel_rgba8888                        /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_rgba8888_rev = {
+   MESA_FORMAT_RGBA8888_REV,           /* MesaFormat */
+   GL_RGBA,                            /* BaseFormat */
+   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   8,                                  /* RedBits */
+   8,                                  /* GreenBits */
+   8,                                  /* BlueBits */
+   8,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   4,                                  /* TexelBytes */
+   _mesa_texstore_rgba8888,            /* StoreTexImageFunc */
+   fetch_texel_1d_rgba8888_rev,                /* FetchTexel1D */
+   fetch_texel_2d_rgba8888_rev,                /* FetchTexel2D */
+   fetch_texel_3d_rgba8888_rev,                /* FetchTexel3D */
+   fetch_texel_1d_f_rgba8888_rev,      /* FetchTexel1Df */
+   fetch_texel_2d_f_rgba8888_rev,      /* FetchTexel2Df */
+   fetch_texel_3d_f_rgba8888_rev,      /* FetchTexel3Df */
+   store_texel_rgba8888_rev            /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_argb8888 = {
@@ -597,6 +628,30 @@ const struct gl_texture_format _mesa_texformat_argb8888 = {
    fetch_texel_1d_f_argb8888,          /* FetchTexel1Df */
    fetch_texel_2d_f_argb8888,          /* FetchTexel2Df */
    fetch_texel_3d_f_argb8888,          /* FetchTexel3Df */
+   store_texel_argb8888                        /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_argb8888_rev = {
+   MESA_FORMAT_ARGB8888_REV,           /* MesaFormat */
+   GL_RGBA,                            /* BaseFormat */
+   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   8,                                  /* RedBits */
+   8,                                  /* GreenBits */
+   8,                                  /* BlueBits */
+   8,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   4,                                  /* TexelBytes */
+   _mesa_texstore_argb8888,            /* StoreTexImageFunc */
+   fetch_texel_1d_argb8888_rev,                /* FetchTexel1D */
+   fetch_texel_2d_argb8888_rev,                /* FetchTexel2D */
+   fetch_texel_3d_argb8888_rev,                /* FetchTexel3D */
+   fetch_texel_1d_f_argb8888_rev,      /* FetchTexel1Df */
+   fetch_texel_2d_f_argb8888_rev,      /* FetchTexel2Df */
+   fetch_texel_3d_f_argb8888_rev,      /* FetchTexel3Df */
+   store_texel_argb8888_rev            /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_rgb888 = {
@@ -619,6 +674,30 @@ const struct gl_texture_format _mesa_texformat_rgb888 = {
    fetch_texel_1d_f_rgb888,            /* FetchTexel1Df */
    fetch_texel_2d_f_rgb888,            /* FetchTexel2Df */
    fetch_texel_3d_f_rgb888,            /* FetchTexel3Df */
+   store_texel_rgb888                  /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_bgr888 = {
+   MESA_FORMAT_BGR888,                 /* MesaFormat */
+   GL_RGB,                             /* BaseFormat */
+   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   8,                                  /* RedBits */
+   8,                                  /* GreenBits */
+   8,                                  /* BlueBits */
+   0,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   3,                                  /* TexelBytes */
+   _mesa_texstore_bgr888,              /* StoreTexImageFunc */
+   fetch_texel_1d_bgr888,              /* FetchTexel1D */
+   fetch_texel_2d_bgr888,              /* FetchTexel2D */
+   fetch_texel_3d_bgr888,              /* FetchTexel3D */
+   fetch_texel_1d_f_bgr888,            /* FetchTexel1Df */
+   fetch_texel_2d_f_bgr888,            /* FetchTexel2Df */
+   fetch_texel_3d_f_bgr888,            /* FetchTexel3Df */
+   store_texel_bgr888                  /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_rgb565 = {
@@ -641,6 +720,30 @@ const struct gl_texture_format _mesa_texformat_rgb565 = {
    fetch_texel_1d_f_rgb565,            /* FetchTexel1Df */
    fetch_texel_2d_f_rgb565,            /* FetchTexel2Df */
    fetch_texel_3d_f_rgb565,            /* FetchTexel3Df */
+   store_texel_rgb565                  /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_rgb565_rev = {
+   MESA_FORMAT_RGB565_REV,             /* MesaFormat */
+   GL_RGB,                             /* BaseFormat */
+   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   5,                                  /* RedBits */
+   6,                                  /* GreenBits */
+   5,                                  /* BlueBits */
+   0,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   2,                                  /* TexelBytes */
+   _mesa_texstore_rgb565,              /* StoreTexImageFunc */
+   fetch_texel_1d_rgb565_rev,          /* FetchTexel1D */
+   fetch_texel_2d_rgb565_rev,          /* FetchTexel2D */
+   fetch_texel_3d_rgb565_rev,          /* FetchTexel3D */
+   fetch_texel_1d_f_rgb565_rev,                /* FetchTexel1Df */
+   fetch_texel_2d_f_rgb565_rev,                /* FetchTexel2Df */
+   fetch_texel_3d_f_rgb565_rev,                /* FetchTexel3Df */
+   store_texel_rgb565_rev              /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_argb4444 = {
@@ -663,6 +766,30 @@ const struct gl_texture_format _mesa_texformat_argb4444 = {
    fetch_texel_1d_f_argb4444,          /* FetchTexel1Df */
    fetch_texel_2d_f_argb4444,          /* FetchTexel2Df */
    fetch_texel_3d_f_argb4444,          /* FetchTexel3Df */
+   store_texel_argb4444                        /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_argb4444_rev = {
+   MESA_FORMAT_ARGB4444_REV,           /* MesaFormat */
+   GL_RGBA,                            /* BaseFormat */
+   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   4,                                  /* RedBits */
+   4,                                  /* GreenBits */
+   4,                                  /* BlueBits */
+   4,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   2,                                  /* TexelBytes */
+   _mesa_texstore_argb4444,            /* StoreTexImageFunc */
+   fetch_texel_1d_argb4444_rev,                /* FetchTexel1D */
+   fetch_texel_2d_argb4444_rev,                /* FetchTexel2D */
+   fetch_texel_3d_argb4444_rev,                /* FetchTexel3D */
+   fetch_texel_1d_f_argb4444_rev,      /* FetchTexel1Df */
+   fetch_texel_2d_f_argb4444_rev,      /* FetchTexel2Df */
+   fetch_texel_3d_f_argb4444_rev,      /* FetchTexel3Df */
+   store_texel_argb4444_rev            /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_argb1555 = {
@@ -685,6 +812,30 @@ const struct gl_texture_format _mesa_texformat_argb1555 = {
    fetch_texel_1d_f_argb1555,          /* FetchTexel1Df */
    fetch_texel_2d_f_argb1555,          /* FetchTexel2Df */
    fetch_texel_3d_f_argb1555,          /* FetchTexel3Df */
+   store_texel_argb1555                        /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_argb1555_rev = {
+   MESA_FORMAT_ARGB1555_REV,           /* MesaFormat */
+   GL_RGBA,                            /* BaseFormat */
+   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   5,                                  /* RedBits */
+   5,                                  /* GreenBits */
+   5,                                  /* BlueBits */
+   1,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   2,                                  /* TexelBytes */
+   _mesa_texstore_argb1555,            /* StoreTexImageFunc */
+   fetch_texel_1d_argb1555_rev,                /* FetchTexel1D */
+   fetch_texel_2d_argb1555_rev,                /* FetchTexel2D */
+   fetch_texel_3d_argb1555_rev,                /* FetchTexel3D */
+   fetch_texel_1d_f_argb1555_rev,      /* FetchTexel1Df */
+   fetch_texel_2d_f_argb1555_rev,      /* FetchTexel2Df */
+   fetch_texel_3d_f_argb1555_rev,      /* FetchTexel3Df */
+   store_texel_argb1555_rev            /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_al88 = {
@@ -707,6 +858,30 @@ const struct gl_texture_format _mesa_texformat_al88 = {
    fetch_texel_1d_f_al88,              /* FetchTexel1Df */
    fetch_texel_2d_f_al88,              /* FetchTexel2Df */
    fetch_texel_3d_f_al88,              /* FetchTexel3Df */
+   store_texel_al88                    /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_al88_rev = {
+   MESA_FORMAT_AL88_REV,               /* MesaFormat */
+   GL_LUMINANCE_ALPHA,                 /* BaseFormat */
+   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   0,                                  /* RedBits */
+   0,                                  /* GreenBits */
+   0,                                  /* BlueBits */
+   8,                                  /* AlphaBits */
+   8,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   2,                                  /* TexelBytes */
+   _mesa_texstore_al88,                        /* StoreTexImageFunc */
+   fetch_texel_1d_al88_rev,            /* FetchTexel1D */
+   fetch_texel_2d_al88_rev,            /* FetchTexel2D */
+   fetch_texel_3d_al88_rev,            /* FetchTexel3D */
+   fetch_texel_1d_f_al88_rev,          /* FetchTexel1Df */
+   fetch_texel_2d_f_al88_rev,          /* FetchTexel2Df */
+   fetch_texel_3d_f_al88_rev,          /* FetchTexel3Df */
+   store_texel_al88_rev                        /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_rgb332 = {
@@ -729,6 +904,7 @@ const struct gl_texture_format _mesa_texformat_rgb332 = {
    fetch_texel_1d_f_rgb332,            /* FetchTexel1Df */
    fetch_texel_2d_f_rgb332,            /* FetchTexel2Df */
    fetch_texel_3d_f_rgb332,            /* FetchTexel3Df */
+   store_texel_rgb332                  /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_a8 = {
@@ -751,6 +927,7 @@ const struct gl_texture_format _mesa_texformat_a8 = {
    fetch_texel_1d_f_a8,                        /* FetchTexel1Df */
    fetch_texel_2d_f_a8,                        /* FetchTexel2Df */
    fetch_texel_3d_f_a8,                        /* FetchTexel3Df */
+   store_texel_a8                      /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_l8 = {
@@ -773,6 +950,7 @@ const struct gl_texture_format _mesa_texformat_l8 = {
    fetch_texel_1d_f_l8,                        /* FetchTexel1Df */
    fetch_texel_2d_f_l8,                        /* FetchTexel2Df */
    fetch_texel_3d_f_l8,                        /* FetchTexel3Df */
+   store_texel_l8                      /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_i8 = {
@@ -795,6 +973,7 @@ const struct gl_texture_format _mesa_texformat_i8 = {
    fetch_texel_1d_f_i8,                        /* FetchTexel1Df */
    fetch_texel_2d_f_i8,                        /* FetchTexel2Df */
    fetch_texel_3d_f_i8,                        /* FetchTexel3Df */
+   store_texel_i8                      /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_ci8 = {
@@ -817,6 +996,7 @@ const struct gl_texture_format _mesa_texformat_ci8 = {
    fetch_texel_1d_f_ci8,               /* FetchTexel1Df */
    fetch_texel_2d_f_ci8,               /* FetchTexel2Df */
    fetch_texel_3d_f_ci8,               /* FetchTexel3Df */
+   store_texel_ci8                     /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_ycbcr = {
@@ -839,6 +1019,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr = {
    fetch_texel_1d_f_ycbcr,             /* FetchTexel1Df */
    fetch_texel_2d_f_ycbcr,             /* FetchTexel2Df */
    fetch_texel_3d_f_ycbcr,             /* FetchTexel3Df */
+   store_texel_ycbcr                   /* StoreTexel */
 };
 
 const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
@@ -861,311 +1042,9 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
    fetch_texel_1d_f_ycbcr_rev,         /* FetchTexel1Df */
    fetch_texel_2d_f_ycbcr_rev,         /* FetchTexel2Df */
    fetch_texel_3d_f_ycbcr_rev,         /* FetchTexel3Df */
+   store_texel_ycbcr_rev               /* StoreTexel */
 };
 
-const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
-   MESA_FORMAT_RGB_FXT1,               /* MesaFormat */
-   GL_RGB,                             /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   4, /*approx*/                       /* RedBits */
-   4, /*approx*/                       /* GreenBits */
-   4, /*approx*/                       /* BlueBits */
-   0,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   0,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   NULL, /*impossible*/                /* FetchTexel1D */
-   fetch_texel_2d_rgb_fxt1,            /* FetchTexel2D */
-   NULL, /*impossible*/                /* FetchTexel3D */
-   NULL, /*impossible*/                /* FetchTexel1Df */
-   fetch_texel_2d_f_rgb_fxt1,          /* FetchTexel2Df */
-   NULL, /*impossible*/                /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
-   MESA_FORMAT_RGBA_FXT1,              /* MesaFormat */
-   GL_RGBA,                            /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   4, /*approx*/                       /* RedBits */
-   4, /*approx*/                       /* GreenBits */
-   4, /*approx*/                       /* BlueBits */
-   1, /*approx*/                       /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   0,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   NULL, /*impossible*/                /* FetchTexel1D */
-   fetch_texel_2d_rgba_fxt1,           /* FetchTexel2D */
-   NULL, /*impossible*/                /* FetchTexel3D */
-   NULL, /*impossible*/                /* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_fxt1,                 /* FetchTexel2Df */
-   NULL, /*impossible*/                /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
-   MESA_FORMAT_RGB_DXT1,               /* MesaFormat */
-   GL_RGB,                             /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   4, /*approx*/                       /* RedBits */
-   4, /*approx*/                       /* GreenBits */
-   4, /*approx*/                       /* BlueBits */
-   0,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   0,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   NULL, /*impossible*/                /* FetchTexel1D */
-   fetch_texel_2d_rgb_dxt1,            /* FetchTexel2D */
-   NULL, /*impossible*/                /* FetchTexel3D */
-   NULL, /*impossible*/                /* FetchTexel1Df */
-   fetch_texel_2d_f_rgb_dxt1,          /* FetchTexel2Df */
-   NULL, /*impossible*/                /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
-   MESA_FORMAT_RGBA_DXT1,              /* MesaFormat */
-   GL_RGBA,                            /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   4, /*approx*/                       /* RedBits */
-   4, /*approx*/                       /* GreenBits */
-   4, /*approx*/                       /* BlueBits */
-   1, /*approx*/                       /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   0,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   NULL, /*impossible*/                /* FetchTexel1D */
-   fetch_texel_2d_rgba_dxt1,           /* FetchTexel2D */
-   NULL, /*impossible*/                /* FetchTexel3D */
-   NULL, /*impossible*/                /* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_dxt1,                 /* FetchTexel2Df */
-   NULL, /*impossible*/                /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
-   MESA_FORMAT_RGBA_DXT3,              /* MesaFormat */
-   GL_RGBA,                            /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   4, /*approx*/                       /* RedBits */
-   4, /*approx*/                       /* GreenBits */
-   4, /*approx*/                       /* BlueBits */
-   4, /*approx*/                       /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   0,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   NULL, /*impossible*/                /* FetchTexel1D */
-   fetch_texel_2d_rgba_dxt3,           /* FetchTexel2D */
-   NULL, /*impossible*/                /* FetchTexel3D */
-   NULL, /*impossible*/                /* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_dxt3,                 /* FetchTexel2Df */
-   NULL, /*impossible*/                /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
-   MESA_FORMAT_RGBA_DXT5,              /* MesaFormat */
-   GL_RGBA,                            /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   4,/*approx*/                                /* RedBits */
-   4,/*approx*/                                /* GreenBits */
-   4,/*approx*/                                /* BlueBits */
-   4,/*approx*/                                /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   0,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   NULL, /*impossible*/                /* FetchTexel1D */
-   fetch_texel_2d_rgba_dxt5,           /* FetchTexel2D */
-   NULL, /*impossible*/                /* FetchTexel3D */
-   NULL, /*impossible*/                /* FetchTexel1Df */
-   fetch_texel_2d_f_rgba_dxt5,                 /* FetchTexel2Df */
-   NULL, /*impossible*/                /* FetchTexel3Df */
-};
-
-
-/* Big-endian */
-#if 0
-const struct gl_texture_format _mesa_texformat_abgr8888 = {
-   MESA_FORMAT_ABGR8888,               /* MesaFormat */
-   GL_RGBA,                            /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   8,                                  /* RedBits */
-   8,                                  /* GreenBits */
-   8,                                  /* BlueBits */
-   8,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   4,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   fetch_texel_1d_abgr8888,            /* FetchTexel1D */
-   fetch_texel_2d_abgr8888,            /* FetchTexel2D */
-   fetch_texel_3d_abgr8888,            /* FetchTexel3D */
-   /* XXX float fetchers */
-};
-
-const struct gl_texture_format _mesa_texformat_bgra8888 = {
-   MESA_FORMAT_BGRA8888,               /* MesaFormat */
-   GL_RGBA,                            /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   GL_UNSIGNED_INT_8_8_8_8,            /* Type */
-   8,                                  /* RedBits */
-   8,                                  /* GreenBits */
-   8,                                  /* BlueBits */
-   8,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   4,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   fetch_texel_1d_bgra8888,            /* FetchTexel1D */
-   fetch_texel_2d_bgra8888,            /* FetchTexel2D */
-   fetch_texel_3d_bgra8888,            /* FetchTexel3D */
-   /* XXX float fetchers */
-};
-
-const struct gl_texture_format _mesa_texformat_bgr888 = {
-   MESA_FORMAT_BGR888,                 /* MesaFormat */
-   GL_RGB,                             /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   GL_UNSIGNED_BYTE,                   /* Type */
-   8,                                  /* RedBits */
-   8,                                  /* GreenBits */
-   8,                                  /* BlueBits */
-   0,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   3,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   fetch_texel_1d_bgr888,              /* FetchTexel1D */
-   fetch_texel_2d_bgr888,              /* FetchTexel2D */
-   fetch_texel_3d_bgr888,              /* FetchTexel3D */
-   /* XXX float fetchers */
-};
-
-const struct gl_texture_format _mesa_texformat_bgr565 = {
-   MESA_FORMAT_BGR565,                 /* MesaFormat */
-   GL_RGB,                             /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   GL_UNSIGNED_SHORT_5_6_5,            /* Type */
-   5,                                  /* RedBits */
-   6,                                  /* GreenBits */
-   5,                                  /* BlueBits */
-   0,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   2,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   fetch_texel_1d_bgr565,              /* FetchTexel1D */
-   fetch_texel_2d_bgr565,              /* FetchTexel2D */
-   fetch_texel_3d_bgr565,              /* FetchTexel3D */
-   /* XXX float fetchers */
-};
-
-const struct gl_texture_format _mesa_texformat_bgra4444 = {
-   MESA_FORMAT_BGRA4444,               /* MesaFormat */
-   GL_RGBA,                            /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   GL_UNSIGNED_SHORT_4_4_4_4_REV,      /* Type */
-   4,                                  /* RedBits */
-   4,                                  /* GreenBits */
-   4,                                  /* BlueBits */
-   4,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   2,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   fetch_texel_1d_bgra4444,            /* FetchTexel1D */
-   fetch_texel_2d_bgra4444,            /* FetchTexel2D */
-   fetch_texel_3d_bgra4444,            /* FetchTexel3D */
-   /* XXX float fetchers */
-};
-
-const struct gl_texture_format _mesa_texformat_bgra5551 = {
-   MESA_FORMAT_BGRA5551,               /* MesaFormat */
-   GL_RGBA,                            /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   GL_UNSIGNED_SHORT_1_5_5_5_REV,      /* Type */
-   5,                                  /* RedBits */
-   5,                                  /* GreenBits */
-   5,                                  /* BlueBits */
-   1,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   2,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   fetch_texel_1d_bgra1555,            /* FetchTexel1D */
-   fetch_texel_2d_bgra1555,            /* FetchTexel2D */
-   fetch_texel_3d_bgra1555,            /* FetchTexel3D */
-   /* XXX float fetchers */
-};
-
-const struct gl_texture_format _mesa_texformat_la88 = {
-   MESA_FORMAT_LA88,                   /* MesaFormat */
-   GL_LUMINANCE_ALPHA,                 /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
-   GL_UNSIGNED_BYTE,                   /* Type */
-   0,                                  /* RedBits */
-   0,                                  /* GreenBits */
-   0,                                  /* BlueBits */
-   8,                                  /* AlphaBits */
-   8,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   2,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   fetch_texel_1d_la88,                        /* FetchTexel1D */
-   fetch_texel_2d_la88,                        /* FetchTexel2D */
-   fetch_texel_3d_la88,                        /* FetchTexel3D */
-   /* XXX float fetchers */
-};
-
-const struct gl_texture_format _mesa_texformat_bgr233 = {
-   MESA_FORMAT_BGR233,                 /* MesaFormat */
-   GL_RGB,                             /* BaseFormat */
-   GL_UNSIGNED_NORMALIZED_ARB          /* DataType */
-   GL_UNSIGNED_BYTE_3_3_2,             /* Type */
-   3,                                  /* RedBits */
-   3,                                  /* GreenBits */
-   2,                                  /* BlueBits */
-   0,                                  /* AlphaBits */
-   0,                                  /* LuminanceBits */
-   0,                                  /* IntensityBits */
-   0,                                  /* IndexBits */
-   0,                                  /* DepthBits */
-   1,                                  /* TexelBytes */
-   NULL,                               /* StoreTexImageFunc */
-   fetch_texel_1d_bgr233,              /* FetchTexel1D */
-   fetch_texel_2d_bgr233,              /* FetchTexel2D */
-   fetch_texel_3d_bgr233,              /* FetchTexel3D */
-   /* XXX float fetchers */
-};
-#endif
-
 /*@}*/
 
 
@@ -1193,32 +1072,12 @@ const struct gl_texture_format _mesa_null_texformat = {
    fetch_null_texelf,                  /* FetchTexel1Df */
    fetch_null_texelf,                  /* FetchTexel2Df */
    fetch_null_texelf,                  /* FetchTexel3Df */
+   store_null_texel                    /* StoreTexel */
 };
 
 /*@}*/
 
 
-#if !NEWTEXSTORE
-/**
- * Determine whether a given texture format is a hardware texture
- * format.
- *
- * \param format texture format.
- * 
- * \return GL_TRUE if \p format is a hardware texture format, or GL_FALSE
- * otherwise.
- *
- * \p format is a hardware texture format if gl_texture_format::MesaFormat is
- * lower than _format::MESA_FORMAT_RGBA.
- */
-GLboolean
-_mesa_is_hardware_tex_format( const struct gl_texture_format *format )
-{
-   return (format->MesaFormat < MESA_FORMAT_RGBA);
-}
-#endif
-
-
 /**
  * Choose an appropriate texture format given the format, type and
  * internalFormat parameters passed to glTexImage().
@@ -1245,38 +1104,43 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       /* RGBA formats */
       case 4:
       case GL_RGBA:
-      case GL_RGBA8:
       case GL_RGB10_A2:
       case GL_RGBA12:
       case GL_RGBA16:
          return &_mesa_texformat_rgba;
+      case GL_RGBA8:
+         return &_mesa_texformat_rgba8888;
       case GL_RGB5_A1:
          return &_mesa_texformat_argb1555;
       case GL_RGBA2:
+         return &_mesa_texformat_argb4444_rev; /* just to test another format*/
       case GL_RGBA4:
          return &_mesa_texformat_argb4444;
 
       /* RGB formats */
       case 3:
       case GL_RGB:
-      case GL_RGB8:
       case GL_RGB10:
       case GL_RGB12:
       case GL_RGB16:
          return &_mesa_texformat_rgb;
+      case GL_RGB8:
+         return &_mesa_texformat_rgb888;
       case GL_R3_G3_B2:
          return &_mesa_texformat_rgb332;
       case GL_RGB4:
+         return &_mesa_texformat_rgb565_rev; /* just to test another format */
       case GL_RGB5:
          return &_mesa_texformat_rgb565;
 
       /* Alpha formats */
       case GL_ALPHA:
       case GL_ALPHA4:
-      case GL_ALPHA8:
       case GL_ALPHA12:
       case GL_ALPHA16:
          return &_mesa_texformat_alpha;
+      case GL_ALPHA8:
+         return &_mesa_texformat_a8;
 
       /* Luminance formats */
       case 1:
@@ -1314,7 +1178,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       case GL_COLOR_INDEX4_EXT:
       case GL_COLOR_INDEX12_EXT:
       case GL_COLOR_INDEX16_EXT:
-         return &_mesa_texformat_color_index;
       case GL_COLOR_INDEX8_EXT:
          return &_mesa_texformat_ci8;
 
@@ -1448,33 +1311,3 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
    _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
    return NULL;
 }
-
-
-/**
- * Return the base texture format for the given compressed format
- * 
- * Called via dd_function_table::Driver.BaseCompressedTexFormat.
- * This function is used by software rasterizers.  Hardware drivers
- * which support texture compression should not use this function but
- * a specialized function instead.
- */
-GLint
-_mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat)
-{
-   switch (intFormat) {
-   case GL_COMPRESSED_ALPHA_ARB:
-      return GL_ALPHA;
-   case GL_COMPRESSED_LUMINANCE_ARB:
-      return GL_LUMINANCE;
-   case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
-      return GL_LUMINANCE_ALPHA;
-   case GL_COMPRESSED_INTENSITY_ARB:
-      return GL_INTENSITY;
-   case GL_COMPRESSED_RGB_ARB:
-      return GL_RGB;
-   case GL_COMPRESSED_RGBA_ARB:
-      return GL_RGBA;
-   default:
-      return -1;  /* not a recognized compressed format */
-   }
-}