Mesa (9.0): st/mesa: fix computation of last_level during texture creation

Marek Olšák mareko at kemper.freedesktop.org
Fri Nov 23 01:01:35 UTC 2012


Module: Mesa
Branch: 9.0
Commit: 7ca75b62cdd9ddc943ded3a6904b11f62162affb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ca75b62cdd9ddc943ded3a6904b11f62162affb

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sun Nov 11 16:29:00 2012 +0100

st/mesa: fix computation of last_level during texture creation

Array textures were broken.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
(cherry picked from commit 6dd839f23a8ee7b6853f7320a2715df44040b358)

---

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

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 0ee0dc4..923a8c9 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -366,10 +366,8 @@ guess_and_alloc_texture(struct st_context *st,
    }
    else {
       /* alloc space for a full mipmap */
-      GLuint l2width = util_logbase2(width);
-      GLuint l2height = util_logbase2(height);
-      GLuint l2depth = util_logbase2(depth);
-      lastLevel = MAX2(MAX2(l2width, l2height), l2depth);
+      lastLevel = _mesa_get_tex_max_num_levels(stObj->base.Target,
+                                               width, height, depth) - 1;
    }
 
    /* Save the level=0 dimensions */




More information about the mesa-commit mailing list