diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_tex.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_tex_validate.c | 30 |
2 files changed, 17 insertions, 16 deletions
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); } } |