i965: Make texture validation code use texture objects, not units.
This requires moving the _MaxLevel handling up to the callers. Another user of intel_finalize_mipmap_tree will be added later that depends on _MaxLevel not being modified. Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
parent
0a2e878c69
commit
ab1f2e6bc4
|
@ -50,6 +50,7 @@ intel_miptree_create_for_teximage(struct brw_context *brw,
|
|||
struct intel_texture_image *intelImage,
|
||||
enum intel_miptree_create_flags flags);
|
||||
|
||||
void intel_finalize_mipmap_tree(struct brw_context *brw, GLuint unit);
|
||||
void intel_finalize_mipmap_tree(struct brw_context *brw,
|
||||
struct gl_texture_object *tex_obj);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -65,12 +65,10 @@ intel_update_max_level(struct gl_texture_object *tObj,
|
|||
* stored in other miptrees.
|
||||
*/
|
||||
void
|
||||
intel_finalize_mipmap_tree(struct brw_context *brw, GLuint unit)
|
||||
intel_finalize_mipmap_tree(struct brw_context *brw,
|
||||
struct gl_texture_object *tObj)
|
||||
{
|
||||
struct gl_context *ctx = &brw->ctx;
|
||||
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
|
||||
struct intel_texture_object *intelObj = intel_texture_object(tObj);
|
||||
struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
|
||||
GLuint face, i;
|
||||
GLuint nr_faces = 0;
|
||||
struct intel_texture_image *firstImage;
|
||||
|
@ -80,13 +78,6 @@ intel_finalize_mipmap_tree(struct brw_context *brw, GLuint unit)
|
|||
if (tObj->Target == GL_TEXTURE_BUFFER)
|
||||
return;
|
||||
|
||||
/* We know that this is true by now, and if it wasn't, we might have
|
||||
* mismatched level sizes and the copies would fail.
|
||||
*/
|
||||
assert(intelObj->base._BaseComplete);
|
||||
|
||||
intel_update_max_level(tObj, sampler);
|
||||
|
||||
/* What levels does this validated texture image require? */
|
||||
int validate_first_level = tObj->BaseLevel;
|
||||
int validate_last_level = intelObj->_MaxLevel;
|
||||
|
@ -189,10 +180,19 @@ brw_validate_textures(struct brw_context *brw)
|
|||
const int max_enabled_unit = ctx->Texture._MaxEnabledTexImageUnit;
|
||||
|
||||
for (int unit = 0; unit <= max_enabled_unit; unit++) {
|
||||
struct gl_texture_unit *tex_unit = &ctx->Texture.Unit[unit];
|
||||
struct gl_texture_object *tex_obj = ctx->Texture.Unit[unit]._Current;
|
||||
|
||||
if (tex_unit->_Current) {
|
||||
intel_finalize_mipmap_tree(brw, unit);
|
||||
}
|
||||
if (!tex_obj)
|
||||
continue;
|
||||
|
||||
struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
|
||||
|
||||
/* We know that this is true by now, and if it wasn't, we might have
|
||||
* mismatched level sizes and the copies would fail.
|
||||
*/
|
||||
assert(tex_obj->_BaseComplete);
|
||||
|
||||
intel_update_max_level(tex_obj, sampler);
|
||||
intel_finalize_mipmap_tree(brw, tex_obj);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue