summaryrefslogtreecommitdiff
path: root/cogl/cogl-pipeline-layer-state.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-11-09 14:50:59 +0000
committerNeil Roberts <neil@linux.intel.com>2012-11-21 19:00:46 +0000
commit94b13b1abddfd8beef869433906661669634780e (patch)
tree1cb92c3ed7a8157c6faefad0c46b57d2ea49a23a /cogl/cogl-pipeline-layer-state.c
parentf5fb9be70a92f751886a94da0b34e14252ed197e (diff)
downloadcogl-94b13b1abddfd8beef869433906661669634780e.tar.gz
Remove the pipeline layer user matrix
The pipeline layer user matrix is not used very often and the way it is currently implemented comes at a non-trivial cost. Any pipeline layer that requires the big state needs to have a CoglMatrix added to its state. The generated vertex shader will always multiply the coordinates by the matrix even if it is just the identity matrix. The same functionality can be achieved on programmable hardware using a shader snippet. The snippet hook for the texture coordinate transform is still available to make this convenient. If we later decide that this is a really useful feature for fixed function hardware then we can add it back in and try to make it work more efficiently. In the meantime however it seems like a good idea to get rid of the API now before Cogl 2.0 is released and the API becomes fixed. Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/cogl-pipeline-layer-state.c')
-rw-r--r--cogl/cogl-pipeline-layer-state.c128
1 files changed, 0 insertions, 128 deletions
diff --git a/cogl/cogl-pipeline-layer-state.c b/cogl/cogl-pipeline-layer-state.c
index b69ff464..5c05d166 100644
--- a/cogl/cogl-pipeline-layer-state.c
+++ b/cogl/cogl-pipeline-layer-state.c
@@ -1043,19 +1043,6 @@ _cogl_pipeline_layer_sampler_equal (CoglPipelineLayer *authority0,
}
CoglBool
-_cogl_pipeline_layer_user_matrix_equal (CoglPipelineLayer *authority0,
- CoglPipelineLayer *authority1)
-{
- CoglPipelineLayerBigState *big_state0 = authority0->big_state;
- CoglPipelineLayerBigState *big_state1 = authority1->big_state;
-
- if (!cogl_matrix_equal (&big_state0->matrix, &big_state1->matrix))
- return FALSE;
-
- return TRUE;
-}
-
-CoglBool
_cogl_pipeline_layer_point_sprite_coords_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1)
{
@@ -1381,94 +1368,6 @@ _cogl_pipeline_get_layer_combine_constant (CoglPipeline *pipeline,
sizeof (float) * 4);
}
-/* We should probably make a public API version of this that has a
- matrix out-param. For an internal API it's good to be able to avoid
- copying the matrix */
-const CoglMatrix *
-_cogl_pipeline_get_layer_matrix (CoglPipeline *pipeline, int layer_index)
-{
- CoglPipelineLayerState change =
- COGL_PIPELINE_LAYER_STATE_USER_MATRIX;
- CoglPipelineLayer *layer;
- CoglPipelineLayer *authority;
-
- _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL);
-
- layer = _cogl_pipeline_get_layer (pipeline, layer_index);
-
- authority = _cogl_pipeline_layer_get_authority (layer, change);
- return &authority->big_state->matrix;
-}
-
-void
-cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline,
- int layer_index,
- const CoglMatrix *matrix)
-{
- CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_USER_MATRIX;
- CoglPipelineLayer *layer;
- CoglPipelineLayer *authority;
- CoglPipelineLayer *new;
-
- _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
-
- /* Note: this will ensure that the layer exists, creating one if it
- * doesn't already.
- *
- * Note: If the layer already existed it's possibly owned by another
- * pipeline. If the layer is created then it will be owned by
- * pipeline. */
- layer = _cogl_pipeline_get_layer (pipeline, layer_index);
-
- /* Now find the ancestor of the layer that is the authority for the
- * state we want to change */
- authority = _cogl_pipeline_layer_get_authority (layer, state);
-
- if (cogl_matrix_equal (matrix, &authority->big_state->matrix))
- return;
-
- new = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, state);
- if (new != layer)
- layer = new;
- else
- {
- /* If the original layer we found is currently the authority on
- * the state we are changing see if we can revert to one of our
- * ancestors being the authority. */
- if (layer == authority &&
- _cogl_pipeline_layer_get_parent (authority) != NULL)
- {
- CoglPipelineLayer *parent =
- _cogl_pipeline_layer_get_parent (authority);
- CoglPipelineLayer *old_authority =
- _cogl_pipeline_layer_get_authority (parent, state);
-
- if (cogl_matrix_equal (matrix, &old_authority->big_state->matrix))
- {
- layer->differences &= ~state;
-
- g_assert (layer->owner == pipeline);
- if (layer->differences == 0)
- _cogl_pipeline_prune_empty_layer_difference (pipeline,
- layer);
- return;
- }
- }
- }
-
- layer->big_state->matrix = *matrix;
-
- /* If we weren't previously the authority on this state then we need
- * to extended our differences mask and so it's possible that some
- * of our ancestry will now become redundant, so we aim to reparent
- * ourselves if that's true... */
- if (layer != authority)
- {
- layer->differences |= state;
- _cogl_pipeline_layer_prune_redundant_ancestry (layer);
- }
-}
-
CoglTexture *
_cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer)
{
@@ -1477,23 +1376,6 @@ _cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer)
return _cogl_pipeline_layer_get_texture_real (layer);
}
-CoglBool
-_cogl_pipeline_layer_has_user_matrix (CoglPipeline *pipeline,
- int layer_index)
-{
- CoglPipelineLayer *layer;
- CoglPipelineLayer *authority;
-
- layer = _cogl_pipeline_get_layer (pipeline, layer_index);
-
- authority =
- _cogl_pipeline_layer_get_authority (layer,
- COGL_PIPELINE_LAYER_STATE_USER_MATRIX);
-
- /* If the authority is the default pipeline then no, otherwise yes */
- return _cogl_pipeline_layer_get_parent (authority) ? TRUE : FALSE;
-}
-
void
_cogl_pipeline_layer_get_filters (CoglPipelineLayer *layer,
CoglPipelineFilter *min_filter,
@@ -1766,16 +1648,6 @@ done:
}
void
-_cogl_pipeline_layer_hash_user_matrix_state (CoglPipelineLayer *authority,
- CoglPipelineLayer **authorities,
- CoglPipelineHashState *state)
-{
- CoglPipelineLayerBigState *big_state = authority->big_state;
- state->hash = _cogl_util_one_at_a_time_hash (state->hash, &big_state->matrix,
- sizeof (float) * 16);
-}
-
-void
_cogl_pipeline_layer_hash_point_sprite_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state)