mesa: move _mesa_update_fetch_functions() calls into swrast
authorBrian Paul <brianp@vmware.com>
Sat, 17 Sep 2011 20:50:48 +0000 (14:50 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 17 Sep 2011 20:57:40 +0000 (14:57 -0600)
Do it during swrast state validation since the FetchTexel() functions
are only called from swrast now and not core Mesa.
Remove assertions in mipmap.c since they're no longer appropriate.

src/mesa/main/mipmap.c
src/mesa/main/teximage.c
src/mesa/main/texparam.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/swrast/s_context.c

index 869243d1c76139a434f4b93ce6f9598ee4e01b80..6dfa423f12363052f2951e4313fb791fac869dda 100644 (file)
@@ -1955,8 +1955,6 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target,
                                  dstDepth, border, srcImage->InternalFormat,
                                  srcImage->TexFormat);
       dstImage->DriverData = NULL;
-      dstImage->FetchTexelc = srcImage->FetchTexelc;
-      dstImage->FetchTexelf = srcImage->FetchTexelf;
 
       /* Alloc new teximage data buffer */
       {
@@ -1970,8 +1968,6 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target,
       }
 
       ASSERT(dstImage->TexFormat);
-      ASSERT(dstImage->FetchTexelc);
-      ASSERT(dstImage->FetchTexelf);
 
       _mesa_generate_mipmap_level(target, datatype, comps, border,
                                   srcWidth, srcHeight, srcDepth,
index cb4a5b4e437a326fa45aca4e611c7293338e92c3..e11acc4128157da7a3503c9f0a4fe549beb7a77b 100644 (file)
@@ -42,7 +42,6 @@
 #include "mfeatures.h"
 #include "state.h"
 #include "texcompress.h"
-#include "texfetch.h"
 #include "teximage.h"
 #include "texstate.h"
 #include "texpal.h"
@@ -1104,7 +1103,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
                            GLint border, GLenum internalFormat,
                            gl_format format)
 {
-   GLint i, dims;
+   GLint i;
 
    ASSERT(img);
    ASSERT(width >= 0);
@@ -1176,10 +1175,6 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
    }
 
    img->TexFormat = format;
-
-   dims = _mesa_get_texture_dimensions(target);
-
-   _mesa_set_fetch_functions(img, dims);
 }
 
 
index 19a01a14debfdc0b057a7c2f206440651eb16cf2..f7f00490aa582625b94db5641895b93a563eef01 100644 (file)
@@ -432,7 +432,6 @@ set_tex_parameteri(struct gl_context *ctx,
            if (texObj->Sampler.sRGBDecode != decode) {
               flush(ctx);
               texObj->Sampler.sRGBDecode = decode;
-              _mesa_update_fetch_functions(texObj);
            }
            return GL_TRUE;
         }
index eab02fb3b82ee94c85405970228c2c269daa7cf6..2a971c51d0741041fe76829cb2a629839598777e 100644 (file)
@@ -38,7 +38,6 @@
 #include "main/pbo.h"
 #include "main/pixeltransfer.h"
 #include "main/texcompress.h"
-#include "main/texfetch.h"
 #include "main/texgetimage.h"
 #include "main/teximage.h"
 #include "main/texobj.h"
@@ -552,8 +551,6 @@ st_TexImage(struct gl_context * ctx,
    stImage->base.Face = _mesa_tex_target_to_face(target);
    stImage->base.Level = level;
 
-   _mesa_set_fetch_functions(texImage, dims);
-
    /* Release the reference to a potentially orphaned buffer.   
     * Release any old malloced memory.
     */
@@ -975,8 +972,6 @@ st_get_tex_image(struct gl_context * ctx, GLenum target, GLint level,
 
    dest = (GLubyte *) pixels;
 
-   _mesa_set_fetch_functions(texImage, get_texture_dims(target));
-
    for (i = 0; i < depth; i++) {
       if (compressed_dst) {
         _mesa_get_compressed_teximage(ctx, target, level, dest,
index df213357fae833189391ed4f6da99d8367ff2849..963b7056be550cd3d1a4d4b8a59df16a97aa2b11 100644 (file)
@@ -31,6 +31,7 @@
 #include "main/colormac.h"
 #include "main/mtypes.h"
 #include "main/teximage.h"
+#include "main/texfetch.h"
 #include "program/prog_parameter.h"
 #include "program/prog_statevars.h"
 #include "swrast.h"
@@ -469,11 +470,14 @@ _swrast_update_texture_samplers(struct gl_context *ctx)
       return; /* pipe hack */
 
    for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
-      const struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
+      struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
       /* Note: If tObj is NULL, the sample function will be a simple
        * function that just returns opaque black (0,0,0,1).
        */
-      swrast->TextureSample[u] = _swrast_choose_texture_sample_func(ctx, tObj);
+      if (tObj) {
+         _mesa_update_fetch_functions(tObj);
+         swrast->TextureSample[u] = _swrast_choose_texture_sample_func(ctx, tObj);
+      }
    }
 }