From a20ba0e4deb831c69fe1f467f8f3a8fdc9134b20 Mon Sep 17 00:00:00 2001 From: Amit Feller Date: Tue, 21 Jun 2011 10:01:41 +0300 Subject: [PATCH] Setting Renderer default libs to use translator libs Change-Id: I853a30ce1aa7325d01a30b30c18f4e0bd5a5702f --- .../opengl/host/libs/libOpenglRender/EGLDispatch.cpp | 12 ++++++++++-- .../opengl/host/libs/libOpenglRender/GL2Dispatch.cpp | 10 +++++++++- .../opengl/host/libs/libOpenglRender/GLDispatch.cpp | 11 ++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp index 6a920fb3a..5f05caff1 100644 --- a/tools/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp +++ b/tools/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp @@ -20,17 +20,25 @@ EGLDispatch s_egl; +#ifdef _WIN32 +#define DEFAULT_EGL_LIB "libEGL_translator" +#elif defined(__APPLE__) +#define DEFAULT_EGL_LIB "libEGL_translator.dylib" +#else +#define DEFAULT_EGL_LIB "libEGL_translator.so" +#endif + bool init_egl_dispatch() { + const char *libName = getenv("ANDROID_EGL_LIB"); - if (!libName) libName = "libEGL.so"; + if (!libName) libName = DEFAULT_EGL_LIB; osUtils::dynLibrary *lib = osUtils::dynLibrary::open(libName); if (!lib) { printf("Failed to open %s\n", libName); return NULL; } - s_egl.eglGetError = (eglGetError_t) lib->findSymbol("eglGetError"); s_egl.eglGetDisplay = (eglGetDisplay_t) lib->findSymbol("eglGetDisplay"); s_egl.eglInitialize = (eglInitialize_t) lib->findSymbol("eglInitialize"); diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp index b32385c8d..a1b22d773 100644 --- a/tools/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp +++ b/tools/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp @@ -23,6 +23,14 @@ gl2_decoder_context_t s_gl2; static osUtils::dynLibrary *s_gles2_lib = NULL; +#ifdef _WIN32 +#define DEFAULT_GLES_V2_LIB "libGLES_V2_translator" +#elif defined(__APPLE__) +#define DEFAULT_GLES_V2_LIB "libGLES_V2_translator.dylib" +#else +#define DEFAULT_GLES_V2_LIB "libGLES_V2_translator.so" +#endif + // // This function is called only once during initialiation before // any thread has been created - hence it should NOT be thread safe. @@ -30,7 +38,7 @@ static osUtils::dynLibrary *s_gles2_lib = NULL; bool init_gl2_dispatch() { const char *libName = getenv("ANDROID_GLESv2_LIB"); - if (!libName) libName = "libGLESv2.so"; + if (!libName) libName = DEFAULT_GLES_V2_LIB; // // Load the GLES library diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp index f438cd93d..c8e53cdc3 100644 --- a/tools/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp +++ b/tools/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp @@ -26,10 +26,19 @@ static osUtils::dynLibrary *s_gles_lib = NULL; // This function is called only once during initialiation before // any thread has been created - hence it should NOT be thread safe. // + +#ifdef _WIN32 +#define DEFAULT_GLES_CM_LIB "libGLES_CM_translator" +#elif defined(__APPLE__) +#define DEFAULT_GLES_CM_LIB "libGLES_CM_translator.dylib" +#else +#define DEFAULT_GLES_CM_LIB "libGLES_CM_translator.so" +#endif + bool init_gl_dispatch() { const char *libName = getenv("ANDROID_GLESv1_LIB"); - if (!libName) libName = "libGLES_CM.so"; + if (!libName) libName = DEFAULT_GLES_CM_LIB; s_gles_lib = osUtils::dynLibrary::open(libName); if (!s_gles_lib) return false;