generalize driver description and selection

This adds a table of driver descriptions to cogl-renderer.c in order of
preference and when choosing what driver to use we now iterate the table
instead of repeating boilerplate checks. For handling the "default driver"
that can be specified when building cogl and handling driver overrides
there is a foreach_driver_description() that will make sure to iterate
the default driver first or if an override has been set then nothing but
the override will be considered.

This patch introduces some driver flags that let us broadly categorize
what kind of GL driver we are currently running on. Since there are
numerous OpenGL apis with different broad feature sets and new apis
may be introduced in the future by Khronos then we should tend to
avoid using the driver id to do runtime feature checking. These flags
provide a more stable quantity for broad feature checks.

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

(cherry picked from commit e07d0fc7441dddc3f0a2bc33a6a37d62ddc3efc0)
Adds "webgl" driver

This adds a COGL_DRIVER_WEBGL enum and a new driver description for
webgl in cogl-renderer.c. This also adds a COGL_DRIVER_FLAG_OPENGL_WEB
driver flag and a HAVE_COGL_WEBGL define which we can start to use to
handle special cases where webgl differs from gles2.

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

(cherry picked from commit 2c167b7a4ee56241827322bbe7cb287b0628437c)
webgl: use DEPTH_STENCIL_ATTACHMENT

WebGL doesn't allow you to separately attach buffers to the
STENCIL_ATTACHMENT and DEPTH_ATTACHMENT framebuffer attachment points
and instead requires you to use the DEPTH_STENCIL_ATTACHMENT whenever
you want a depth and stencil buffer.

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

(cherry picked from commit ec7b6360c9c4e45e0b113f9dca7bb1502e7e93be)
renderer: assert CoglPrivateFeatureFlags fit in 32 bits

This updates the static assertion in cogl-renderer.c to only check that
the flags will fit in 32 bits instead of asserting the type has the same
size as an unsigned long.

(cherry picked from commit c6893fa3c9eda0f13b79d3a1fc03f8b79c42a8f6)
display: add _set_onscreen_template() api

Currently it's only possible to set an onscreen template on a
CoglDisplay by passing a template to cogl_display_new(). For
applications that want to deal with fallbacks then they may want to
replace the onscreen template so this adds a
cogl_display_set_onscreen_template() function.

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

(cherry picked from commit f307c9545791dae5472a9568fef6b31b3bf52854)
renderer: Only check certain constraints when selecting a driver

Only COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 affects the driver
selection and all of the the other constraints are only relevant to
the winsys selection. However Cogl was trying to apply all of the
constraints to the driver selection which meant that if any other
constraint was specified then it would always fail. This patch makes
the driver selection filter out all other constraints based on a mask
defined in cogl-renderer-private.h.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit f07febc8913b97fb828e7f2cc2857813af2d3657)
renderer: Don't allow the COGL_DRIVER env var to override application

Since e07d0fc7441 the COGL_DRIVER environment variable was able to
override the application's driver selection. This doesn't seem like a
good idea because if the application is specifying a driver explicitly
then presumably it can not work with any other driver. This patch
changes it so that if a driver is selected in the configuration and by
the application then they must match, otherwise it will fail with a
CoglError.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 4e0942d74c8d69aa48e0176bfecf27f64a950d0f)