Android replay load EGL symbols from libEGL.so instead of RTLD_NEXT.

For GLES only get symbols from eglGetProcAddress and not dlsym,
to prevent getting GL symbols.
This commit is contained in:
michaelrgb
2017-11-24 19:14:09 +01:00
committed by Baldur Karlsson
parent 6345fa2803
commit 2349fe4c05
5 changed files with 19 additions and 11 deletions
+3 -1
View File
@@ -426,7 +426,9 @@ bool EGLHook::PopulateHooks()
{
SetupHooks();
return SharedPopulateHooks([](const char *funcName) { return (void *)eglGetProcAddress(funcName); });
return SharedPopulateHooks(
false, // dlsym can return GL symbols during a GLES context
[](const char *funcName) { return (void *)eglGetProcAddress(funcName); });
}
const GLHookSet &GetRealGLFunctionsEGL()
+3 -2
View File
@@ -810,8 +810,9 @@ bool OpenGLHook::PopulateHooks()
glXGetProcAddress((const GLubyte *)"glXCreateContextAttribsARB");
return SharedPopulateHooks(
[](const char *funcName) { return (void *)glXGetProcAddress((const GLubyte *)funcName); });
return SharedPopulateHooks(true, [](const char *funcName) {
return (void *)glXGetProcAddress((const GLubyte *)funcName);
});
}
const GLHookSet &GetRealGLFunctions()
@@ -1037,14 +1037,15 @@ void *SharedLookupFuncPtr(const char *func, void *realFunc)
return NULL;
}
bool SharedPopulateHooks(void *(*lookupFunc)(const char *))
bool SharedPopulateHooks(bool dlsymFirst, void *(*lookupFunc)(const char *))
{
#undef HookInit
#define HookInit(function) \
if(GL.function == NULL) \
{ \
GL.function = (CONCAT(function, _hooktype))dlsym(libGLdlsymHandle, STRINGIZE(function)); \
lookupFunc((const char *)STRINGIZE(function)); \
#define HookInit(function) \
if(GL.function == NULL) \
{ \
if(dlsymFirst) \
GL.function = (CONCAT(function, _hooktype))dlsym(libGLdlsymHandle, STRINGIZE(function)); \
lookupFunc((const char *)STRINGIZE(function)); \
}
// cheeky
+1 -1
View File
@@ -31,7 +31,7 @@ void CloneDisplay(Display *dpy);
#endif
void *SharedLookupFuncPtr(const char *func, void *realFunc);
bool SharedPopulateHooks(void *(*lookupFunc)(const char *));
bool SharedPopulateHooks(bool dlsymFirst, void *(*lookupFunc)(const char *));
extern GLHookSet GL;
extern WrappedOpenGL *m_GLDriver;
+5 -1
View File
@@ -27,6 +27,7 @@
#include <dlfcn.h>
#include "serialise/rdcfile.h"
#include "gl_driver.h"
#include "gl_hooks_linux_shared.h"
#include "gl_library_egl.h"
#include "gl_resources.h"
@@ -41,7 +42,10 @@ ReplayStatus GLES_CreateReplayDevice(RDCFile *rdc, IReplayDriver **driver)
if(!egl.IsInitialized())
{
bool load_ok = egl.LoadSymbolsFrom(RTLD_NEXT);
#if ENABLED(RDOC_ANDROID)
libGLdlsymHandle = dlopen("libEGL.so", RTLD_NOW);
#endif
bool load_ok = egl.LoadSymbolsFrom(libGLdlsymHandle);
if(!load_ok)
{