OSDN Git Service

mesa/main: Export null texformat operations.
[android-x86/external-mesa.git] / src / mesa / main / texformat.c
index 50e8d7a..19c9283 100644 (file)
@@ -87,30 +87,33 @@ nonlinear_to_linear(GLubyte cs8)
  *
  * Have to have this so the FetchTexel function pointer is never NULL.
  */
-static void fetch_null_texel( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLchan *texel )
+void
+_mesa_texformat_fetch_texel_null(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;
    texel[ACOMP] = 0;
-   _mesa_warning(NULL, "fetch_null_texel() called!");
+   _mesa_warning(NULL, "_mesa_texformat_fetch_texel_null() called!");
 }
 
-static void fetch_null_texelf( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLfloat *texel )
+void
+_mesa_texformat_fetch_texel_f_null(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;
    texel[ACOMP] = 0.0;
-   _mesa_warning(NULL, "fetch_null_texelf() called!");
+   _mesa_warning(NULL, "_mesa_texformat_fetch_texel_f_null() called!");
 }
 
-static void store_null_texel(struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, const void *texel)
+void
+_mesa_texformat_store_texel_null(struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, const void *texel)
 {
    (void) texImage;
    (void) i;
@@ -154,9 +157,9 @@ const struct gl_texture_format _mesa_texformat_rgba = {
    0,                                  /* StencilBits */
    4 * sizeof(GLchan),                 /* TexelBytes */
    _mesa_texstore_rgba,                        /* StoreTexImageFunc */
-   fetch_texel_1d_rgba,                        /* FetchTexel1D */
-   fetch_texel_2d_rgba,                        /* FetchTexel2D */
-   fetch_texel_3d_rgba,                        /* FetchTexel3D */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
    fetch_texel_1d_f_rgba,              /* FetchTexel1Df */
    fetch_texel_2d_f_rgba,              /* FetchTexel2Df */
    fetch_texel_3d_f_rgba,              /* FetchTexel3Df */
@@ -178,9 +181,9 @@ const struct gl_texture_format _mesa_texformat_rgb = {
    0,                                  /* StencilBits */
    3 * sizeof(GLchan),                 /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_rgb,                 /* FetchTexel1D */
-   fetch_texel_2d_rgb,                 /* FetchTexel2D */
-   fetch_texel_3d_rgb,                 /* FetchTexel3D */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
    fetch_texel_1d_f_rgb,               /* FetchTexel1Df */
    fetch_texel_2d_f_rgb,               /* FetchTexel2Df */
    fetch_texel_3d_f_rgb,               /* FetchTexel3Df */
@@ -202,12 +205,12 @@ const struct gl_texture_format _mesa_texformat_alpha = {
    0,                                  /* StencilBits */
    sizeof(GLchan),                     /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_alpha,               /* FetchTexel1D */
-   fetch_texel_2d_alpha,               /* FetchTexel2D */
-   fetch_texel_3d_alpha,               /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_alpha,             /* FetchTexel1Df */
+   fetch_texel_2d_f_alpha,             /* FetchTexel2Df */
+   fetch_texel_3d_f_alpha,             /* FetchTexel3Df */
    store_texel_alpha                   /* StoreTexel */
 };
 
@@ -226,12 +229,12 @@ const struct gl_texture_format _mesa_texformat_luminance = {
    0,                                  /* StencilBits */
    sizeof(GLchan),                     /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_luminance,           /* FetchTexel1D */
-   fetch_texel_2d_luminance,           /* FetchTexel2D */
-   fetch_texel_3d_luminance,           /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_luminance,         /* FetchTexel1Df */
+   fetch_texel_2d_f_luminance,         /* FetchTexel2Df */
+   fetch_texel_3d_f_luminance,         /* FetchTexel3Df */
    store_texel_luminance               /* StoreTexel */
 };
 
@@ -250,12 +253,12 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = {
    0,                                  /* StencilBits */
    2 * sizeof(GLchan),                 /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_luminance_alpha,     /* FetchTexel1D */
-   fetch_texel_2d_luminance_alpha,     /* FetchTexel2D */
-   fetch_texel_3d_luminance_alpha,     /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   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 */
 };
 
@@ -274,12 +277,12 @@ const struct gl_texture_format _mesa_texformat_intensity = {
    0,                                  /* StencilBits */
    sizeof(GLchan),                     /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_intensity,           /* FetchTexel1D */
-   fetch_texel_2d_intensity,           /* FetchTexel2D */
-   fetch_texel_3d_intensity,           /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_intensity,         /* FetchTexel1Df */
+   fetch_texel_2d_f_intensity,         /* FetchTexel2Df */
+   fetch_texel_3d_f_intensity,         /* FetchTexel3Df */
    store_texel_intensity               /* StoreTexel */
 };
 
@@ -382,6 +385,7 @@ const struct gl_texture_format _mesa_texformat_sl8 = {
    store_texel_sl8                     /* StoreTexel */
 };
 
+/* Note: this format name looks like a misnomer, make it sal8? */
 const struct gl_texture_format _mesa_texformat_sla8 = {
    MESA_FORMAT_SLA8,                   /* MesaFormat */
    GL_LUMINANCE_ALPHA,                 /* BaseFormat */
@@ -696,6 +700,79 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = {
    store_texel_intensity_f16           /* StoreTexel */
 };
 
+const struct gl_texture_format _mesa_texformat_dudv8 = {
+   MESA_FORMAT_DUDV8,                  /* MesaFormat */
+   GL_DUDV_ATI,                                /* BaseFormat */
+   GL_SIGNED_NORMALIZED,               /* DataType */
+   /* maybe should add dudvBits field, but spec seems to be
+      lacking the ability to query with GetTexLevelParameter anyway */
+   0,                                  /* RedBits */
+   0,                                  /* GreenBits */
+   0,                                  /* BlueBits */
+   0,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   0,                                  /* StencilBits */
+   2,                                  /* TexelBytes */
+   _mesa_texstore_dudv8,               /* StoreTexImageFunc */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_dudv8,               /* FetchTexel1Df */
+   fetch_texel_2d_dudv8,               /* FetchTexel2Df */
+   fetch_texel_3d_dudv8,               /* FetchTexel3Df */
+   NULL                                        /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_signed_rgba8888 = {
+   MESA_FORMAT_SIGNED_RGBA8888,                /* MesaFormat */
+   GL_RGBA,                            /* BaseFormat */
+   GL_SIGNED_NORMALIZED,               /* DataType */
+   8,                                  /* RedBits */
+   8,                                  /* GreenBits */
+   8,                                  /* BlueBits */
+   8,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   0,                                  /* StencilBits */
+   4,                                  /* TexelBytes */
+   _mesa_texstore_signed_rgba8888,     /* StoreTexImageFunc */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_signed_rgba8888,     /* FetchTexel1Df */
+   fetch_texel_2d_signed_rgba8888,     /* FetchTexel2Df */
+   fetch_texel_3d_signed_rgba8888,     /* FetchTexel3Df */
+   store_texel_signed_rgba8888         /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = {
+   MESA_FORMAT_SIGNED_RGBA8888_REV,    /* MesaFormat */
+   GL_RGBA,                            /* BaseFormat */
+   GL_SIGNED_NORMALIZED,               /* DataType */
+   8,                                  /* RedBits */
+   8,                                  /* GreenBits */
+   8,                                  /* BlueBits */
+   8,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   0,                                  /* StencilBits */
+   4,                                  /* TexelBytes */
+   _mesa_texstore_signed_rgba8888,     /* StoreTexImageFunc */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_signed_rgba8888_rev, /* FetchTexel1Df */
+   fetch_texel_2d_signed_rgba8888_rev, /* FetchTexel2Df */
+   fetch_texel_3d_signed_rgba8888_rev, /* FetchTexel3Df */
+   store_texel_signed_rgba8888_rev             /* StoreTexel */
+};
 
 /*@}*/
 
@@ -719,12 +796,12 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = {
    0,                                  /* StencilBits */
    4,                                  /* TexelBytes */
    _mesa_texstore_rgba8888,            /* StoreTexImageFunc */
-   fetch_texel_1d_rgba8888,            /* FetchTexel1D */
-   fetch_texel_2d_rgba8888,            /* FetchTexel2D */
-   fetch_texel_3d_rgba8888,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgba8888,          /* FetchTexel1Df */
+   fetch_texel_2d_f_rgba8888,          /* FetchTexel2Df */
+   fetch_texel_3d_f_rgba8888,          /* FetchTexel3Df */
    store_texel_rgba8888                        /* StoreTexel */
 };
 
@@ -743,12 +820,12 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = {
    0,                                  /* StencilBits */
    4,                                  /* TexelBytes */
    _mesa_texstore_rgba8888,            /* StoreTexImageFunc */
-   fetch_texel_1d_rgba8888_rev,                /* FetchTexel1D */
-   fetch_texel_2d_rgba8888_rev,                /* FetchTexel2D */
-   fetch_texel_3d_rgba8888_rev,                /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* 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 */
 };
 
@@ -767,12 +844,12 @@ const struct gl_texture_format _mesa_texformat_argb8888 = {
    0,                                  /* StencilBits */
    4,                                  /* TexelBytes */
    _mesa_texstore_argb8888,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb8888,            /* FetchTexel1D */
-   fetch_texel_2d_argb8888,            /* FetchTexel2D */
-   fetch_texel_3d_argb8888,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_argb8888,          /* FetchTexel1Df */
+   fetch_texel_2d_f_argb8888,          /* FetchTexel2Df */
+   fetch_texel_3d_f_argb8888,          /* FetchTexel3Df */
    store_texel_argb8888                        /* StoreTexel */
 };
 
@@ -791,12 +868,12 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = {
    0,                                  /* StencilBits */
    4,                                  /* TexelBytes */
    _mesa_texstore_argb8888,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb8888_rev,                /* FetchTexel1D */
-   fetch_texel_2d_argb8888_rev,                /* FetchTexel2D */
-   fetch_texel_3d_argb8888_rev,                /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* 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 */
 };
 
@@ -815,12 +892,12 @@ const struct gl_texture_format _mesa_texformat_rgb888 = {
    0,                                  /* StencilBits */
    3,                                  /* TexelBytes */
    _mesa_texstore_rgb888,              /* StoreTexImageFunc */
-   fetch_texel_1d_rgb888,              /* FetchTexel1D */
-   fetch_texel_2d_rgb888,              /* FetchTexel2D */
-   fetch_texel_3d_rgb888,              /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgb888,            /* FetchTexel1Df */
+   fetch_texel_2d_f_rgb888,            /* FetchTexel2Df */
+   fetch_texel_3d_f_rgb888,            /* FetchTexel3Df */
    store_texel_rgb888                  /* StoreTexel */
 };
 
@@ -839,12 +916,12 @@ const struct gl_texture_format _mesa_texformat_bgr888 = {
    0,                                  /* StencilBits */
    3,                                  /* TexelBytes */
    _mesa_texstore_bgr888,              /* StoreTexImageFunc */
-   fetch_texel_1d_bgr888,              /* FetchTexel1D */
-   fetch_texel_2d_bgr888,              /* FetchTexel2D */
-   fetch_texel_3d_bgr888,              /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_bgr888,            /* FetchTexel1Df */
+   fetch_texel_2d_f_bgr888,            /* FetchTexel2Df */
+   fetch_texel_3d_f_bgr888,            /* FetchTexel3Df */
    store_texel_bgr888                  /* StoreTexel */
 };
 
@@ -863,12 +940,12 @@ const struct gl_texture_format _mesa_texformat_rgb565 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_rgb565,              /* StoreTexImageFunc */
-   fetch_texel_1d_rgb565,              /* FetchTexel1D */
-   fetch_texel_2d_rgb565,              /* FetchTexel2D */
-   fetch_texel_3d_rgb565,              /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgb565,            /* FetchTexel1Df */
+   fetch_texel_2d_f_rgb565,            /* FetchTexel2Df */
+   fetch_texel_3d_f_rgb565,            /* FetchTexel3Df */
    store_texel_rgb565                  /* StoreTexel */
 };
 
@@ -887,15 +964,39 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_rgb565,              /* StoreTexImageFunc */
-   fetch_texel_1d_rgb565_rev,          /* FetchTexel1D */
-   fetch_texel_2d_rgb565_rev,          /* FetchTexel2D */
-   fetch_texel_3d_rgb565_rev,          /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* 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_rgba4444 = {
+   MESA_FORMAT_RGBA4444,               /* 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 */
+   0,                                  /* StencilBits */
+   2,                                  /* TexelBytes */
+   _mesa_texstore_rgba4444,            /* StoreTexImageFunc */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgba4444,          /* FetchTexel1Df */
+   fetch_texel_2d_f_rgba4444,          /* FetchTexel2Df */
+   fetch_texel_3d_f_rgba4444,          /* FetchTexel3Df */
+   store_texel_rgba4444                        /* StoreTexel */
+};
+
 const struct gl_texture_format _mesa_texformat_argb4444 = {
    MESA_FORMAT_ARGB4444,               /* MesaFormat */
    GL_RGBA,                            /* BaseFormat */
@@ -911,12 +1012,12 @@ const struct gl_texture_format _mesa_texformat_argb4444 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_argb4444,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb4444,            /* FetchTexel1D */
-   fetch_texel_2d_argb4444,            /* FetchTexel2D */
-   fetch_texel_3d_argb4444,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_argb4444,          /* FetchTexel1Df */
+   fetch_texel_2d_f_argb4444,          /* FetchTexel2Df */
+   fetch_texel_3d_f_argb4444,          /* FetchTexel3Df */
    store_texel_argb4444                        /* StoreTexel */
 };
 
@@ -935,15 +1036,39 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_argb4444,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb4444_rev,                /* FetchTexel1D */
-   fetch_texel_2d_argb4444_rev,                /* FetchTexel2D */
-   fetch_texel_3d_argb4444_rev,                /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* 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_rgba5551 = {
+   MESA_FORMAT_RGBA5551,               /* 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 */
+   0,                                  /* StencilBits */
+   2,                                  /* TexelBytes */
+   _mesa_texstore_rgba5551,            /* StoreTexImageFunc */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgba5551,          /* FetchTexel1Df */
+   fetch_texel_2d_f_rgba5551,          /* FetchTexel2Df */
+   fetch_texel_3d_f_rgba5551,          /* FetchTexel3Df */
+   store_texel_rgba5551                        /* StoreTexel */
+};
+
 const struct gl_texture_format _mesa_texformat_argb1555 = {
    MESA_FORMAT_ARGB1555,               /* MesaFormat */
    GL_RGBA,                            /* BaseFormat */
@@ -959,12 +1084,12 @@ const struct gl_texture_format _mesa_texformat_argb1555 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_argb1555,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb1555,            /* FetchTexel1D */
-   fetch_texel_2d_argb1555,            /* FetchTexel2D */
-   fetch_texel_3d_argb1555,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_argb1555,          /* FetchTexel1Df */
+   fetch_texel_2d_f_argb1555,          /* FetchTexel2Df */
+   fetch_texel_3d_f_argb1555,          /* FetchTexel3Df */
    store_texel_argb1555                        /* StoreTexel */
 };
 
@@ -983,12 +1108,12 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_argb1555,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb1555_rev,                /* FetchTexel1D */
-   fetch_texel_2d_argb1555_rev,                /* FetchTexel2D */
-   fetch_texel_3d_argb1555_rev,                /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* 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 */
 };
 
@@ -1007,12 +1132,12 @@ const struct gl_texture_format _mesa_texformat_al88 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_al88,                        /* StoreTexImageFunc */
-   fetch_texel_1d_al88,                        /* FetchTexel1D */
-   fetch_texel_2d_al88,                        /* FetchTexel2D */
-   fetch_texel_3d_al88,                        /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_al88,              /* FetchTexel1Df */
+   fetch_texel_2d_f_al88,              /* FetchTexel2Df */
+   fetch_texel_3d_f_al88,              /* FetchTexel3Df */
    store_texel_al88                    /* StoreTexel */
 };
 
@@ -1031,12 +1156,12 @@ const struct gl_texture_format _mesa_texformat_al88_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_al88,                        /* StoreTexImageFunc */
-   fetch_texel_1d_al88_rev,            /* FetchTexel1D */
-   fetch_texel_2d_al88_rev,            /* FetchTexel2D */
-   fetch_texel_3d_al88_rev,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* 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 */
 };
 
@@ -1055,12 +1180,12 @@ const struct gl_texture_format _mesa_texformat_rgb332 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_rgb332,              /* StoreTexImageFunc */
-   fetch_texel_1d_rgb332,              /* FetchTexel1D */
-   fetch_texel_2d_rgb332,              /* FetchTexel2D */
-   fetch_texel_3d_rgb332,              /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgb332,            /* FetchTexel1Df */
+   fetch_texel_2d_f_rgb332,            /* FetchTexel2Df */
+   fetch_texel_3d_f_rgb332,            /* FetchTexel3Df */
    store_texel_rgb332                  /* StoreTexel */
 };
 
@@ -1079,12 +1204,12 @@ const struct gl_texture_format _mesa_texformat_a8 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_a8,                  /* StoreTexImageFunc */
-   fetch_texel_1d_a8,                  /* FetchTexel1D */
-   fetch_texel_2d_a8,                  /* FetchTexel2D */
-   fetch_texel_3d_a8,                  /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_a8,                        /* FetchTexel1Df */
+   fetch_texel_2d_f_a8,                        /* FetchTexel2Df */
+   fetch_texel_3d_f_a8,                        /* FetchTexel3Df */
    store_texel_a8                      /* StoreTexel */
 };
 
