[Cogl] [PATCH 1/2] renderer: Only check certain constraints when selecting a driver

Neil Roberts neil at linux.intel.com
Thu Jun 27 02:05:17 PDT 2013


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.
---
 cogl/cogl-renderer-private.h | 5 +++++
 cogl/cogl-renderer.c         | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/cogl/cogl-renderer-private.h b/cogl/cogl-renderer-private.h
index 1816588..b5ebd7b 100644
--- a/cogl/cogl-renderer-private.h
+++ b/cogl/cogl-renderer-private.h
@@ -91,6 +91,11 @@ struct _CoglRenderer
   void *winsys;
 };
 
+/* Mask of constraints that effect driver selection. All of the other
+ * constraints effect only the winsys selection */
+#define COGL_RENDERER_DRIVER_CONSTRAINTS \
+  COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2
+
 typedef CoglFilterReturn (* CoglNativeFilterFunc) (void *native_event,
                                                    void *data);
 
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index c5a2940..ecbf8bd 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -465,6 +465,11 @@ satisfy_constraints (CoglDriverDescription *description,
     {
       CoglRendererConstraint constraint = GPOINTER_TO_UINT (l->data);
 
+      /* Most of the constraints only affect the winsys selection so
+       * we'll filter them out */
+      if (!(constraint & COGL_RENDERER_DRIVER_CONSTRAINTS))
+        continue;
+
       /* If the driver doesn't satisfy any constraint then continue
        * to the next driver description */
       if (!(constraint & description->constraints))
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list