aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/egl
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-07-26 16:56:13 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-07-26 16:56:13 +0200
commit6f7a2fa1e74975049bbb232fa0fc10ad1e67d219 (patch)
tree2ad6966e2cddf92c7dfde4bfeb32b7d8799f6391 /src/api/egl
parent15dfbd1ef622fbd3c3475e429422275ca1798d48 (diff)
downloadglutin-6f7a2fa1e74975049bbb232fa0fc10ad1e67d219.tar.gz
glutin-6f7a2fa1e74975049bbb232fa0fc10ad1e67d219.zip
Indicate the exact error when eglMakeCurrent or eglSwapBuffers fail
Diffstat (limited to 'src/api/egl')
-rw-r--r--src/api/egl/mod.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/api/egl/mod.rs b/src/api/egl/mod.rs
index 328a11e..8817f9d 100644
--- a/src/api/egl/mod.rs
+++ b/src/api/egl/mod.rs
@@ -129,10 +129,9 @@ impl GlContext for Context {
let ret = self.egl.MakeCurrent(self.display, self.surface, self.surface, self.context);
if ret == 0 {
- if self.egl.GetError() as u32 == ffi::egl::CONTEXT_LOST {
- return Err(ContextError::ContextLost);
- } else {
- panic!("eglMakeCurrent failed");
+ match self.egl.GetError() as u32 {
+ ffi::egl::CONTEXT_LOST => return Err(ContextError::ContextLost),
+ err => panic!("eglMakeCurrent failed (eglGetError returned 0x{:x})", err)
}
} else {
@@ -158,10 +157,9 @@ impl GlContext for Context {
};
if ret == 0 {
- if unsafe { self.egl.GetError() } as u32 == ffi::egl::CONTEXT_LOST {
- return Err(ContextError::ContextLost);
- } else {
- panic!("eglSwapBuffers failed");
+ match unsafe { self.egl.GetError() } as u32 {
+ ffi::egl::CONTEXT_LOST => return Err(ContextError::ContextLost),
+ err => panic!("eglSwapBuffers failed (eglGetError returned 0x{:x})", err)
}
} else {