aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/api/cocoa/mod.rs4
-rw-r--r--src/api/egl/mod.rs18
-rw-r--r--src/api/glx/mod.rs1
-rw-r--r--src/api/osmesa/mod.rs2
-rw-r--r--src/api/wgl/mod.rs4
-rw-r--r--src/lib.rs3
6 files changed, 19 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);
diff --git a/src/lib.rs b/src/lib.rs
index d5f563a..b543702 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -110,6 +110,7 @@ pub enum CreationError {
OsError(String),
NotSupported,
RobustnessNotSupported,
+ OpenGlVersionNotSupported,
}
impl CreationError {
@@ -119,6 +120,8 @@ impl CreationError {
CreationError::NotSupported => "Some of the requested attributes are not supported",
CreationError::RobustnessNotSupported => "Your requested robustness, but it is \
not supported.",
+ CreationError::OpenGlVersionNotSupported => "The requested OpenGL version is not \
+ supported.",
}
}
}