Reorder egl library loading

This commit is contained in:
Drakulix 2017-06-04 23:22:51 +02:00
parent 83b98ba77b
commit 7a0639fae6
1 changed files with 10 additions and 11 deletions

View File

@ -135,17 +135,6 @@ impl EGLContext {
let log = ::slog_or_stdlog(logger.clone()).new(o!("smithay_module" => "renderer_egl")); let log = ::slog_or_stdlog(logger.clone()).new(o!("smithay_module" => "renderer_egl"));
trace!(log, "Loading libEGL"); 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, // If no version is given, try OpenGLES 3.0, if available,
// fallback to 2.0 otherwise // fallback to 2.0 otherwise
let version = match attributes.version { 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 // the first step is to query the list of extensions without any display, if supported
let dp_extensions = { let dp_extensions = {
let p = egl.QueryString(ffi::egl::NO_DISPLAY, ffi::egl::EXTENSIONS as i32); let p = egl.QueryString(ffi::egl::NO_DISPLAY, ffi::egl::EXTENSIONS as i32);