Mesa (master): st/mesa: improve the guess_and_alloc_texture() heuristic

Brian Paul brianp at kemper.freedesktop.org
Fri Oct 19 01:22:41 UTC 2012


Module: Mesa
Branch: master
Commit: 6551c4ea3cc21169696920c5f3d3fb0bb8d6e939
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6551c4ea3cc21169696920c5f3d3fb0bb8d6e939

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Oct 18 18:00:50 2012 -0600

st/mesa: improve the guess_and_alloc_texture() heuristic

If GL_BASE_LEVEL==0 and GL_MAX_LEVEL==0 that's a pretty good hint that
there'll be a single mipmap level in the texture.

Google Earth sets the texture's state this way before the first glTexImage
call.  This saves a bit of texture memory.

---

 src/mesa/state_tracker/st_cb_texture.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 5bf3dc6..218c8d1 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -375,6 +375,8 @@ guess_and_alloc_texture(struct st_context *st,
     */
    if ((stObj->base.Sampler.MinFilter == GL_NEAREST ||
         stObj->base.Sampler.MinFilter == GL_LINEAR ||
+        (stObj->base.BaseLevel == 0 &&
+         stObj->base.MaxLevel == 0) ||
         stImage->base._BaseFormat == GL_DEPTH_COMPONENT ||
         stImage->base._BaseFormat == GL_DEPTH_STENCIL_EXT) &&
        !stObj->base.GenerateMipmap &&




More information about the mesa-commit mailing list