File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,14 @@ use libloading as lib;
9
9
10
10
lazy_static ! {
11
11
static ref GL_LIB : Option <lib:: Library > = {
12
- if cfg!( target_os = "android" ) {
13
- lib:: Library :: new( "libGLESv2.so" ) . ok( )
14
- } else {
15
- lib:: Library :: new( "libGL.so" ) . ok( )
16
- }
12
+ let names = [ "libGLESv2.so" , "libGL.so" , "libGLESv3.so" ] ;
13
+ for name in & names {
14
+ if let Ok ( lib) = Library :: new( name)
15
+ return Some ( lib)
16
+ }
17
+ }
18
+
19
+ None
17
20
} ;
18
21
}
19
22
pub struct NativeGLContextHandle ( pub EGLDisplay , pub EGLSurface ) ;
@@ -88,8 +91,10 @@ impl NativeGLContextMethods for NativeGLContext {
88
91
fn get_proc_address ( addr : & str ) -> * const ( ) {
89
92
unsafe {
90
93
if let Some ( ref lib) = * GL_LIB {
91
- let symbol: lib:: Symbol < unsafe extern fn ( ) > = lib. get ( addr. as_bytes ( ) ) . unwrap ( ) ;
92
- return * symbol. deref ( ) as * const ( ) ;
94
+ let symbol: Result < lib:: Symbol < unsafe extern fn ( ) > , _ > = lib. get ( addr. as_bytes ( ) ) ;
95
+ if let Ok ( symbol) = symbol {
96
+ return * symbol. deref ( ) as * const ( ) ;
97
+ }
93
98
}
94
99
95
100
let addr = CString :: new ( addr. as_bytes ( ) ) ;
You can’t perform that action at this time.
0 commit comments