cogl-pipeline-glsl: Fix reusing shaders for shared ancestors
cogl-pipeline-glsl: Fix reusing shaders for shared ancestors

The check for whether we can reuse a program we've already generated
was only being done if the pipeline already had a
glsl_program_state. When there is no glsl_program_state it then looks
for the nearest ancestor it can share the program with. It then
wasn't checking whether that ancestor already had a GL program so it
would start generating the source again. It wouldn't however compile
that source again because _cogl_pipeline_backend_glsl_end does check
whether there is already a program. This patch moves the check until
after it has found the glsl_program_state, whether or not it was found
from an ancestor or as its own state.

dlespiau/clutter,djdeath/clutter-android,jigpu/clutter,spatulasnout/clutter,nobled/clutter,ebassi/clutter,Distrotech/clutter,heysion/clutter-clone,kerrickstaley/clutter-vala,dlespiau/clutter,spatulasnout/clutter,Distrotech/clutter,jigpu/clutter,collects/clutter,GNOME/clutter,djdeath/clutter-multithreaded,spatulasnout/clutter,djdeath/clutter-android,collects/clutter,Distrotech/clutter,djdeath/clutter-android,djdeath/clutter-android,kerrickstaley/clutter-vala,jigpu/clutter,nobled/clutter,djdeath/clutter,djdeath/clutter-android,spatulasnout/clutter,GNOME/clutter,djdeath/clutter,ebassi/clutter,jigpu/clutter,Distrotech/clutter,ebassi/clutter,GNOME/clutter,ebassi/clutter,jigpu/clutter,djdeath/clutter-multithreaded,djdeath/clutter-multithreaded,collects/clutter,Distrotech/clutter,Distrotech/clutter,djdeath/clutter,kerrickstaley/clutter-vala,djdeath/clutter,heysion/clutter-clone,GNOME/clutter,kerrickstaley/clutter-vala,djdeath/clutter-multithreaded,heysion/clutter-clone,heysion/clutter-clone,jigpu/clutter,GNOME/clutter,nobled/clutter,collects/clutter,heysion/clutter-clone,spatulasnout/clutter,djdeath/clutter,collects/clutter,ebassi/clutter,dlespiau/clutter,djdeath/clutter