From a433bd8e9e732016e03ced0bc7ab57ee44c54620 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 15 Sep 2010 14:07:30 +0100 Subject: [PATCH] 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. --- cogl/cogl-vertex-buffer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cogl/cogl-vertex-buffer.c b/cogl/cogl-vertex-buffer.c index 24e210409..65f275a65 100644 --- a/cogl/cogl-vertex-buffer.c +++ b/cogl/cogl-vertex-buffer.c @@ -1533,8 +1533,7 @@ enable_state_for_drawing_buffer (CoglVertexBuffer *buffer) if (buffer->new_attributes) cogl_vertex_buffer_submit_real (buffer); - options.flags = - COGL_MATERIAL_FLUSH_FALLBACK_MASK; + options.flags = 0; memset (&options.wrap_mode_overrides, 0, 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 */ _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)) {