summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c12
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c7
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_validate.c2
3 files changed, 11 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index fb4695ce635..8289c398ff1 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -173,9 +173,17 @@ void
intel_miptree_reference(struct intel_mipmap_tree **dst,
struct intel_mipmap_tree *src)
{
- src->refcount++;
+ if (*dst == src)
+ return;
+
+ intel_miptree_release(dst);
+
+ if (src) {
+ src->refcount++;
+ DBG("%s %p refcount now %d\n", __FUNCTION__, src, src->refcount);
+ }
+
*dst = src;
- DBG("%s %p refcount now %d\n", __FUNCTION__, src, src->refcount);
}
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 69da0e25d1f..30c3cfbafd9 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -370,8 +370,6 @@ intelTexImage(struct gl_context * ctx,
}
}
- assert(!intelImage->mt);
-
if (intelObj->mt &&
intel_miptree_match_image(intelObj->mt, &intelImage->base.Base)) {
/* Use an existing miptree when possible */
@@ -391,10 +389,7 @@ intelTexImage(struct gl_context * ctx,
* whole object since our level didn't fit what was there
* before, and any lower levels would fit into our miptree.
*/
- if (intelImage->mt) {
- intel_miptree_release(&intelObj->mt);
- intel_miptree_reference(&intelObj->mt, intelImage->mt);
- }
+ intel_miptree_reference(&intelObj->mt, intelImage->mt);
}
/* Attempt to use the blitter for PBO image uploads.
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index 59354d66e34..137910816f5 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -43,8 +43,6 @@ copy_image_data_to_tree(struct intel_context *intel,
intelObj->mt,
intelImage->base.Base.Face,
intelImage->base.Base.Level, intelImage->mt);
-
- intel_miptree_release(&intelImage->mt);
}
else {
assert(intelImage->base.Base.Data != NULL);