Index: src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp |
diff --git a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp |
index 51e461a0d808f4f88072b987fe6dea1f446e0531..9a4dffb4b199f081c559988f95ba07fbf5047a28 100644 |
--- a/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp |
+++ b/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp |
@@ -10,12 +10,21 @@ |
#include "gl/GrGLInterface.h" |
#include "gl/GrGLAssembleInterface.h" |
+#if defined _WIN32 |
#define WIN32_LEAN_AND_MEAN |
#include <windows.h> |
+#else |
+#include <dlfcn.h> |
+#endif // defined _WIN32 |
+ |
#include <EGL/egl.h> |
static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { |
+#if defined _WIN32 |
GrGLFuncPtr proc = (GrGLFuncPtr) GetProcAddress((HMODULE)ctx, name); |
+#else |
+ GrGLFuncPtr proc = (GrGLFuncPtr) dlsym(ctx, name); |
+#endif // defined _WIN32 |
if (proc) { |
return proc; |
} |
@@ -23,17 +32,21 @@ static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { |
} |
const GrGLInterface* GrGLCreateANGLEInterface() { |
+ static void* gANGLELib = nullptr; |
- static HMODULE ghANGLELib = nullptr; |
- |
- if (nullptr == ghANGLELib) { |
+ if (nullptr == gANGLELib) { |
// We load the ANGLE library and never let it go |
- ghANGLELib = LoadLibrary("libGLESv2.dll"); |
+#if defined _WIN32 |
+ gANGLELib = LoadLibrary("libGLESv2.dll"); |
+#else |
+ gANGLELib = dlopen("libGLESv2.so", RTLD_LAZY); |
+#endif // defined _WIN32 |
} |
- if (nullptr == ghANGLELib) { |
- // We can't setup the interface correctly w/o the DLL |
+ |
+ if (nullptr == gANGLELib) { |
+ // We can't setup the interface correctly w/o the so |
return nullptr; |
} |
- return GrGLAssembleGLESInterface(ghANGLELib, angle_get_gl_proc); |
+ return GrGLAssembleGLESInterface(gANGLELib, angle_get_gl_proc); |
} |