From 7a0639fae6b91c81ef1f394303d25d2988abdf0c Mon Sep 17 00:00:00 2001 From: Drakulix Date: Sun, 4 Jun 2017 23:22:51 +0200 Subject: [PATCH] Reorder egl library loading --- src/backend/graphics/egl.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/backend/graphics/egl.rs b/src/backend/graphics/egl.rs index 3d0cf72..631c55a 100644 --- a/src/backend/graphics/egl.rs +++ b/src/backend/graphics/egl.rs @@ -135,17 +135,6 @@ impl EGLContext { let log = ::slog_or_stdlog(logger.clone()).new(o!("smithay_module" => "renderer_egl")); trace!(log, "Loading libEGL"); - let lib = Library::new("libEGL.so.1")?; - let egl = ffi::egl::Egl::load_with(|sym| { - let name = CString::new(sym).unwrap(); - let symbol = lib.get::<*mut c_void>(name.as_bytes()); - match symbol { - Ok(x) => *x as *const _, - Err(_) => ptr::null(), - } - }); - - // If no version is given, try OpenGLES 3.0, if available, // fallback to 2.0 otherwise let version = match attributes.version { @@ -177,6 +166,16 @@ impl EGLContext { } }; + let lib = Library::new("libEGL.so.1")?; + let egl = ffi::egl::Egl::load_with(|sym| { + let name = CString::new(sym).unwrap(); + let symbol = lib.get::<*mut c_void>(name.as_bytes()); + match symbol { + Ok(x) => *x as *const _, + Err(_) => ptr::null(), + } + }); + // the first step is to query the list of extensions without any display, if supported let dp_extensions = { let p = egl.QueryString(ffi::egl::NO_DISPLAY, ffi::egl::EXTENSIONS as i32);