pipeline simple optimization for _needs_blending_enabled

In _cogl_pipeline_needs_blending_enabled after first checking whether
the property most recently changed requires blending we would then
resort to checking all other properties too in case some other state
also requires blending. We now avoid checking all other properties in
the case that blending was previously disabled and checking the property
recently changed doesn't require blending.

Note: the plan is to improve this further by explicitly keeping track
of the properties that currently cause blending to be enabled so that we
never have to resort to checking all other properties we can constrain
the checks to those masked properties.
This commit is contained in:
Robert Bragg 2010-12-03 16:59:52 +00:00
parent 6b08583f2f
commit 98dd3f723c

View File

@ -907,11 +907,20 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
if (has_alpha)
return TRUE;
}
else
/* At this point, considering just the state that has changed it
* looks like blending isn't needed. If blending was previously
* enabled though it could be that some other state still requires
* that we have blending enabled. In this case we still need to
* go and check the other state...
*
* FIXME: We should explicitly keep track of the mask of state
* groups that are currently causing blending to be enabled so that
* we never have to resort to checking *all* the state and can
* instead always limit the check to those in the mask.
*/
if (pipeline->real_blend_enable)
{
/* In this case we have so far only checked the property that
* has been changed so we now need to check all the other
* properties too. */
other_state = COGL_PIPELINE_STATE_AFFECTS_BLENDING & ~changes;
if (other_state &&
_cogl_pipeline_needs_blending_enabled (pipeline,