diff options
author | David Li <davidxli@google.com> | 2011-03-28 10:39:28 -0700 |
---|---|---|
committer | David Li <davidxli@google.com> | 2011-04-12 15:56:10 -0700 |
commit | ce30eb8a90a1ac458e15e773057a8a73b0918ae6 (patch) | |
tree | 4d05f2d2d27641e264d59249355597d4c2a4d3a7 /opengl/libs/GLES2_dbg/src | |
parent | 2e3ede527d8a972795a49ffc7eef4ead391107ec (diff) | |
download | frameworks_base-ce30eb8a90a1ac458e15e773057a8a73b0918ae6.zip frameworks_base-ce30eb8a90a1ac458e15e773057a8a73b0918ae6.tar.gz frameworks_base-ce30eb8a90a1ac458e15e773057a8a73b0918ae6.tar.bz2 |
GLES2Dbg: change GLES2_dbg to shared library
Change-Id: I493e9bff431bd939f4e80e1e9c614dd557307fa2
Signed-off-by: David Li <davidxli@google.com>
Diffstat (limited to 'opengl/libs/GLES2_dbg/src')
-rw-r--r-- | opengl/libs/GLES2_dbg/src/api.cpp | 9 | ||||
-rw-r--r-- | opengl/libs/GLES2_dbg/src/caller.cpp | 1 | ||||
-rw-r--r-- | opengl/libs/GLES2_dbg/src/dbgcontext.cpp | 13 | ||||
-rw-r--r-- | opengl/libs/GLES2_dbg/src/header.h | 11 |
4 files changed, 24 insertions, 10 deletions
diff --git a/opengl/libs/GLES2_dbg/src/api.cpp b/opengl/libs/GLES2_dbg/src/api.cpp index 130ca7e..e26e1d7 100644 --- a/opengl/libs/GLES2_dbg/src/api.cpp +++ b/opengl/libs/GLES2_dbg/src/api.cpp @@ -16,11 +16,16 @@ // auto generated by generate_api_cpp.py +#include <utils/Debug.h> + #include "src/header.h" #include "src/api.h" -template<typename T> static int ToInt(const T & t) { STATIC_ASSERT(sizeof(T) == sizeof(int), bitcast); return (int &)t; } -template<typename T> static T FromInt(const int & t) { STATIC_ASSERT(sizeof(T) == sizeof(int), bitcast); return (T &)t; } +template<typename T> static int ToInt(const T & t) +{ + COMPILE_TIME_ASSERT_FUNCTION_SCOPE(sizeof(T) == sizeof(int)); + return (int &)t; +} void Debug_glActiveTexture(GLenum texture) { diff --git a/opengl/libs/GLES2_dbg/src/caller.cpp b/opengl/libs/GLES2_dbg/src/caller.cpp index 9992f05..ad9440b 100644 --- a/opengl/libs/GLES2_dbg/src/caller.cpp +++ b/opengl/libs/GLES2_dbg/src/caller.cpp @@ -105,7 +105,6 @@ const int * GenerateCall(DbgContext * const dbg, const glesv2debugger::Message & { LOGD("GenerateCall function=%u", cmd.function()); const int * ret = prevRet; // only some functions have return value - gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; nsecs_t c0 = systemTime(timeMode); switch (cmd.function()) { case glesv2debugger::Message_Function_glActiveTexture: dbg->hooks->gl.glActiveTexture( diff --git a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp index cc7336c..40a77d7 100644 --- a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp +++ b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp @@ -15,6 +15,7 @@ */ #include "header.h" +#include "egl_tls.h" extern "C" { @@ -24,6 +25,14 @@ extern "C" namespace android { +static pthread_key_t sEGLThreadLocalStorageKey = -1; + +DbgContext * getDbgContextThreadSpecific() +{ + tls_t* tls = (tls_t*)pthread_getspecific(sEGLThreadLocalStorageKey); + return tls->dbg; +} + DbgContext::DbgContext(const unsigned version, const gl_hooks_t * const hooks, const unsigned MAX_VERTEX_ATTRIBS) : lzf_buf(NULL), lzf_readIndex(0), lzf_refSize(0), lzf_refBufSize(0) @@ -47,8 +56,10 @@ DbgContext::~DbgContext() free(lzf_ref[1]); } -DbgContext * CreateDbgContext(const unsigned version, const gl_hooks_t * const hooks) +DbgContext * CreateDbgContext(const pthread_key_t EGLThreadLocalStorageKey, + const unsigned version, const gl_hooks_t * const hooks) { + sEGLThreadLocalStorageKey = EGLThreadLocalStorageKey; assert(version < 2); assert(GL_NO_ERROR == hooks->gl.glGetError()); GLint MAX_VERTEX_ATTRIBS = 0; diff --git a/opengl/libs/GLES2_dbg/src/header.h b/opengl/libs/GLES2_dbg/src/header.h index 9218da5..9d51e8e 100644 --- a/opengl/libs/GLES2_dbg/src/header.h +++ b/opengl/libs/GLES2_dbg/src/header.h @@ -14,6 +14,9 @@ ** limitations under the License. */ +#ifndef ANDROID_GLES2_DBG_HEADER_H +#define ANDROID_GLES2_DBG_HEADER_H + #include <stdlib.h> #include <ctype.h> #include <string.h> @@ -24,9 +27,7 @@ #include <cutils/log.h> #include <utils/Timers.h> -#include <../../../libcore/include/StaticAssert.h> -#define EGL_TRACE 1 #include "hooks.h" #include "glesv2dbg.h" @@ -39,8 +40,6 @@ using namespace android; using namespace com::android; -#define API_ENTRY(_api) Debug_##_api - #ifndef __location__ #define __HIERALLOC_STRING_0__(s) #s #define __HIERALLOC_STRING_1__(s) __HIERALLOC_STRING_0__(s) @@ -141,9 +140,7 @@ public: void glDeleteBuffers(GLsizei n, const GLuint *buffers); }; - DbgContext * getDbgContextThreadSpecific(); -#define DBGCONTEXT(ctx) DbgContext * const ctx = getDbgContextThreadSpecific(); struct FunctionCall { virtual const int * operator()(gl_hooks_t::gl_t const * const _c, @@ -169,3 +166,5 @@ void SetProp(DbgContext * const dbg, const glesv2debugger::Message & cmd); const int * GenerateCall(DbgContext * const dbg, const glesv2debugger::Message & cmd, glesv2debugger::Message & msg, const int * const prevRet); }; // namespace android { + +#endif // #ifndef ANDROID_GLES2_DBG_HEADER_H |