[Cogl] [PATCH] pipeline: remove dubious optimization

Neil Roberts neil at linux.intel.com
Wed Sep 26 04:30:58 PDT 2012


The patch looks good to land to me, but I wonder if we are doing the
right thing altogether. As far as I can tell, a pipeline can only change
vertends and fragends in decreasing order of priority. For example, if a
pipeline is initially used without any snippets but then later a snippet
is added it will successfully switch to using the GLSL fragend, but it
looks like it would never switch back to the fixed fragend if the
snippet was later removed. This probably works out as a good thing,
because a second problem seems to be that if a pipeline is modified then
only the current fragend gets notified via the
pipeline_pre_change_notify method. If a higher priority fragend was also
caching state (such as when switching from GLSL→ARBfp) then it would end
up using the wrong state when switching back to it.

Maybe it should reset the fragend and vertend back to
COGL_PIPELINE_*END_UNDEFINED whenever the pipeline is modified so that
it will rescan for the right fragend. It could also call the
pre_change_notify method on all of the fragends and vertends to avoid
caching invalid state.

It doesn't seem like rescanning for the right fragend after every change
should be particularly expensive because the only things that can really
prevent it from using a particular backend are the snippets, and the
fixed and arbfp start functions check for that immediately.

In any case I think the backend selection could do with some review. We
haven't tested the relative performance for quite a while. It could be
the case that now using the fixed backends would be slower than using
the programmable backends. If that is the case then it could be worth
putting GLSL as the top priority and then dropping the ARBfp fragend. In
that case the backend selection is no longer affected by what is on the
pipeline but instead it is purely based on what features are available.
That means Cogl could just decide which backends to use right up front
when the context is created and use the same set for all pipelines.

Reviewed-by: Neil Roberts <neil at linux.intel.com>

- Neil


More information about the Cogl mailing list