Mesa (7.9): st/mesa: fix mipmap generation bug
Marek Olšák
mareko at kemper.freedesktop.org
Thu Dec 30 16:41:19 UTC 2010
Module: Mesa
Branch: 7.9
Commit: f5435ec3a9dfa820caa8d97bf44fbce4f741b36a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5435ec3a9dfa820caa8d97bf44fbce4f741b36a
Author: Brian Paul <brianp at vmware.com>
Date: Mon Dec 6 11:01:19 2010 -0700
st/mesa: fix mipmap generation bug
In st_finalize_texture() we were looking at the st_texture_object::
lastLevel field instead of the pipe_resource::last_level field to
determine which resource to store the mipmap in.
Then, in st_generate_mipmap() we need to call st_finalize_texture() to
make sure the destination resource is properly allocated.
These changes fix the broken piglit fbo-generatemipmap-formats test.
(cherry picked from commit cae2bb76c1147d48f75ddd7a058a48d11e72ba03)
---
src/mesa/state_tracker/st_cb_texture.c | 3 ++-
src/mesa/state_tracker/st_gen_mipmap.c | 6 ++++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index cd50014..011b630 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1852,8 +1852,9 @@ st_finalize_texture(GLcontext *ctx,
* will match.
*/
if (firstImage->pt &&
+ stObj->pt &&
firstImage->pt != stObj->pt &&
- firstImage->pt->last_level >= stObj->lastLevel) {
+ firstImage->pt->last_level >= stObj->pt->last_level) {
pipe_resource_reference(&stObj->pt, firstImage->pt);
pipe_sampler_view_reference(&stObj->sampler_view, NULL);
}
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 2d587df..799ee5a 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -366,6 +366,12 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
pt = stObj->pt;
}
+ else {
+ /* Make sure that the base texture image data is present in the
+ * texture buffer.
+ */
+ st_finalize_texture(ctx, st->pipe, texObj);
+ }
assert(pt->last_level >= lastLevel);
More information about the mesa-commit
mailing list