st/mesa: fix computation of last_level during texture creation
authorMarek Olšák <maraeo@gmail.com>
Sun, 11 Nov 2012 15:29:00 +0000 (16:29 +0100)
committerMarek Olšák <maraeo@gmail.com>
Mon, 12 Nov 2012 20:37:31 +0000 (21:37 +0100)
Array textures were broken.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_cb_texture.c

index 9619dd290ed5ec01b788d56d040f19784d77d38b..f06814f9cd326db7abb1af2f46877f5c39492eb9 100644 (file)
@@ -384,10 +384,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 */