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)
This commit is contained in:
Neil Roberts 2013-06-27 09:57:02 +01:00 committed by Robert Bragg
parent e7b50a6cba
commit 7bab449700

View File

@ -505,8 +505,22 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
if (driver_override == COGL_DRIVER_ANY)
invalid_override = driver_name;
}
else
if (renderer->driver_override != COGL_DRIVER_ANY)
{
if (driver_override != COGL_DRIVER_ANY &&
renderer->driver_override != driver_override)
{
_cogl_set_error (error,
COGL_RENDERER_ERROR,
COGL_RENDERER_ERROR_BAD_CONSTRAINT,
"Application driver selection conflicts with driver "
"specified in configuration");
return FALSE;
}
driver_override = renderer->driver_override;
}
if (driver_override != COGL_DRIVER_ANY)
{