diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-07-20 19:38:57 +0200 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-07-20 19:38:57 +0200 |
commit | 43dabf131aa9f76610e1cfd0685e3b36de8c2ebd (patch) | |
tree | 602da832e457e13f384a87bef1705df0eea60434 /src/api | |
parent | ba5adfa1e13e8be0dec888b3fbcb54fd30a9a673 (diff) | |
download | glutin-43dabf131aa9f76610e1cfd0685e3b36de8c2ebd.tar.gz glutin-43dabf131aa9f76610e1cfd0685e3b36de8c2ebd.zip |
Add CreationError::OpenGlVersionNotSupported
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/cocoa/mod.rs | 4 | ||||
-rw-r--r-- | src/api/egl/mod.rs | 18 | ||||
-rw-r--r-- | src/api/glx/mod.rs | 1 | ||||
-rw-r--r-- | src/api/osmesa/mod.rs | 2 | ||||
-rw-r--r-- | src/api/wgl/mod.rs | 4 |
5 files changed, 16 insertions, 13 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index 680c621..6fc91b4 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -512,11 +512,11 @@ impl Window { }, (_, Some((1 ... 2, _)), Some(GlProfile::Core)) | (_, Some((3 ... 4, _)), Some(GlProfile::Compatibility)) => - return Err(CreationError::NotSupported), + 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, - _ => return Err(CreationError::NotSupported), + _ => return Err(CreationError::OpenGlVersionNotSupported), }; // NOTE: OS X no longer has the concept of setting individual diff --git a/src/api/egl/mod.rs b/src/api/egl/mod.rs index 3d6d681..328a11e 100644 --- a/src/api/egl/mod.rs +++ b/src/api/egl/mod.rs @@ -68,7 +68,7 @@ impl Context { } else if egl.BindAPI(ffi::egl::OPENGL_ES_API) != 0 { (None, Api::OpenGlEs) } else { - return Err(CreationError::NotSupported); + return Err(CreationError::OpenGlVersionNotSupported); } } else { (None, Api::OpenGlEs) @@ -77,21 +77,21 @@ impl Context { GlRequest::Specific(Api::OpenGlEs, version) => { if egl_version >= (1, 2) { if egl.BindAPI(ffi::egl::OPENGL_ES_API) == 0 { - return Err(CreationError::NotSupported); + return Err(CreationError::OpenGlVersionNotSupported); } } (Some(version), Api::OpenGlEs) }, GlRequest::Specific(Api::OpenGl, version) => { if egl_version < (1, 4) { - return Err(CreationError::NotSupported); + return Err(CreationError::OpenGlVersionNotSupported); } if egl.BindAPI(ffi::egl::OPENGL_API) == 0 { - return Err(CreationError::NotSupported); + return Err(CreationError::OpenGlVersionNotSupported); } (Some(version), Api::OpenGl) }, - GlRequest::Specific(_, _) => return Err(CreationError::NotSupported), + GlRequest::Specific(_, _) => return Err(CreationError::OpenGlVersionNotSupported), GlRequest::GlThenGles { opengles_version, opengl_version } => { if egl_version >= (1, 4) { if egl.BindAPI(ffi::egl::OPENGL_API) != 0 { @@ -99,7 +99,7 @@ impl Context { } else if egl.BindAPI(ffi::egl::OPENGL_ES_API) != 0 { (Some(opengles_version), Api::OpenGlEs) } else { - return Err(CreationError::NotSupported); + return Err(CreationError::OpenGlVersionNotSupported); } } else { (Some(opengles_version), Api::OpenGlEs) @@ -245,7 +245,7 @@ impl<'a> ContextPrototype<'a> { { ctxt } else { - return Err(CreationError::NotSupported); + return Err(CreationError::OpenGlVersionNotSupported); } } else { @@ -267,7 +267,7 @@ impl<'a> ContextPrototype<'a> { { ctxt } else { - return Err(CreationError::NotSupported); + return Err(CreationError::OpenGlVersionNotSupported); } } }; @@ -504,7 +504,7 @@ unsafe fn create_context(egl: &ffi::egl::Egl, display: ffi::egl::types::EGLDispl if context.is_null() { match egl.GetError() as u32 { - ffi::egl::BAD_ATTRIBUTE => return Err(CreationError::NotSupported), + ffi::egl::BAD_ATTRIBUTE => return Err(CreationError::OpenGlVersionNotSupported), e => panic!("eglCreateContext failed: 0x{:x}", e), } } diff --git a/src/api/glx/mod.rs b/src/api/glx/mod.rs index 753bd74..65819f8 100644 --- a/src/api/glx/mod.rs +++ b/src/api/glx/mod.rs @@ -328,6 +328,7 @@ fn create_context(glx: &ffi::glx::Glx, extra_functions: &ffi::glx_extra::Glx, ex }; if context.is_null() { + // TODO: check for errors and return `OpenGlVersionNotSupported` return Err(CreationError::OsError(format!("GL context creation failed"))); } diff --git a/src/api/osmesa/mod.rs b/src/api/osmesa/mod.rs index 15225b3..056e2d1 100644 --- a/src/api/osmesa/mod.rs +++ b/src/api/osmesa/mod.rs @@ -46,6 +46,8 @@ impl OsMesaContext { _ => () } + // TODO: check OpenGL version and return `OpenGlVersionNotSupported` if necessary + Ok(OsMesaContext { width: dimensions.0, height: dimensions.1, diff --git a/src/api/wgl/mod.rs b/src/api/wgl/mod.rs index a90baff..54a9a9a 100644 --- a/src/api/wgl/mod.rs +++ b/src/api/wgl/mod.rs @@ -235,7 +235,7 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &BuilderAttribs<'st attributes.push(gl::wgl_extra::CONTEXT_PROFILE_MASK_ARB as libc::c_int); attributes.push(gl::wgl_extra::CONTEXT_ES2_PROFILE_BIT_EXT as libc::c_int); } else { - return Err(CreationError::NotSupported); + return Err(CreationError::OpenGlVersionNotSupported); } attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as libc::c_int); @@ -243,7 +243,7 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &BuilderAttribs<'st attributes.push(gl::wgl_extra::CONTEXT_MINOR_VERSION_ARB as libc::c_int); attributes.push(minor as libc::c_int); }, - GlRequest::Specific(_, _) => return Err(CreationError::NotSupported), + GlRequest::Specific(_, _) => return Err(CreationError::OpenGlVersionNotSupported), GlRequest::GlThenGles { opengl_version: (major, minor), .. } => { attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as libc::c_int); attributes.push(major as libc::c_int); |