[cogl] renderer: Don't allow the COGL_DRIVER env var to override application
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] renderer: Don't allow the COGL_DRIVER env var to override application
- Date: Thu, 27 Jun 2013 13:27:14 +0000 (UTC)
commit 4e0942d74c8d69aa48e0176bfecf27f64a950d0f
Author: Neil Roberts <neil linux intel com>
Date: Thu Jun 27 09:57:02 2013 +0100
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>
cogl/cogl-renderer.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index ecbf8bd..33e086c 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -501,8 +501,22 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
if (driver_override == COGL_DRIVER_ANY)
invalid_override = driver_name;
}
- else
- driver_override = renderer->driver_override;
+
+ 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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]