summaryrefslogtreecommitdiff
path: root/cogl/cogl-pipeline-layer.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-11-25 17:36:03 +0000
committerRobert Bragg <robert@linux.intel.com>2011-12-06 19:02:06 +0000
commitdf0f9a862ff338463e2a677337fa466e6cb7b5c5 (patch)
treefcea2c29c80135b2dbaff0c94040da90a64c1ad6 /cogl/cogl-pipeline-layer.c
parent4cdf66f89b2beb13cbd461f848fb433b4af76566 (diff)
downloadcogl-df0f9a862ff338463e2a677337fa466e6cb7b5c5.tar.gz
pipeline: Add a snippet hook for the texture lookup
This adds a per-layer snippet hook for the texure lookup. Here the snippet can modify the texture coordinates used for the lookup or modify the texel resulting from the lookup. This is the first per-layer hook so this also adds the COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS state and all of the boilerplate needed to make that work. Most of the functions used by the pipeline state to manage the snippet list has been moved into cogl-pipeline-snippet.c so that it can be shared with the layer state. Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/cogl-pipeline-layer.c')
-rw-r--r--cogl/cogl-pipeline-layer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/cogl/cogl-pipeline-layer.c b/cogl/cogl-pipeline-layer.c
index 0b5693fe..86e07508 100644
--- a/cogl/cogl-pipeline-layer.c
+++ b/cogl/cogl-pipeline-layer.c
@@ -204,6 +204,11 @@ _cogl_pipeline_layer_init_multi_property_sparse_state (
}
break;
}
+ case COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS:
+ _cogl_pipeline_snippet_list_copy (&layer->big_state->fragment_snippets,
+ &authority->big_state->
+ fragment_snippets);
+ break;
}
}
@@ -579,6 +584,12 @@ _cogl_pipeline_layer_equal (CoglPipelineLayer *layer0,
_cogl_pipeline_layer_point_sprite_coords_equal))
return FALSE;
+ if (layers_difference & COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS &&
+ !layer_state_equal (COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS_INDEX,
+ authorities0, authorities1,
+ _cogl_pipeline_layer_fragment_snippets_equal))
+ return FALSE;
+
return TRUE;
}
@@ -591,6 +602,9 @@ _cogl_pipeline_layer_free (CoglPipelineLayer *layer)
layer->texture != NULL)
cogl_object_unref (layer->texture);
+ if (layer->differences & COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS)
+ _cogl_pipeline_snippet_list_free (&layer->big_state->fragment_snippets);
+
if (layer->differences & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE)
g_slice_free (CoglPipelineLayerBigState, layer->big_state);