pipeline: lazily get ctx in _get_layer
pipeline: lazily get ctx in _get_layer

We only need a ctx pointer if we need to refer to the default_layer_x
layers to copy as templates so only call  _cogl_context_get_default()
once we need to copy a template. _cogl_context_get_default() was
starting to show up in profiles and this was the main cause.

Reviewed-by: Neil Roberts <822ec91a7ef82248fd36162ca8ac3283eba70848@linux.intel.com>

collects/cogl,djdeath/cogl-android,gcampax/cogl,gcampax/cogl,djdeath/cogl-android,djdeath/cogl,Distrotech/cogl,gcampax/cogl,Distrotech/cogl,gcampax/cogl,collects/cogl,djdeath/cogl-android,Distrotech/cogl,Distrotech/cogl,djdeath/cogl,djdeath/cogl