[cogl] renderer: Only check certain constraints when selecting a driver



commit f07febc8913b97fb828e7f2cc2857813af2d3657
Author: Neil Roberts <neil linux intel com>
Date:   Thu Jun 27 09:30:04 2013 +0100

    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>

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]