summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-05-20 10:53:00 -0700
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-05-20 10:55:12 -0700
commit25e641213fdbf43ee3b57f2b9f5a92aad7397a69 (patch)
tree4e7579b84dd2a70125ed4ee3939105831ff036b5
parentac49f97f12324733220428128bce3f460fbffbbd (diff)
darwin: Fix test for kCGLPFAOpenGLProfile support at runtime
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> (cherry picked from commit 7a109268ab5b3544e7f7b99e84ef1fdf54023fb4)
-rw-r--r--src/glx/apple/apple_visual.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
index 282934f1749..238c24881c9 100644
--- a/src/glx/apple/apple_visual.c
+++ b/src/glx/apple/apple_visual.c
@@ -73,11 +73,15 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
GLint vsref = 0;
CGLError error = 0;
- /* Request an OpenGL 3.2 profile if one is available */
- if(apple_cgl.version_major > 1 || (apple_cgl.version_major == 1 && apple_cgl.version_minor >= 3)) {
- attr[numattr++] = kCGLPFAOpenGLProfile;
- attr[numattr++] = kCGLOGLPVersion_3_2_Core;
- }
+ /* Request an OpenGL 3.2 profile if one is available and supported */
+ attr[numattr++] = kCGLPFAOpenGLProfile;
+ attr[numattr++] = kCGLOGLPVersion_3_2_Core;
+
+ /* Test for kCGLPFAOpenGLProfile support at runtime and roll it out if not supported */
+ attr[numattr] = 0;
+ error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
+ if (error == kCGLBadAttribute)
+ numattr -= 2;
if (offscreen) {
apple_glx_diagnostic