intel: Skip texture validation logic when nothing has changed.

Improves GLBenchmark 2.1 offscreen performance by 3.2% +/- 1.5% (n=52).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Eric Anholt 2012-12-20 14:09:32 -08:00
parent 73c376bbde
commit 2f225f6145
5 changed files with 30 additions and 2 deletions

View file

@ -771,6 +771,8 @@ intel_miptree_copy_teximage(struct intel_context *intel,
struct intel_mipmap_tree *dst_mt)
{
struct intel_mipmap_tree *src_mt = intelImage->mt;
struct intel_texture_object *intel_obj =
intel_texture_object(intelImage->base.Base.TexObject);
int level = intelImage->base.Base.Level;
int face = intelImage->base.Base.Face;
GLuint depth = intelImage->base.Base.Depth;
@ -780,6 +782,7 @@ intel_miptree_copy_teximage(struct intel_context *intel,
}
intel_miptree_reference(&intelImage->mt, dst_mt);
intel_obj->needs_validate = true;
}
bool

View file

@ -36,6 +36,8 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
DBG("%s\n", __FUNCTION__);
_mesa_initialize_texture_object(&obj->base, name, target);
obj->needs_validate = true;
return &obj->base;
}
@ -107,6 +109,8 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
image->Width, image->Height, image->Depth, intel_image->mt);
}
intel_texobj->needs_validate = true;
return true;
}

View file

@ -274,6 +274,7 @@ intel_set_texture_image_region(struct gl_context *ctx,
region);
if (intel_image->mt == NULL)
return;
intel_texobj->needs_validate = true;
intel_image->mt->offset = offset;
intel_image->base.RowStride = region->pitch;

View file

@ -49,6 +49,12 @@ struct intel_texture_object
* regions will be copied to this region and the old storage freed.
*/
struct intel_mipmap_tree *mt;
/**
* Set when mipmap trees in the texture images of this texture object
* might not all be the mipmap tree above.
*/
bool needs_validate;
};

View file

@ -21,12 +21,18 @@ intel_update_max_level(struct intel_texture_object *intelObj,
struct gl_sampler_object *sampler)
{
struct gl_texture_object *tObj = &intelObj->base;
int maxlevel;
if (sampler->MinFilter == GL_NEAREST ||
sampler->MinFilter == GL_LINEAR) {
intelObj->_MaxLevel = tObj->BaseLevel;
maxlevel = tObj->BaseLevel;
} else {
intelObj->_MaxLevel = tObj->_MaxLevel;
maxlevel = tObj->_MaxLevel;
}
if (intelObj->_MaxLevel != maxlevel) {
intelObj->_MaxLevel = maxlevel;
intelObj->needs_validate = true;
}
}
@ -55,6 +61,12 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
/* What levels must the tree include at a minimum?
*/
intel_update_max_level(intelObj, sampler);
if (intelObj->mt && intelObj->mt->first_level != tObj->BaseLevel)
intelObj->needs_validate = true;
if (!intelObj->needs_validate)
return true;
firstImage = intel_texture_image(tObj->Image[0][tObj->BaseLevel]);
/* Check tree can hold all active levels. Check tree matches
@ -122,6 +134,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
}
}
intelObj->needs_validate = false;
return true;
}