OSDN Git Service

st/mesa: use base level size as "guess" when available
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 6 Jun 2016 21:15:10 +0000 (23:15 +0200)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 14 Jun 2016 14:48:40 +0000 (15:48 +0100)
commitc03b4444d1836f3d46d882a9e7b33e25f85b1e5a
treea853679e0447703de321bbdb2899e097151580e1
parentad684cee3a7c74b2f43eb16411cd263087c4d263
st/mesa: use base level size as "guess" when available

When an applications specifies mip levels _before_ setting a mipmap texture
filter, we will initially guess a single texture level. When the second level
image is created, we try to allocate the full texture -- however, we get the
base level size guess wrong if that size is odd. This leads to yet another
re-allocation of the texture later during st_finalize_texture.

Even worse, this re-allocation breaks a (reasonable) assumption made by
st_generate_mipmaps, because the re-allocation in the finalization call will
again allocate a single-level pipe texture (based on the non-mipmap texture
filter!). As a result, mipmap generation fails in interesting ways.

All of this can be avoided by just using the fact that we already know the
size of the base level.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95529
Cc: 12.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 42624ea837e8f422f1cd04403af915bd7f218b8d)
src/mesa/state_tracker/st_cb_texture.c