* 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;
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;
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);
}
}