gulong _cogl_material_layer_get_flags (CoglHandle layer_handle);
/*
+ * Ensures the mipmaps are available for the texture in the layer if
+ * the filter settings would require it
+ */
+void _cogl_material_layer_ensure_mipmaps (CoglHandle layer_handler);
+
+/*
* CoglMaterialFlushFlag:
* @COGL_MATERIAL_FLUSH_FALLBACK_MASK: The fallback_layers member is set to
* a guint32 mask of the layers that can't be supported with the user
_cogl_matrix_stack_flush_to_gl (unit->matrix_stack, COGL_MATRIX_TEXTURE);
}
+void
+_cogl_material_layer_ensure_mipmaps (CoglHandle layer_handle)
+{
+ CoglMaterialLayer *layer;
+
+ layer = _cogl_material_layer_pointer_from_handle (layer_handle);
+
+ if (layer->texture &&
+ (is_mipmap_filter (layer->min_filter) ||
+ is_mipmap_filter (layer->mag_filter)))
+ _cogl_texture_ensure_mipmaps (layer->texture);
+}
+
/*
* _cogl_material_flush_layers_gl_state:
* @fallback_mask: is a bitmask of the material layers that need to be
#endif
CoglTextureUnit *unit;
+ _cogl_material_layer_ensure_mipmaps (layer_handle);
+
new_gl_layer_info.layer0_overridden =
layer0_override_texture ? TRUE : FALSE;
new_gl_layer_info.fallback =
tex_handle = layer->texture;
if (tex_handle != COGL_INVALID_HANDLE)
{
- if (is_mipmap_filter (layer->min_filter)
- || is_mipmap_filter (layer->mag_filter))
- _cogl_texture_ensure_mipmaps (tex_handle);
-
_cogl_texture_set_filters (tex_handle,
layer->min_filter,
layer->mag_filter);
!= COGL_MATERIAL_LAYER_TYPE_TEXTURE)
continue;
+ /* We need to ensure the mipmaps are ready before deciding
+ anything else about the texture because it could become
+ something completely different if it needs to be migrated out
+ of the atlas */
+ _cogl_material_layer_ensure_mipmaps (layer);
+
tex_handle = cogl_material_layer_get_texture (layer);
/* COGL_INVALID_HANDLE textures are handled by