cogl-material: Ensure mipmaps before doing anything else on a texture
When the texture is in the atlas, ensuring the mipmaps can effectively make it become a completely different texture so we should do this before getting the GL handle.
This commit is contained in:
parent
231cfffa18
commit
34b50934be
@ -1400,7 +1400,17 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
|
||||
tex_handle = layer->texture;
|
||||
if (tex_handle != COGL_INVALID_HANDLE)
|
||||
cogl_texture_get_gl_texture (tex_handle, &gl_texture, &gl_target);
|
||||
{
|
||||
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_texture_get_gl_texture (tex_handle, &gl_texture, &gl_target);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_gl_layer_info.fallback = TRUE;
|
||||
@ -1431,13 +1441,6 @@ _cogl_material_flush_layers_gl_state (CoglMaterial *material,
|
||||
GE (glActiveTexture (GL_TEXTURE0 + i));
|
||||
unit = _cogl_get_texture_unit (i);
|
||||
|
||||
_cogl_texture_set_filters (layer->texture,
|
||||
layer->min_filter,
|
||||
layer->mag_filter);
|
||||
if (is_mipmap_filter (layer->min_filter)
|
||||
|| is_mipmap_filter (layer->mag_filter))
|
||||
_cogl_texture_ensure_mipmaps (layer->texture);
|
||||
|
||||
/* FIXME: We could be more clever here and only bind the texture
|
||||
if it is different from gl_layer_info->gl_texture to avoid
|
||||
redundant GL calls. However a few other places in Cogl and
|
||||
|
Loading…
Reference in New Issue
Block a user