[waffle] [PATCH 1/3] cgl: Emit error on OS X pre-10.6 on attempt to create 3.2 context

Chad Versace chad.versace at linux.intel.com
Fri Jul 19 21:43:34 PDT 2013


It's impossible to create a 3.2 context on OS X pre-10.6.
When the user attempts to create a waffle_config with GL version 3.2,
emit an error message explaining that.

Commit df541da fixed the build for pre-10.6, but also introduced an
error. It silently accepted requests for GL version 3.2 which resulted
in creation of a 2.1 (!) context.

CC: Nigel Stewart <nigels.com at gmail.com>
CC: Jeff Bland <jksb at linux.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/waffle/cgl/cgl_config.m | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/waffle/cgl/cgl_config.m b/src/waffle/cgl/cgl_config.m
index e2f6d9a..e1c5027 100644
--- a/src/waffle/cgl/cgl_config.m
+++ b/src/waffle/cgl/cgl_config.m
@@ -62,18 +62,25 @@ cgl_config_check_attrs(const struct wcore_config_attrs *attrs)
                 case 10:
                     return true;
                 case 32:
-                    switch (attrs->context_profile) {
-                        case WAFFLE_CONTEXT_CORE_PROFILE:
-                            return true;
-                        case WAFFLE_CONTEXT_COMPATIBILITY_PROFILE:
-                            wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
-                                         "CGL does not support the OpenGL 3.2 "
-                                         "Compatibility Profile");
-                            return false;
-                        default:
-                            assert(false);
-                            return false;
-                    }
+                    #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
+                        switch (attrs->context_profile) {
+                            case WAFFLE_CONTEXT_CORE_PROFILE:
+                                return true;
+                            case WAFFLE_CONTEXT_COMPATIBILITY_PROFILE:
+                                wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
+                                             "CGL does not support the OpenGL "
+                                             "3.2 Compatibility Profile");
+                                return false;
+                            default:
+                                assert(false);
+                                return false;
+                        }
+                    #else
+                        wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
+                                     "To create an OpenGL 3.2 context, Mac OS "
+                                     ">= 10.6 is required");
+                        return false;
+                    #endif
                 default:
                     wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                                  "On CGL, the requested OpenGL version must "
-- 
1.8.3.3



More information about the waffle mailing list