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);
}
}
}
- assert(!intelImage->mt);
-
if (intelObj->mt &&
intel_miptree_match_image(intelObj->mt, &intelImage->base.Base)) {
/* Use an existing miptree when possible */
* 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.
intelObj->mt,
intelImage->base.Base.Face,
intelImage->base.Base.Level, intelImage->mt);
-
- intel_miptree_release(&intelImage->mt);
}
else {
assert(intelImage->base.Base.Data != NULL);