summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-12-14 20:43:06 -0800
committerEric Anholt <[email protected]>2011-12-19 13:20:11 -0800
commit7978fb4d9fd9c3e07aa1c09eba5571ec8a437d9c (patch)
tree4b1144cb55e4e88f46d7ffd6b067a62ca596fb00
parent0b8b6c7e974930daf12e97fb8f0b2a2cc29396d9 (diff)
intel: Reuse intel_miptree_match_image().
This little bit of logic was duplicated, which isn't much, but I was going to need to duplicate a bit of additional logic in the next commit. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_validate.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index 748fbdca2b9..b0daa2c4de3 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -52,9 +52,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
intel_update_max_level(intelObj, sampler);
firstImage = intel_texture_image(tObj->Image[0][tObj->BaseLevel]);
- intel_miptree_get_dimensions_for_image(&firstImage->base.Base,
- &width, &height, &depth);
-
/* Check tree can hold all active levels. Check tree matches
* target, imageFormat, etc.
*
@@ -64,13 +61,10 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
* of that, we just always relayout on baselevel change.
*/
if (intelObj->mt &&
- (intelObj->mt->target != intelObj->base.Target ||
- intelObj->mt->format != firstImage->base.Base.TexFormat ||
+ (!intel_miptree_match_image(intelObj->mt, &firstImage->base.Base) ||
+ intelObj->mt->target != intelObj->base.Target ||
intelObj->mt->first_level != tObj->BaseLevel ||
- intelObj->mt->last_level < intelObj->_MaxLevel ||
- intelObj->mt->width0 != width ||
- intelObj->mt->height0 != height ||
- intelObj->mt->depth0 != depth)) {
+ intelObj->mt->last_level < intelObj->_MaxLevel)) {
intel_miptree_release(&intelObj->mt);
}
@@ -78,6 +72,9 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
/* May need to create a new tree:
*/
if (!intelObj->mt) {
+ intel_miptree_get_dimensions_for_image(&firstImage->base.Base,
+ &width, &height, &depth);
+
intelObj->mt = intel_miptree_create(intel,
intelObj->base.Target,
firstImage->base.Base.TexFormat,