From d2326d497ad24a5a75ad8ad350b82aa66f967bb7 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 1 Dec 2010 15:48:37 +0000 Subject: [PATCH] cogl-pipeline: Fix comparing layer states for finding codgen authority When compiling for GLES2, the codegen is affected by state other than the layers. That means when we find an authority for the codegen state we can't directly look at authority->n_layers to determine the number of layers because it isn't necessarily the layer state authority. This patch changes it to use cogl_pipeline_get_n_layers instead. Once we have two authorities that differ in codegen state we then compare all of the layers to decide if they would affect codegen. However it was ignoring the fact that the authorities might also differ by the other codegen state. This path also adds an extra check for whether _cogl_pipeline_compare_differences contains any codegen bits other than COGL_PIPELINE_STATE_LAYERS. --- cogl/cogl-pipeline.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c index cd07f369e..9d38c7535 100644 --- a/cogl/cogl-pipeline.c +++ b/cogl/cogl-pipeline.c @@ -5859,13 +5859,20 @@ _cogl_pipeline_find_codegen_authority (CoglPipeline *pipeline, else return authority0; - n_layers = authority0->n_layers; + n_layers = cogl_pipeline_get_n_layers (authority0); for (;;) { AddLayersToArrayState state; - if (authority0->n_layers != authority1->n_layers) + if (n_layers != cogl_pipeline_get_n_layers (authority1)) + return authority0; + + /* If the programs differ by anything that isn't part of the + layer state then we can't continue */ + if ((codegen_state & ~COGL_PIPELINE_STATE_LAYERS) && + (_cogl_pipeline_compare_differences (authority0, authority1) & + (codegen_state & ~COGL_PIPELINE_STATE_LAYERS))) return authority0; authority0_layers =