cogl-primitives: Ensure the mipmaps for a layer before logging quads
With the atlas texture backend ensuring the mipmaps can make it become a completely different texture which will have different texture coordinates or may even be sliced. Therefore we need to ensure the mipmaps before deciding which quads to log in the journal. This adds a new private function to cogl-material which ensures the mipmaps if needed.
This commit is contained in:
parent
ae7825275e
commit
12b45aaa30
@ -204,6 +204,12 @@ typedef enum _CoglMaterialLayerFlags
|
||||
*/
|
||||
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
|
||||
|
@ -1326,6 +1326,19 @@ _cogl_material_layer_flush_gl_sampler_state (CoglMaterialLayer *layer,
|
||||
_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
|
||||
@ -1397,6 +1410,8 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
#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 =
|
||||
@ -1407,10 +1422,6 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
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);
|
||||
|
@ -401,6 +401,12 @@ _cogl_rectangles_with_multitexture_coords (
|
||||
!= 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
|
||||
|
Loading…
Reference in New Issue
Block a user