From ce82914f5ad4bb9148370826099925590e9798fd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 17 Sep 2011 14:50:48 -0600 Subject: [PATCH] mesa: move _mesa_update_fetch_functions() calls into swrast 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 | 4 ---- src/mesa/main/teximage.c | 7 +------ src/mesa/main/texparam.c | 1 - src/mesa/state_tracker/st_cb_texture.c | 5 ----- src/mesa/swrast/s_context.c | 8 ++++++-- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 869243d1c76..6dfa423f123 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -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, diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index cb4a5b4e437..e11acc41281 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -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); } diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 19a01a14deb..f7f00490aa5 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -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; } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index eab02fb3b82..2a971c51d07 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -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, diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index df213357fae..963b7056be5 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -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); + } } } -- 2.30.2