@@ -1103,12 +1228,12 @@ const struct gl_texture_format _mesa_texformat_l8 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_a8,/*yes*/           /* StoreTexImageFunc */
-   fetch_texel_1d_l8,                  /* FetchTexel1D */
-   fetch_texel_2d_l8,                  /* FetchTexel2D */
-   fetch_texel_3d_l8,                  /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_l8,                        /* FetchTexel1Df */
+   fetch_texel_2d_f_l8,                        /* FetchTexel2Df */
+   fetch_texel_3d_f_l8,                        /* FetchTexel3Df */
    store_texel_l8                      /* StoreTexel */
 };
 
@@ -1127,12 +1252,12 @@ const struct gl_texture_format _mesa_texformat_i8 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_a8,/*yes*/           /* StoreTexImageFunc */
-   fetch_texel_1d_i8,                  /* FetchTexel1D */
-   fetch_texel_2d_i8,                  /* FetchTexel2D */
-   fetch_texel_3d_i8,                  /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_i8,                        /* FetchTexel1Df */
+   fetch_texel_2d_f_i8,                        /* FetchTexel2Df */
+   fetch_texel_3d_f_i8,                        /* FetchTexel3Df */
    store_texel_i8                      /* StoreTexel */
 };
 
@@ -1151,12 +1276,12 @@ const struct gl_texture_format _mesa_texformat_ci8 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_ci8,                 /* StoreTexImageFunc */
-   fetch_texel_1d_ci8,                 /* FetchTexel1D */
-   fetch_texel_2d_ci8,                 /* FetchTexel2D */
-   fetch_texel_3d_ci8,                 /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_ci8,               /* FetchTexel1Df */
+   fetch_texel_2d_f_ci8,               /* FetchTexel2Df */
+   fetch_texel_3d_f_ci8,               /* FetchTexel3Df */
    store_texel_ci8                     /* StoreTexel */
 };
 
