diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2013-11-22 11:20:20 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2013-11-22 11:20:20 -0800 |
commit | fc3cdb936e6b34257a3bfaf30e89db8f11667cc5 (patch) | |
tree | 4eb3500004e152440074ae85e31d61148fb51cd8 /opengl/libs/hooks.h | |
parent | f2f74ca65f34ae0cae6f0cca40f1c18aa771739d (diff) | |
parent | afd0debe4bdf47dc0f968282ca1261842bb65d60 (diff) | |
download | frameworks_native-fc3cdb936e6b34257a3bfaf30e89db8f11667cc5.zip frameworks_native-fc3cdb936e6b34257a3bfaf30e89db8f11667cc5.tar.gz frameworks_native-fc3cdb936e6b34257a3bfaf30e89db8f11667cc5.tar.bz2 |
Merge commit 'afd0debe4bdf47dc0f968282ca1261842bb65d60' into HEAD
Change-Id: Ic9aed2c57bdfeb250ce2dd7f0e9289ba5b6e936a
Diffstat (limited to 'opengl/libs/hooks.h')
-rw-r--r-- | opengl/libs/hooks.h | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/opengl/libs/hooks.h b/opengl/libs/hooks.h index b2a684c..4b43198 100644 --- a/opengl/libs/hooks.h +++ b/opengl/libs/hooks.h @@ -32,13 +32,11 @@ #include <GLES3/gl3.h> #include <GLES3/gl3ext.h> -#if !defined(__arm__) && !defined(__mips__) -#define USE_SLOW_BINDING 1 -#else -#define USE_SLOW_BINDING 0 -#endif +// set to 1 for debugging +#define USE_SLOW_BINDING 0 + #undef NELEM -#define NELEM(x) (sizeof(x)/sizeof(*(x))) +#define NELEM(x) (sizeof(x)/sizeof(*(x))) // maximum number of GL extensions that can be used simultaneously in // a given process. this limitation exists because we need to have @@ -47,15 +45,7 @@ #define MAX_NUMBER_OF_GL_EXTENSIONS 256 -#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && __OPTIMIZE__ -#define USE_FAST_TLS_KEY 1 -#else -#define USE_FAST_TLS_KEY 0 -#endif - -#if USE_FAST_TLS_KEY -# include <bionic_tls.h> /* special private C library header */ -#endif +#include <bionic_tls.h> /* special private C library header */ // ---------------------------------------------------------------------------- namespace android { @@ -84,7 +74,20 @@ struct gl_hooks_t { #undef EGL_ENTRY EGLAPI void setGlThreadSpecific(gl_hooks_t const *value); -EGLAPI gl_hooks_t const* getGlThreadSpecific(); + +// We have a dedicated TLS slot in bionic +inline gl_hooks_t const * volatile * get_tls_hooks() { + volatile void *tls_base = __get_tls(); + gl_hooks_t const * volatile * tls_hooks = + reinterpret_cast<gl_hooks_t const * volatile *>(tls_base); + return tls_hooks; +} + +inline EGLAPI gl_hooks_t const* getGlThreadSpecific() { + gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); + gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API]; + return hooks; +} // ---------------------------------------------------------------------------- }; // namespace android |