material: remove override options from _cogl_material_equal

As a follow on to using cogl_material_copy instead of flush options this
patch now removes the ability to pass flush options to
_cogl_material_equal which is the final reference to the
CoglMaterialFlushOptions mechanism.
This commit is contained in:
Robert Bragg 2010-05-18 23:38:33 +01:00
parent 3979de6982
commit 6b5281401c
3 changed files with 14 additions and 52 deletions

View File

@ -349,9 +349,7 @@ compare_entry_materials (CoglJournalEntry *entry0, CoglJournalEntry *entry1)
* that we that we are able to batch the 90% common cases, but may not * that we that we are able to batch the 90% common cases, but may not
* look at less common differences. */ * look at less common differences. */
if (_cogl_material_equal (entry0->material, if (_cogl_material_equal (entry0->material,
NULL,
entry1->material, entry1->material,
NULL,
TRUE)) TRUE))
return TRUE; return TRUE;
else else
@ -797,7 +795,7 @@ _cogl_journal_log_quad (const float *position,
_cogl_material_apply_legacy_state (source); _cogl_material_apply_legacy_state (source);
} }
flush_options.flags = COGL_MATERIAL_FLUSH_SKIP_GL_COLOR; flush_options.flags = 0;
if (G_UNLIKELY (cogl_material_get_n_layers (material) != n_layers)) if (G_UNLIKELY (cogl_material_get_n_layers (material) != n_layers))
{ {
disable_layers = (1 << n_layers) - 1; disable_layers = (1 << n_layers) - 1;

View File

@ -688,9 +688,7 @@ _cogl_material_flush_gl_state (CoglHandle material,
gboolean gboolean
_cogl_material_equal (CoglHandle material0_handle, _cogl_material_equal (CoglHandle material0_handle,
CoglMaterialFlushOptions *material0_flush_options,
CoglHandle material1_handle, CoglHandle material1_handle,
CoglMaterialFlushOptions *material1_flush_options,
gboolean skip_gl_color); gboolean skip_gl_color);
CoglHandle CoglHandle

View File

@ -3005,46 +3005,21 @@ _cogl_material_compare_differences (CoglMaterial *material0,
* False positives aren't allowed. * False positives aren't allowed.
*/ */
gboolean gboolean
_cogl_material_equal (CoglHandle material0_handle, _cogl_material_equal (CoglHandle handle0,
CoglMaterialFlushOptions *material0_flush_options, CoglHandle handle1,
CoglHandle material1_handle,
CoglMaterialFlushOptions *material1_flush_options,
gboolean skip_gl_color) gboolean skip_gl_color)
{ {
CoglMaterial *material0; CoglMaterial *material0 = COGL_MATERIAL (handle0);
CoglMaterial *material1; CoglMaterial *material1 = COGL_MATERIAL (handle1);
gboolean material0_overridden = FALSE;
gboolean material1_overridden = FALSE;
unsigned long materials_difference; unsigned long materials_difference;
gboolean equal = FALSE;
if (material0_flush_options->flags)
{
/* XXX: we really need to get rid of overrides! */
material0 = cogl_material_copy (material0_handle);
_cogl_material_apply_overrides (material0, material0_flush_options);
material0_overridden = TRUE;
}
else
material0 = COGL_MATERIAL (material0_handle);
if (material1_flush_options->flags)
{
/* XXX: we really need to get rid of overrides! */
material1 = cogl_material_copy (material1_handle);
_cogl_material_apply_overrides (material1, material1_flush_options);
material1_overridden = TRUE;
}
else
material1 = COGL_MATERIAL (material1_handle);
if (material0 == material1) if (material0 == material1)
goto done; return TRUE;
/* First check non-sparse properties */ /* First check non-sparse properties */
if (material0->real_blend_enable != material1->real_blend_enable) if (material0->real_blend_enable != material1->real_blend_enable)
goto done; return FALSE;
/* Then check sparse properties */ /* Then check sparse properties */
@ -3062,7 +3037,7 @@ _cogl_material_equal (CoglHandle material0_handle,
COGL_MATERIAL_STATE_COLOR); COGL_MATERIAL_STATE_COLOR);
if (!cogl_color_equal (&authority0->color, &authority1->color)) if (!cogl_color_equal (&authority0->color, &authority1->color))
goto done; return FALSE;
} }
if (materials_difference & COGL_MATERIAL_STATE_LIGHTING) if (materials_difference & COGL_MATERIAL_STATE_LIGHTING)
@ -3075,7 +3050,7 @@ _cogl_material_equal (CoglHandle material0_handle,
COGL_MATERIAL_STATE_LIGHTING); COGL_MATERIAL_STATE_LIGHTING);
if (!_cogl_material_lighting_state_equal (authority0, authority1)) if (!_cogl_material_lighting_state_equal (authority0, authority1))
goto done; return FALSE;
} }
if (materials_difference & COGL_MATERIAL_STATE_ALPHA_FUNC) if (materials_difference & COGL_MATERIAL_STATE_ALPHA_FUNC)
@ -3088,7 +3063,7 @@ _cogl_material_equal (CoglHandle material0_handle,
COGL_MATERIAL_STATE_ALPHA_FUNC); COGL_MATERIAL_STATE_ALPHA_FUNC);
if (!_cogl_material_alpha_state_equal (authority0, authority1)) if (!_cogl_material_alpha_state_equal (authority0, authority1))
goto done; return FALSE;
} }
if (materials_difference & COGL_MATERIAL_STATE_BLEND) if (materials_difference & COGL_MATERIAL_STATE_BLEND)
@ -3101,7 +3076,7 @@ _cogl_material_equal (CoglHandle material0_handle,
COGL_MATERIAL_STATE_BLEND); COGL_MATERIAL_STATE_BLEND);
if (!_cogl_material_blend_state_equal (authority0, authority1)) if (!_cogl_material_blend_state_equal (authority0, authority1))
goto done; return FALSE;
} }
if (materials_difference & COGL_MATERIAL_STATE_BLEND_ENABLE) if (materials_difference & COGL_MATERIAL_STATE_BLEND_ENABLE)
@ -3114,7 +3089,7 @@ _cogl_material_equal (CoglHandle material0_handle,
COGL_MATERIAL_STATE_BLEND_ENABLE); COGL_MATERIAL_STATE_BLEND_ENABLE);
if (authority0->blend_enable != authority1->blend_enable) if (authority0->blend_enable != authority1->blend_enable)
goto done; return FALSE;
} }
if (materials_difference & COGL_MATERIAL_STATE_LAYERS) if (materials_difference & COGL_MATERIAL_STATE_LAYERS)
@ -3127,19 +3102,10 @@ _cogl_material_equal (CoglHandle material0_handle,
COGL_MATERIAL_STATE_LAYERS); COGL_MATERIAL_STATE_LAYERS);
if (!_cogl_material_layers_equal (authority0, authority1)) if (!_cogl_material_layers_equal (authority0, authority1))
goto done; return FALSE;
} }
equal = TRUE; return TRUE;
done:
if (material0_overridden)
cogl_handle_unref (material0);
if (material1_overridden)
cogl_handle_unref (material1);
return equal;
} }
void void