Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c777ede authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "fix x86 build"

parents 442fa21e f56a9601
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@ LOCAL_SRC_FILES:= \
	EGL/eglApi.cpp 	       \
	EGL/trace.cpp              \
	EGL/getProcAddress.cpp.arm \
	EGL/hooks.cpp 	       \
	EGL/Loader.cpp 	       \
#

+2 −3
Original line number Diff line number Diff line
@@ -26,11 +26,10 @@

#include <EGL/egl.h>

#include "egldefs.h"
#include "glesv2dbg.h"
#include "hooks.h"
#include "egl_impl.h"

#include "Loader.h"
#include "glesv2dbg.h"

// ----------------------------------------------------------------------------
namespace android {
+66 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@

#include <utils/String8.h>

#include "egldefs.h"
#include "egl_impl.h"
#include "egl_tls.h"
#include "glesv2dbg.h"
@@ -278,6 +279,71 @@ EGLBoolean egl_init_drivers() {
    return res;
}

void gl_unimplemented() {
    LOGE("called unimplemented OpenGL ES API");
}

// ----------------------------------------------------------------------------

#if USE_FAST_TLS_KEY

// We have a dedicated TLS slot in bionic
static 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;
}

void setGlThreadSpecific(gl_hooks_t const *value) {
    gl_hooks_t const * volatile * tls_hooks = get_tls_hooks();
    tls_hooks[TLS_SLOT_OPENGL_API] = value;
}

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];
    if (hooks) return hooks;
    return &gHooksNoContext;
}

#else

void setGlThreadSpecific(gl_hooks_t const *value) {
    pthread_setspecific(gGLWrapperKey, value);
}

gl_hooks_t const* getGlThreadSpecific() {
    gl_hooks_t const* hooks =  static_cast<gl_hooks_t*>(pthread_getspecific(gGLWrapperKey));
    if (hooks) return hooks;
    return &gHooksNoContext;
}

#endif

// ----------------------------------------------------------------------------
// GL / EGL hooks
// ----------------------------------------------------------------------------

#undef GL_ENTRY
#undef EGL_ENTRY
#define GL_ENTRY(_r, _api, ...) #_api,
#define EGL_ENTRY(_r, _api, ...) #_api,

char const * const gl_names[] = {
    #include "entries.in"
    NULL
};

char const * const egl_names[] = {
    #include "egl_entries.in"
    NULL
};

#undef GL_ENTRY
#undef EGL_ENTRY


// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include <utils/SortedVector.h>
#include <utils/threads.h>

#include "egldefs.h"
#include "hooks.h"

// ----------------------------------------------------------------------------
+15 −0
Original line number Diff line number Diff line
@@ -21,7 +21,12 @@

#include <EGL/egl.h>

#include "egldefs.h"
#include "hooks.h"

// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------

class DbgContext;

@@ -58,6 +63,16 @@ public:

#define setError(_e, _r) egl_tls_t::setErrorEtc(__FUNCTION__, __LINE__, _e, _r)

// ----------------------------------------------------------------------------

#if EGL_TRACE

extern gl_hooks_t const* getGLTraceThreadSpecific();

#endif

// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------

#endif // ANDROID_EGL_TLS_H
Loading