diff options
author | Jesse Hall <jessehall@google.com> | 2013-07-04 12:08:16 -0700 |
---|---|---|
committer | Jesse Hall <jessehall@google.com> | 2013-07-04 12:08:16 -0700 |
commit | c07b52060acd627c8510c1a9151e0753fce76330 (patch) | |
tree | 80dc6155de27c6d7d7e29aadf193acff91affdcd /opengl/libs/EGL/Loader.cpp | |
parent | ef07386e2fca73680214ececc3c9c0ecbb0f6d88 (diff) | |
download | frameworks_native-c07b52060acd627c8510c1a9151e0753fce76330.zip frameworks_native-c07b52060acd627c8510c1a9151e0753fce76330.tar.gz frameworks_native-c07b52060acd627c8510c1a9151e0753fce76330.tar.bz2 |
Find non-extension GLES wrappers in eglGetProcAddress
This allows apps to find OpenGL ES 3.0 functions using
eglGetProcAddress() instead of dlopen/dlsym.
Bug: 9681677
Change-Id: I7ce6e1636bc47d6b0bf20a4e46bd67235714d129
Diffstat (limited to 'opengl/libs/EGL/Loader.cpp')
-rw-r--r-- | opengl/libs/EGL/Loader.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index 00bfa5a..56550b3 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -175,6 +175,12 @@ Loader::~Loader() GLTrace_stop(); } +static void* load_wrapper(const char* path) { + void* so = dlopen(path, RTLD_NOW | RTLD_LOCAL); + ALOGE_IF(!so, "dlopen(\"%s\") failed: %s", path, dlerror()); + return so; +} + void* Loader::open(egl_connection_t* cnx) { void* dso; @@ -200,7 +206,12 @@ void* Loader::open(egl_connection_t* cnx) LOG_FATAL_IF(!index && !hnd, "couldn't find the default OpenGL ES implementation " "for default display"); - + + cnx->libGles2 = load_wrapper("system/lib/libGLESv2.so"); + cnx->libGles1 = load_wrapper("system/lib/libGLESv1_CM.so"); + LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1, + "couldn't load system OpenGL ES wrapper libraries"); + return (void*)hnd; } |