diff options
author | Paul Rouget <me@paulrouget.com> | 2015-08-10 19:36:03 +0200 |
---|---|---|
committer | Paul Rouget <me@paulrouget.com> | 2015-08-11 04:41:59 +0200 |
commit | 26139f8c5c66e6fdf1508cd5e07018bbf9b62a76 (patch) | |
tree | 0217787fec91807f9bafcd537050246d8e0a471b /src | |
parent | e90f377b9fbab23a140029e71ef57933b266c473 (diff) | |
download | glutin-26139f8c5c66e6fdf1508cd5e07018bbf9b62a76.tar.gz glutin-26139f8c5c66e6fdf1508cd5e07018bbf9b62a76.zip |
Fix OpenGL profile selection
Diffstat (limited to 'src')
-rw-r--r-- | src/api/cocoa/mod.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index 5ea57ae..186ff8e 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -500,6 +500,10 @@ impl Window { fn create_context(view: id, builder: &BuilderAttribs) -> Result<(IdRef, PixelFormat), CreationError> { let profile = match (builder.gl_version, builder.gl_version.to_gl_version(), builder.gl_profile) { + + // Note: we are not using ranges because of a rust bug that should be fixed here: + // https://github.com/rust-lang/rust/pull/27050 + (GlRequest::Latest, _, Some(GlProfile::Compatibility)) => NSOpenGLProfileVersionLegacy as u32, (GlRequest::Latest, _, _) => { if NSAppKitVersionNumber.floor() >= NSAppKitVersionNumber10_9 { @@ -510,12 +514,16 @@ impl Window { NSOpenGLProfileVersionLegacy as u32 } }, - (_, Some((1 ... 2, _)), Some(GlProfile::Core)) | - (_, Some((3 ... 4, _)), Some(GlProfile::Compatibility)) => - return Err(CreationError::OpenGlVersionNotSupported), - (_, Some((1 ... 2, _)), _) => NSOpenGLProfileVersionLegacy as u32, - (_, Some((3, 0 ... 2)), _) => NSOpenGLProfileVersion3_2Core as u32, - (_, Some((3 ... 4, _)), _) => NSOpenGLProfileVersion4_1Core as u32, + + (_, Some((1, _)), _) => NSOpenGLProfileVersionLegacy as u32, + (_, Some((2, _)), _) => NSOpenGLProfileVersionLegacy as u32, + (_, Some((3, 0)), _) => NSOpenGLProfileVersionLegacy as u32, + (_, Some((3, 1)), _) => NSOpenGLProfileVersionLegacy as u32, + (_, Some((3, 2)), _) => NSOpenGLProfileVersion3_2Core as u32, + (_, Some((3, _)), Some(GlProfile::Compatibility)) => return Err(CreationError::OpenGlVersionNotSupported), + (_, Some((3, _)), _) => NSOpenGLProfileVersion4_1Core as u32, + (_, Some((4, _)), Some(GlProfile::Compatibility)) => return Err(CreationError::OpenGlVersionNotSupported), + (_, Some((4, _)), _) => NSOpenGLProfileVersion4_1Core as u32, _ => return Err(CreationError::OpenGlVersionNotSupported), }; |