mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
[cogl] Fix more brokeness with _cogl_material_equal
commit e2c4a2a9f8
fixed one thing but broke many others things :-/
hopfully this fixes that.
It turned out that the journal was mistakenly setting the OVERRIDE_LAYER0
flush option for all entries, but some other logic errors were also
uncovered in _cogl_material_equal.
This commit is contained in:
parent
a8e93e8588
commit
af49769b33
@ -1630,6 +1630,29 @@ _cogl_material_flush_gl_state (CoglHandle handle,
|
|||||||
0, sizeof (CoglMaterialFlushOptions));
|
0, sizeof (CoglMaterialFlushOptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_cogl_material_layer_equal (CoglMaterialLayer *material0_layer,
|
||||||
|
CoglHandle material0_layer_texture,
|
||||||
|
CoglMaterialLayer *material1_layer,
|
||||||
|
CoglHandle material1_layer_texture)
|
||||||
|
{
|
||||||
|
if (material0_layer_texture != material1_layer_texture)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if ((material0_layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE) !=
|
||||||
|
(material1_layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
#if 0 /* TODO */
|
||||||
|
if (!_deep_are_layer_combines_equal ())
|
||||||
|
return FALSE;
|
||||||
|
#else
|
||||||
|
if (!(material0_layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE))
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* This is used by the Cogl journal to compare materials so that it
|
/* This is used by the Cogl journal to compare materials so that it
|
||||||
* can split up geometry that needs different OpenGL state.
|
* can split up geometry that needs different OpenGL state.
|
||||||
@ -1781,11 +1804,17 @@ _cogl_material_equal (CoglHandle material0_handle,
|
|||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
/* NB: At this point we know if COGL_MATERIAL_FLUSH_LAYER0_OVERRIDE is being
|
/* NB: At this point we know if COGL_MATERIAL_FLUSH_LAYER0_OVERRIDE is being
|
||||||
* used then both materials are overriding with the same texture so we can
|
* used then both materials are overriding with the same texture. */
|
||||||
* simply skip over layer 0 */
|
if (flush_flags0 & COGL_MATERIAL_FLUSH_LAYER0_OVERRIDE &&
|
||||||
if (material0_flush_options->flags & COGL_MATERIAL_FLUSH_LAYER0_OVERRIDE &&
|
|
||||||
l0 && l1)
|
l0 && l1)
|
||||||
{
|
{
|
||||||
|
/* We still need to check if the combine modes etc are equal, but we
|
||||||
|
* simply pass COGL_INVALID_HANDLE for both texture handles so they will
|
||||||
|
* be considered equal */
|
||||||
|
if (!_cogl_material_layer_equal (l0->data, COGL_INVALID_HANDLE,
|
||||||
|
l1->data, COGL_INVALID_HANDLE))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
l0 = l0->next;
|
l0 = l0->next;
|
||||||
l1 = l1->next;
|
l1 = l1->next;
|
||||||
i++;
|
i++;
|
||||||
@ -1801,28 +1830,32 @@ _cogl_material_equal (CoglHandle material0_handle,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* NB: At this point we know that the fallback and disable masks for
|
/* NB: At this point we know that the fallback and disable masks for
|
||||||
* both materials are equal */
|
* both materials are equal. */
|
||||||
if ((disable_layers0 & (1<<i)) || (fallback_layers0 & (1<<i)))
|
if (disable_layers0 & (1<<i))
|
||||||
continue;
|
goto next_layer;
|
||||||
|
|
||||||
m0_layer = l0->data;
|
m0_layer = l0->data;
|
||||||
m1_layer = l1->data;
|
m1_layer = l1->data;
|
||||||
|
|
||||||
if (m0_layer->texture != m1_layer->texture)
|
/* NB: The use of a fallback texture doesn't imply that the combine
|
||||||
|
* modes etc are the same.
|
||||||
|
*/
|
||||||
|
if ((disable_layers0 & (1<<i)) || (fallback_layers0 & (1<<i)))
|
||||||
|
{
|
||||||
|
/* As with layer0 overrides, we simply pass COGL_INVALID_HANDLEs for
|
||||||
|
* both texture handles here so they will be considered equal. */
|
||||||
|
if (!_cogl_material_layer_equal (m0_layer, COGL_INVALID_HANDLE,
|
||||||
|
m1_layer, COGL_INVALID_HANDLE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!_cogl_material_layer_equal (m0_layer, m0_layer->texture,
|
||||||
|
m1_layer, m1_layer->texture))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if ((m0_layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE) !=
|
next_layer:
|
||||||
(m1_layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
#if 0 /* TODO */
|
|
||||||
if (!_deep_are_layer_combines_equal ())
|
|
||||||
return FALSE;
|
|
||||||
#else
|
|
||||||
if (!(m0_layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE))
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
l0 = l0->next;
|
l0 = l0->next;
|
||||||
l1 = l1->next;
|
l1 = l1->next;
|
||||||
i++;
|
i++;
|
||||||
|
@ -732,11 +732,14 @@ _cogl_journal_log_quad (float x_1,
|
|||||||
entry->flush_options.flags =
|
entry->flush_options.flags =
|
||||||
COGL_MATERIAL_FLUSH_FALLBACK_MASK |
|
COGL_MATERIAL_FLUSH_FALLBACK_MASK |
|
||||||
COGL_MATERIAL_FLUSH_DISABLE_MASK |
|
COGL_MATERIAL_FLUSH_DISABLE_MASK |
|
||||||
COGL_MATERIAL_FLUSH_LAYER0_OVERRIDE |
|
|
||||||
COGL_MATERIAL_FLUSH_SKIP_GL_COLOR;
|
COGL_MATERIAL_FLUSH_SKIP_GL_COLOR;
|
||||||
entry->flush_options.fallback_layers = fallback_layers;
|
entry->flush_options.fallback_layers = fallback_layers;
|
||||||
entry->flush_options.disable_layers = disable_layers;
|
entry->flush_options.disable_layers = disable_layers;
|
||||||
|
if (layer0_override_texture)
|
||||||
|
{
|
||||||
|
entry->flush_options.flags |= COGL_MATERIAL_FLUSH_LAYER0_OVERRIDE;
|
||||||
entry->flush_options.layer0_override_texture = layer0_override_texture;
|
entry->flush_options.layer0_override_texture = layer0_override_texture;
|
||||||
|
}
|
||||||
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))
|
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))
|
||||||
cogl_get_modelview_matrix (&entry->model_view);
|
cogl_get_modelview_matrix (&entry->model_view);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user