@@ -1175,12 +1300,12 @@ const struct gl_texture_format _mesa_texformat_ycbcr = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_ycbcr,               /* StoreTexImageFunc */
-   fetch_texel_1d_ycbcr,               /* FetchTexel1D */
-   fetch_texel_2d_ycbcr,               /* FetchTexel2D */
-   fetch_texel_3d_ycbcr,               /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_ycbcr,             /* FetchTexel1Df */
+   fetch_texel_2d_f_ycbcr,             /* FetchTexel2Df */
+   fetch_texel_3d_f_ycbcr,             /* FetchTexel3Df */
    store_texel_ycbcr                   /* StoreTexel */
 };
 
@@ -1199,12 +1324,12 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_ycbcr,               /* StoreTexImageFunc */
-   fetch_texel_1d_ycbcr_rev,           /* FetchTexel1D */
-   fetch_texel_2d_ycbcr_rev,           /* FetchTexel2D */
-   fetch_texel_3d_ycbcr_rev,           /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   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 */
 };
 
@@ -1326,13 +1451,7 @@ const struct gl_texture_format _mesa_null_texformat = {
    0,                                  /* StencilBits */
    0,                                  /* TexelBytes */
    NULL,                               /* StoreTexImageFunc */
-   fetch_null_texel,                   /* FetchTexel1D */
-   fetch_null_texel,                   /* FetchTexel2D */
-   fetch_null_texel,                   /* FetchTexel3D */
-   fetch_null_texelf,                  /* FetchTexel1Df */
-   fetch_null_texelf,                  /* FetchTexel2Df */
-   fetch_null_texelf,                  /* FetchTexel3Df */
-   store_null_texel                    /* StoreTexel */
+   _MESA_TEXFORMAT_NULL_OPS
 };
 
 /*@}*/
