aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel/intel_tex_validate.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-01-05 17:02:08 -0800
committerEric Anholt <[email protected]>2011-01-05 18:23:54 -0800
commit7ce6517f3ac41bf770ab39aba4509d4f535ef663 (patch)
tree3563dc5da10a71f71981a0ceb5fdbd00b37a1f79 /src/mesa/drivers/dri/intel/intel_tex_validate.c
parent01b70c06284f3a0ab2de61228b73c78ed00a1a14 (diff)
intel: Always allocate miptrees from level 0, not tObj->BaseLevel.
BaseLevel/MaxLevel are mostly used for two things: clamping texture access for FBO rendering, and limiting the used mipmap levels when incrementally loading textures. By restricting our mipmap trees to just the current BaseLevel/MaxLevel, we caused reallocation thrashing in the common case, for a theoretical win if someone really did want just levels 2..4 or whatever of their texture object. Bug #30366
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_tex_validate.c')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_validate.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index 4d257cc71dc..f1c6239d3d4 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -104,8 +104,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
*/
if (firstImage->mt &&
firstImage->mt != intelObj->mt &&
- firstImage->mt->first_level <= tObj->BaseLevel &&
- firstImage->mt->last_level >= intelObj->_MaxLevel) {
+ firstImage->mt->levels >= intelObj->_MaxLevel) {
if (intelObj->mt)
intel_miptree_release(intel, &intelObj->mt);
@@ -132,11 +131,10 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
if (intelObj->mt &&
(intelObj->mt->target != intelObj->base.Target ||
intelObj->mt->internal_format != firstImage->base.InternalFormat ||
- intelObj->mt->first_level != tObj->BaseLevel ||
- intelObj->mt->last_level != intelObj->_MaxLevel ||
- intelObj->mt->width0 != firstImage->base.Width ||
- intelObj->mt->height0 != firstImage->base.Height ||
- intelObj->mt->depth0 != firstImage->base.Depth ||
+ intelObj->mt->levels <= intelObj->_MaxLevel ||
+ intelObj->mt->width0 != firstImage->mt->width0 ||
+ intelObj->mt->height0 != firstImage->mt->height0 ||
+ intelObj->mt->depth0 != firstImage->mt->depth0 ||
intelObj->mt->cpp != cpp ||
intelObj->mt->compressed != _mesa_is_format_compressed(firstImage->base.TexFormat))) {
intel_miptree_release(intel, &intelObj->mt);
@@ -146,18 +144,9 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
/* May need to create a new tree:
*/
if (!intelObj->mt) {
- intelObj->mt = intel_miptree_create(intel,
- intelObj->base.Target,
- firstImage->base._BaseFormat,
- firstImage->base.InternalFormat,
- tObj->BaseLevel,
- intelObj->_MaxLevel,
- firstImage->base.Width,
- firstImage->base.Height,
- firstImage->base.Depth,
- cpp,
- comp_byte,
- GL_TRUE);
+ intelObj->mt = intel_miptree_create_for_teximage(intel, intelObj,
+ firstImage,
+ GL_TRUE);
}
/* Pull in any images not in the object's tree: