diff options
author | Neil Roberts <neil@linux.intel.com> | 2011-11-28 19:58:15 +0000 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2011-12-06 19:02:06 +0000 |
commit | 68b3643b2543c0f5f787f95663c8e9195e291227 (patch) | |
tree | 916a8dc31d0a195d68d1fcbddec3acdfe241fde9 /cogl/cogl-pipeline-layer.c | |
parent | b7e15929b66ab5a0f6935a5cdcc82c616dbc2d77 (diff) | |
download | cogl-68b3643b2543c0f5f787f95663c8e9195e291227.tar.gz |
snippet: Add a hook for the layer texture coordinate transformation
This adds a hook called COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM.
This can be used to alter the application of the layer user matrix to
a texture coordinate or it can bypass it altogether.
This is the first per-layer hook that affects the vertex shader state
so the patch includes the boilerplate needed to get that to work.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/cogl-pipeline-layer.c')
-rw-r--r-- | cogl/cogl-pipeline-layer.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cogl/cogl-pipeline-layer.c b/cogl/cogl-pipeline-layer.c index 76d17e74..d2d799d5 100644 --- a/cogl/cogl-pipeline-layer.c +++ b/cogl/cogl-pipeline-layer.c @@ -115,6 +115,10 @@ _cogl_pipeline_layer_has_alpha (CoglPipelineLayer *layer) /* All bets are off if the layer contains any snippets */ snippets_authority = _cogl_pipeline_layer_get_authority + (layer, COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS); + if (!COGL_LIST_EMPTY (&snippets_authority->big_state->vertex_snippets)) + return TRUE; + snippets_authority = _cogl_pipeline_layer_get_authority (layer, COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS); if (!COGL_LIST_EMPTY (&snippets_authority->big_state->fragment_snippets)) return TRUE; @@ -211,6 +215,11 @@ _cogl_pipeline_layer_init_multi_property_sparse_state ( } break; } + case COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS: + _cogl_pipeline_snippet_list_copy (&layer->big_state->vertex_snippets, + &authority->big_state-> + vertex_snippets); + break; case COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS: _cogl_pipeline_snippet_list_copy (&layer->big_state->fragment_snippets, &authority->big_state-> @@ -591,6 +600,12 @@ _cogl_pipeline_layer_equal (CoglPipelineLayer *layer0, _cogl_pipeline_layer_point_sprite_coords_equal)) return FALSE; + if (layers_difference & COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_vertex_snippets_equal)) + return FALSE; + if (layers_difference & COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS && !layer_state_equal (COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS_INDEX, authorities0, authorities1, @@ -609,6 +624,9 @@ _cogl_pipeline_layer_free (CoglPipelineLayer *layer) layer->texture != NULL) cogl_object_unref (layer->texture); + if (layer->differences & COGL_PIPELINE_LAYER_STATE_VERTEX_SNIPPETS) + _cogl_pipeline_snippet_list_free (&layer->big_state->vertex_snippets); + if (layer->differences & COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS) _cogl_pipeline_snippet_list_free (&layer->big_state->fragment_snippets); |