cogl-vertex-buffer: Don't always set COGL_MATERIAL_FLUSH_FALLBACK_MASK

Previously CoglVertexBuffer would always set the flush options flags
to at least contain COGL_MATERIAL_FLUSH_FALLBACK_MASK. The code then
later checks whether any flags are set before deciding whether to copy
the material to implement the overrides. This means that it would
always end up copying the material even if there are no fallback
layers. This patch changes it so that it only sets
COGL_MATERIAL_FLUSH_FALLBACK_MASK if fallback_layers != 0.
This commit is contained in:
Neil Roberts 2010-09-15 14:07:30 +01:00
parent 8cfb158f63
commit 42dacf97f8

View File

@ -1533,8 +1533,7 @@ enable_state_for_drawing_buffer (CoglVertexBuffer *buffer)
if (buffer->new_attributes) if (buffer->new_attributes)
cogl_vertex_buffer_submit_real (buffer); cogl_vertex_buffer_submit_real (buffer);
options.flags = options.flags = 0;
COGL_MATERIAL_FLUSH_FALLBACK_MASK;
memset (&options.wrap_mode_overrides, 0, memset (&options.wrap_mode_overrides, 0,
sizeof (options.wrap_mode_overrides)); sizeof (options.wrap_mode_overrides));
@ -1737,7 +1736,11 @@ enable_state_for_drawing_buffer (CoglVertexBuffer *buffer)
/* Disable any tex coord arrays that we didn't use */ /* Disable any tex coord arrays that we didn't use */
_cogl_disable_other_texcoord_arrays (&ctx->temp_bitmask); _cogl_disable_other_texcoord_arrays (&ctx->temp_bitmask);
options.fallback_layers = fallback_layers; if (fallback_layers)
{
options.fallback_layers = fallback_layers;
options.flags |= COGL_MATERIAL_FLUSH_FALLBACK_MASK;
}
if (G_UNLIKELY (options.flags)) if (G_UNLIKELY (options.flags))
{ {