From 17538cf5e622fd8dd134883d3aa344770e0720ff Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 14 Sep 2010 00:27:57 +0100 Subject: [PATCH] material-arbfp: don't redo codegen for texture changes This makes it so we don't consider LAYER_STATE_TEXTURE changes to affect the arbfp code. This should avoid a lot of unneeded passes of code generation for applications modifying the texture for a layer. --- cogl/cogl-material-arbfp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cogl/cogl-material-arbfp.c b/cogl/cogl-material-arbfp.c index dc66befe7..36ce6a8b4 100644 --- a/cogl/cogl-material-arbfp.c +++ b/cogl/cogl-material-arbfp.c @@ -135,8 +135,7 @@ layers_arbfp_would_differ (CoglMaterialLayer **material0_layers, unsigned long arbfp_codegen_modifiers = COGL_MATERIAL_LAYER_STATE_COMBINE | COGL_MATERIAL_LAYER_STATE_COMBINE_CONSTANT | - COGL_MATERIAL_LAYER_STATE_UNIT | - COGL_MATERIAL_LAYER_STATE_TEXTURE; + COGL_MATERIAL_LAYER_STATE_UNIT; for (i = 0; i < n_layers; i++) { @@ -1201,11 +1200,18 @@ _cogl_material_backend_arbfp_layer_pre_change_notify ( CoglMaterialLayerState change) { CoglMaterialBackendARBfpPrivate *priv = get_arbfp_authority_priv (owner); + static const unsigned long not_fragment_op_changes = + COGL_MATERIAL_LAYER_STATE_TEXTURE; + priv = get_arbfp_authority_priv (owner); if (!priv) return; - dirty_fragment_state (owner, priv); + if (!(change & not_fragment_op_changes)) + { + dirty_fragment_state (owner, priv); + return; + } /* TODO: we could be saving snippets of texture combine code along * with each layer and then when a layer changes we would just free