summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-02-17 10:26:58 +1000
committerDave Airlie <airlied@redhat.com>2009-02-17 10:26:58 +1000
commit0a8cba9a65e6ec1159a08725d2101e7eabb4526b (patch)
tree24eff8178cb4f744e7c657268b31052906edf583 /src/mesa/drivers
parent7a1dbcabf3f2599c90665e7fdbdba8698528841a (diff)
radeon: steal miptree optimisation from intel codebase
This replaces a miptree if it won't distrub anything else.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 4aa081ca34..6949ee4502 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -517,6 +517,16 @@ static void radeon_teximage(
/* Allocate memory for image */
radeonFreeTexImageData(ctx, texImage); /* Mesa core only clears texImage->Data but not image->mt */
+ if (t->mt &&
+ t->mt->firstLevel == level &&
+ t->mt->lastLevel == level &&
+ t->mt->target != GL_TEXTURE_CUBE_MAP_ARB &&
+ !radeon_miptree_matches_image(t->mt, texImage, face, level)) {
+ fprintf(stderr,"freeing old miptree\n");
+ radeon_miptree_unreference(t->mt);
+ t->mt = NULL;
+ }
+
if (!t->mt)
radeon_try_alloc_miptree(rmesa, t, texImage, face, level);
if (t->mt && radeon_miptree_matches_image(t->mt, texImage, face, level)) {