From: Kenneth Graunke Date: Sun, 19 Jun 2016 06:32:08 +0000 (-0700) Subject: i965: Make texture validation code use texture objects, not units. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ab1f2e6bc401636202f93efad3677f26d028e412;p=mesa.git 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 --- diff --git a/src/mesa/drivers/dri/i965/intel_tex.h b/src/mesa/drivers/dri/i965/intel_tex.h index 42565baebf6..9fb1b3ffbc4 100644 --- a/src/mesa/drivers/dri/i965/intel_tex.h +++ b/src/mesa/drivers/dri/i965/intel_tex.h @@ -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 diff --git a/src/mesa/drivers/dri/i965/intel_tex_validate.c b/src/mesa/drivers/dri/i965/intel_tex_validate.c index efcf8604b89..e68d0cbb8a2 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_validate.c +++ b/src/mesa/drivers/dri/i965/intel_tex_validate.c @@ -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); } }