@@ -1458,41 +1577,39 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       }
    }
 
-   if (ctx->Extensions.ARB_texture_compression) {
-      switch (internalFormat) {
-         case GL_COMPRESSED_ALPHA_ARB:
-            return &_mesa_texformat_alpha;
-         case GL_COMPRESSED_LUMINANCE_ARB:
-            return &_mesa_texformat_luminance;
-         case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
-            return &_mesa_texformat_luminance_alpha;
-         case GL_COMPRESSED_INTENSITY_ARB:
-            return &_mesa_texformat_intensity;
-         case GL_COMPRESSED_RGB_ARB:
+   switch (internalFormat) {
+      case GL_COMPRESSED_ALPHA_ARB:
+         return &_mesa_texformat_alpha;
+      case GL_COMPRESSED_LUMINANCE_ARB:
+         return &_mesa_texformat_luminance;
+      case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
+         return &_mesa_texformat_luminance_alpha;
+      case GL_COMPRESSED_INTENSITY_ARB:
+         return &_mesa_texformat_intensity;
+      case GL_COMPRESSED_RGB_ARB:
 #if FEATURE_texture_fxt1
-            if (ctx->Extensions.TDFX_texture_compression_FXT1)
-               return &_mesa_texformat_rgb_fxt1;
+         if (ctx->Extensions.TDFX_texture_compression_FXT1)
+            return &_mesa_texformat_rgb_fxt1;
 #endif
 #if FEATURE_texture_s3tc
-            if (ctx->Extensions.EXT_texture_compression_s3tc ||
-                ctx->Extensions.S3_s3tc)
-               return &_mesa_texformat_rgb_dxt1;
+         if (ctx->Extensions.EXT_texture_compression_s3tc ||
+             ctx->Extensions.S3_s3tc)
+            return &_mesa_texformat_rgb_dxt1;
 #endif
-            return &_mesa_texformat_rgb;
-         case GL_COMPRESSED_RGBA_ARB:
+         return &_mesa_texformat_rgb;
+      case GL_COMPRESSED_RGBA_ARB:
 #if FEATURE_texture_fxt1
-            if (ctx->Extensions.TDFX_texture_compression_FXT1)
-               return &_mesa_texformat_rgba_fxt1;
+         if (ctx->Extensions.TDFX_texture_compression_FXT1)
+            return &_mesa_texformat_rgba_fxt1;
 #endif
 #if FEATURE_texture_s3tc
-            if (ctx->Extensions.EXT_texture_compression_s3tc ||
-                ctx->Extensions.S3_s3tc)
-               return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */
+         if (ctx->Extensions.EXT_texture_compression_s3tc ||
+             ctx->Extensions.S3_s3tc)
+            return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */
 #endif
-            return &_mesa_texformat_rgba;
-         default:
-            ; /* fallthrough */
-      }
+         return &_mesa_texformat_rgba;
+      default:
+         ; /* fallthrough */
    }
 
    if (ctx->Extensions.MESA_ycbcr_texture) {
@@ -1588,6 +1705,27 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       }
    }
 
+   if (ctx->Extensions.ATI_envmap_bumpmap) {
+      switch (internalFormat) {
+         case GL_DUDV_ATI:
+         case GL_DU8DV8_ATI:
+            return &_mesa_texformat_dudv8;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+   if (ctx->Extensions.MESA_texture_signed_rgba) {
+      switch (internalFormat) {
+         case GL_RGBA_SNORM:
+         case GL_RGBA8_SNORM:
+            return &_mesa_texformat_signed_rgba8888;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+
 #if FEATURE_EXT_texture_sRGB
    if (ctx->Extensions.EXT_texture_sRGB) {
       switch (internalFormat) {
@@ -1732,6 +1870,17 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
       *comps = 1;
       return;
 
+   case MESA_FORMAT_DUDV8:
+      *datatype = GL_BYTE;
+      *comps = 2;
+      return;
+
+   case MESA_FORMAT_SIGNED_RGBA8888:
+   case MESA_FORMAT_SIGNED_RGBA8888_REV:
+      *datatype = GL_BYTE;
+      *comps = 4;
+      return;
+
 #if FEATURE_EXT_texture_sRGB
    case MESA_FORMAT_SRGB8:
       *datatype = GL_UNSIGNED_BYTE;