pipeline: Assume blend enabled when there are snippets
Whenever snippets are enabled we can't determine whether the final color will be fully opaque so we just have to assume blending should be enabled. Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
df0f9a862f
commit
5be5a03343
4 changed files with 43 additions and 5 deletions
|
@ -78,6 +78,7 @@ _cogl_pipeline_layer_has_alpha (CoglPipelineLayer *layer)
|
||||||
COGL_PIPELINE_LAYER_STATE_COMBINE);
|
COGL_PIPELINE_LAYER_STATE_COMBINE);
|
||||||
CoglPipelineLayerBigState *big_state = combine_authority->big_state;
|
CoglPipelineLayerBigState *big_state = combine_authority->big_state;
|
||||||
CoglPipelineLayer *tex_authority;
|
CoglPipelineLayer *tex_authority;
|
||||||
|
CoglPipelineLayer *snippets_authority;
|
||||||
|
|
||||||
/* has_alpha maintains the alpha status for the GL_PREVIOUS layer */
|
/* has_alpha maintains the alpha status for the GL_PREVIOUS layer */
|
||||||
|
|
||||||
|
@ -112,6 +113,12 @@ _cogl_pipeline_layer_has_alpha (CoglPipelineLayer *layer)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* All bets are off if the layer contains any snippets */
|
||||||
|
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;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,12 @@ _cogl_pipeline_has_vertex_snippets (CoglPipeline *pipeline);
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_pipeline_has_fragment_snippets (CoglPipeline *pipeline);
|
_cogl_pipeline_has_fragment_snippets (CoglPipeline *pipeline);
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_cogl_pipeline_has_non_layer_vertex_snippets (CoglPipeline *pipeline);
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_cogl_pipeline_has_non_layer_fragment_snippets (CoglPipeline *pipeline);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_pipeline_set_fog_state (CoglPipeline *pipeline,
|
_cogl_pipeline_set_fog_state (CoglPipeline *pipeline,
|
||||||
const CoglPipelineFogState *fog_state);
|
const CoglPipelineFogState *fog_state);
|
||||||
|
|
|
@ -1632,7 +1632,7 @@ cogl_pipeline_add_fragment_hook (CoglPipeline *pipeline,
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_pipeline_has_vertex_snippets (CoglPipeline *pipeline)
|
_cogl_pipeline_has_non_layer_vertex_snippets (CoglPipeline *pipeline)
|
||||||
{
|
{
|
||||||
CoglPipeline *authority =
|
CoglPipeline *authority =
|
||||||
_cogl_pipeline_get_authority (pipeline,
|
_cogl_pipeline_get_authority (pipeline,
|
||||||
|
@ -1641,6 +1641,22 @@ _cogl_pipeline_has_vertex_snippets (CoglPipeline *pipeline)
|
||||||
return !COGL_LIST_EMPTY (&authority->big_state->vertex_snippets);
|
return !COGL_LIST_EMPTY (&authority->big_state->vertex_snippets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_cogl_pipeline_has_vertex_snippets (CoglPipeline *pipeline)
|
||||||
|
{
|
||||||
|
return _cogl_pipeline_has_non_layer_vertex_snippets (pipeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_cogl_pipeline_has_non_layer_fragment_snippets (CoglPipeline *pipeline)
|
||||||
|
{
|
||||||
|
CoglPipeline *authority =
|
||||||
|
_cogl_pipeline_get_authority (pipeline,
|
||||||
|
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS);
|
||||||
|
|
||||||
|
return !COGL_LIST_EMPTY (&authority->big_state->fragment_snippets);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
check_layer_has_fragment_snippet (CoglPipelineLayer *layer,
|
check_layer_has_fragment_snippet (CoglPipelineLayer *layer,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
|
@ -1662,12 +1678,9 @@ check_layer_has_fragment_snippet (CoglPipelineLayer *layer,
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_pipeline_has_fragment_snippets (CoglPipeline *pipeline)
|
_cogl_pipeline_has_fragment_snippets (CoglPipeline *pipeline)
|
||||||
{
|
{
|
||||||
CoglPipeline *authority =
|
|
||||||
_cogl_pipeline_get_authority (pipeline,
|
|
||||||
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS);
|
|
||||||
gboolean found_fragment_snippet = FALSE;
|
gboolean found_fragment_snippet = FALSE;
|
||||||
|
|
||||||
if (!COGL_LIST_EMPTY (&authority->big_state->fragment_snippets))
|
if (_cogl_pipeline_has_non_layer_fragment_snippets (pipeline))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
_cogl_pipeline_foreach_layer_internal (pipeline,
|
_cogl_pipeline_foreach_layer_internal (pipeline,
|
||||||
|
|
|
@ -761,6 +761,18 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changes & COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
|
||||||
|
{
|
||||||
|
if (!_cogl_pipeline_has_non_layer_fragment_snippets (pipeline))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changes & COGL_PIPELINE_STATE_VERTEX_SNIPPETS)
|
||||||
|
{
|
||||||
|
if (!_cogl_pipeline_has_non_layer_vertex_snippets (pipeline))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* XXX: we should only need to look at these if lighting is enabled
|
/* XXX: we should only need to look at these if lighting is enabled
|
||||||
*/
|
*/
|
||||||
if (changes & COGL_PIPELINE_STATE_LIGHTING)
|
if (changes & COGL_PIPELINE_STATE_LIGHTING)
|
||||||
|
|
Loading…
Reference in a new issue