mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
cogl-material: Fix some problems with flushing texture overrides
There were a few problems flushing texture overrides so that sliced textures would not work: * In _cogl_material_set_layer_texture it ignored the 'overriden' parameter and always set texture_overridden to FALSE. * cogl_texture_get_gl_texture wasn't being called correctly in override_layer_texture_cb. It returns a gboolean to indicate the error status but this boolean was being assigned to gl_target. * _cogl_material_layer_texture_equal did not take into account the override. * _cogl_material_layer_get_texture_info did not return the overridden texture so it would always use the first texture slice.
This commit is contained in:
parent
61cbeeacfa
commit
475a72fd94
@ -2042,7 +2042,7 @@ _cogl_material_set_layer_texture (CoglMaterial *material,
|
||||
layer->texture != COGL_INVALID_HANDLE)
|
||||
cogl_handle_unref (layer->texture);
|
||||
layer->texture = texture;
|
||||
layer->texture_overridden = FALSE;
|
||||
layer->texture_overridden = overriden;
|
||||
layer->slice_gl_texture = slice_gl_texture;
|
||||
layer->slice_gl_target = slice_gl_target;
|
||||
|
||||
@ -2651,7 +2651,7 @@ override_layer_texture_cb (CoglMaterialLayer *layer, void *user_data)
|
||||
texture = _cogl_material_layer_get_texture (layer);
|
||||
|
||||
if (texture != COGL_INVALID_HANDLE)
|
||||
gl_target = cogl_texture_get_gl_texture (texture, NULL, &gl_target);
|
||||
cogl_texture_get_gl_texture (texture, NULL, &gl_target);
|
||||
else
|
||||
gl_target = GL_TEXTURE_2D;
|
||||
|
||||
@ -2736,6 +2736,15 @@ _cogl_material_layer_texture_equal (CoglMaterialLayer *authority0,
|
||||
{
|
||||
if (authority0->texture != authority1->texture)
|
||||
return FALSE;
|
||||
|
||||
if (authority0->texture_overridden != authority1->texture_overridden)
|
||||
return FALSE;
|
||||
|
||||
if (authority0->texture_overridden &&
|
||||
(authority0->slice_gl_texture != authority1->slice_gl_texture ||
|
||||
authority0->slice_gl_target != authority1->slice_gl_target))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -5358,8 +5367,13 @@ _cogl_material_layer_get_texture_info (CoglMaterialLayer *layer,
|
||||
*texture = layer->texture;
|
||||
if (G_UNLIKELY (*texture == COGL_INVALID_HANDLE))
|
||||
*texture = ctx->default_gl_texture_2d_tex;
|
||||
if (layer->texture_overridden)
|
||||
{
|
||||
*gl_texture = layer->slice_gl_texture;
|
||||
*gl_target = layer->slice_gl_target;
|
||||
}
|
||||
else
|
||||
cogl_texture_get_gl_texture (*texture, gl_texture, gl_target);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef HAVE_COGL_GLES
|
||||
|
Loading…
Reference in New Issue
Block a user