aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2014-07-08 21:45:47 +0200
committerDavid 'Digit' Turner <digit@google.com>2014-07-09 18:12:08 +0200
commit242a075e3256fc7f369f0e5f93fd2ae91c255774 (patch)
tree93d82dee2d537a506bd5b204df65495fbc21d663 /emulator/opengl/host
parentd1dd8ee1e85f60569ddf6ebc7fe1cbde7ebb6f38 (diff)
downloadsdk-242a075e3256fc7f369f0e5f93fd2ae91c255774.zip
sdk-242a075e3256fc7f369f0e5f93fd2ae91c255774.tar.gz
sdk-242a075e3256fc7f369f0e5f93fd2ae91c255774.tar.bz2
emulator/opengl: refactor shared library handling.
+ Add a unit test. Change-Id: I27c993d1dc819e5bd89fc1e9ae266e11e6ef9a76
Diffstat (limited to 'emulator/opengl/host')
-rw-r--r--emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp2
-rw-r--r--emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h4
-rw-r--r--emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp2
-rw-r--r--emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h5
-rw-r--r--emulator/opengl/host/libs/Translator/EGL/EglImp.cpp4
-rw-r--r--emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp8
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp5
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp7
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp7
9 files changed, 23 insertions, 21 deletions
diff --git a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
index 3c5bd70..7aa6ede 100644
--- a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
+++ b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
@@ -47,7 +47,7 @@ int GLDecoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
libname = getenv(GLES_LIBNAME_VAR);
}
- m_glesDso = osUtils::dynLibrary::open(libname);
+ m_glesDso = emugl::SharedLibrary::open(libname);
if (m_glesDso == NULL) {
fprintf(stderr, "Couldn't find %s \n", GLES_LIBNAME);
return -1;
diff --git a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h
index 14ca222..0d26090 100644
--- a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h
+++ b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h
@@ -19,7 +19,7 @@
#include "gl_dec.h"
#include "FixedBuffer.h"
#include "GLDecoderContextData.h"
-#include <osDynLibrary.h>
+#include "emugl/common/shared_library.h"
#define GLES_LIBNAME_VAR "ANDROID_GLESv1_LIB"
#define GLES_LIBNAME "libGLES_CM.so"
@@ -65,7 +65,7 @@ private:
static void * s_getProc(const char *name, void *userData);
GLDecoderContextData *m_contextData;
- osUtils::dynLibrary* m_glesDso;
+ emugl::SharedLibrary* m_glesDso;
};
#endif
diff --git a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp
index ccf2f06..2ef306e 100644
--- a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp
+++ b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp
@@ -60,7 +60,7 @@ int GL2Decoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
libname = getenv(GLES2_LIBNAME_VAR);
}
- m_GL2library = osUtils::dynLibrary::open(libname);
+ m_GL2library = emugl::SharedLibrary::open(libname);
if (m_GL2library == NULL) {
fprintf(stderr, "%s: Couldn't find %s \n", __FUNCTION__, libname);
return -1;
diff --git a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h
index dcf2c07..8910da9 100644
--- a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h
+++ b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h
@@ -21,9 +21,8 @@
#define GLES2_LIBNAME "libGLESv2.so"
#include "gl2_dec.h"
-#include "osDynLibrary.h"
#include "GLDecoderContextData.h"
-
+#include "emugl/common/shared_library.h"
class GL2Decoder : public gl2_decoder_context_t
{
@@ -35,7 +34,7 @@ public:
void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
private:
GLDecoderContextData *m_contextData;
- osUtils::dynLibrary * m_GL2library;
+ emugl::SharedLibrary* m_GL2library;
static void *s_getProc(const char *name, void *userData);
static void gl2_APIENTRY s_glGetCompressedTextureFormats(void *self, int count, GLint *formats);
diff --git a/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp b/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
index 06dcf67..30d358f 100644
--- a/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
+++ b/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
@@ -24,7 +24,7 @@
#include <stdio.h>
#include "ThreadInfo.h"
#include <GLcommon/TranslatorIfaces.h>
-#include <OpenglOsUtils/osDynLibrary.h>
+#include "emugl/common/shared_library.h"
#include "EglWindowSurface.h"
#include "EglPbufferSurface.h"
@@ -175,7 +175,7 @@ EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) {
#define TRANSLATOR_GETIFACE_NAME "__translator_getIfaces"
static __translator_getGLESIfaceFunc loadIfaces(const char* libName){
- osUtils::dynLibrary* libGLES = osUtils::dynLibrary::open(libName);
+ emugl::SharedLibrary* libGLES = emugl::SharedLibrary::open(libName);
if(!libGLES) return NULL;
__translator_getGLESIfaceFunc func = (__translator_getGLESIfaceFunc)libGLES->findSymbol(TRANSLATOR_GETIFACE_NAME);
diff --git a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp
index 7b217fd..5da7247 100644
--- a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp
+++ b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp
@@ -16,7 +16,7 @@
#include <GLcommon/GLDispatch.h>
#include <stdio.h>
-#include <OpenglOsUtils/osDynLibrary.h>
+#include "emugl/common/shared_library.h"
#ifdef __linux__
#include <GL/glx.h>
@@ -31,13 +31,13 @@ typedef void (*GL_FUNC_PTR)();
static GL_FUNC_PTR getGLFuncAddress(const char *funcName) {
GL_FUNC_PTR ret = NULL;
#ifdef __linux__
- static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("libGL.so");
+ static emugl::SharedLibrary* libGL = emugl::SharedLibrary::open("libGL");
ret = (GL_FUNC_PTR)glXGetProcAddress((const GLubyte*)funcName);
#elif defined(WIN32)
- static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("opengl32");
+ static emugl::SharedLibrary* libGL = emugl::SharedLibrary::open("opengl32");
ret = (GL_FUNC_PTR)wglGetProcAddress(funcName);
#elif defined(__APPLE__)
- static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("/System/Library/Frameworks/OpenGL.framework/OpenGL");
+ static emugl::SharedLibrary* libGL = emugl::SharedLibrary::open("/System/Library/Frameworks/OpenGL.framework/OpenGL");
#endif
if(!ret && libGL){
ret = libGL->findSymbol(funcName);
diff --git a/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp b/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp
index 3cf5dbc..7d514e8 100644
--- a/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp
@@ -16,7 +16,8 @@
#include "EGLDispatch.h"
#include <stdio.h>
#include <stdlib.h>
-#include "osDynLibrary.h"
+
+#include "emugl/common/shared_library.h"
EGLDispatch s_egl;
@@ -28,7 +29,7 @@ bool init_egl_dispatch()
const char *libName = getenv("ANDROID_EGL_LIB");
if (!libName) libName = DEFAULT_EGL_LIB;
- osUtils::dynLibrary *lib = osUtils::dynLibrary::open(libName);
+ emugl::SharedLibrary *lib = emugl::SharedLibrary::open(libName);
if (!lib) {
printf("Failed to open %s\n", libName);
return NULL;
diff --git a/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp b/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp
index cda205f..8c51a4e 100644
--- a/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp
@@ -17,12 +17,13 @@
#include "GL2Dispatch.h"
#include <stdio.h>
#include <stdlib.h>
-#include "osDynLibrary.h"
+
+#include "emugl/common/shared_library.h"
gl2_decoder_context_t s_gl2;
int s_gl2_enabled;
-static osUtils::dynLibrary *s_gles2_lib = NULL;
+static emugl::SharedLibrary *s_gles2_lib = NULL;
#define DEFAULT_GLES_V2_LIB EMUGL_LIBNAME("GLES_V2_translator")
@@ -38,7 +39,7 @@ bool init_gl2_dispatch()
//
// Load the GLES library
//
- s_gles2_lib = osUtils::dynLibrary::open(libName);
+ s_gles2_lib = emugl::SharedLibrary::open(libName);
if (!s_gles2_lib) return false;
//
diff --git a/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp b/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp
index 089512a..c127dc3 100644
--- a/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp
@@ -16,11 +16,12 @@
#include "GLDispatch.h"
#include <stdio.h>
#include <stdlib.h>
-#include "osDynLibrary.h"
+
+#include "emugl/common/shared_library.h"
GLDispatch s_gl;
-static osUtils::dynLibrary *s_gles_lib = NULL;
+static emugl::SharedLibrary *s_gles_lib = NULL;
//
// This function is called only once during initialiation before
@@ -34,7 +35,7 @@ bool init_gl_dispatch()
const char *libName = getenv("ANDROID_GLESv1_LIB");
if (!libName) libName = DEFAULT_GLES_CM_LIB;
- s_gles_lib = osUtils::dynLibrary::open(libName);
+ s_gles_lib = emugl::SharedLibrary::open(libName);
if (!s_gles_lib) return false;
s_gl.glAlphaFunc = (glAlphaFunc_t) s_gles_lib->findSymbol("glAlphaFunc");