Loading opengl/libs/GLES2_dbg/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -45,3 +45,5 @@ LOCAL_MODULE:= libGLESv2_dbg LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) include $(LOCAL_PATH)/test/Android.mk opengl/libs/GLES2_dbg/src/dbgcontext.cpp +34 −3 Original line number Diff line number Diff line Loading @@ -25,11 +25,11 @@ extern "C" namespace android { static pthread_key_t sEGLThreadLocalStorageKey = -1; pthread_key_t dbgEGLThreadLocalStorageKey = -1; DbgContext * getDbgContextThreadSpecific() { tls_t* tls = (tls_t*)pthread_getspecific(sEGLThreadLocalStorageKey); tls_t* tls = (tls_t*)pthread_getspecific(dbgEGLThreadLocalStorageKey); return tls->dbg; } Loading Loading @@ -63,7 +63,7 @@ DbgContext::~DbgContext() DbgContext * CreateDbgContext(const pthread_key_t EGLThreadLocalStorageKey, const unsigned version, const gl_hooks_t * const hooks) { sEGLThreadLocalStorageKey = EGLThreadLocalStorageKey; dbgEGLThreadLocalStorageKey = EGLThreadLocalStorageKey; assert(version < 2); assert(GL_NO_ERROR == hooks->gl.glGetError()); GLint MAX_VERTEX_ATTRIBS = 0; Loading Loading @@ -149,6 +149,37 @@ void DbgContext::Compress(const void * in_data, unsigned int in_len, } } unsigned char * DbgContext::Decompress(const void * in, const unsigned int inLen, unsigned int * const outLen) { assert(inLen > 4 * 3); if (inLen < 4 * 3) return NULL; *outLen = *(uint32_t *)in; unsigned char * const out = (unsigned char *)malloc(*outLen); unsigned int outPos = 0; const unsigned char * const end = (const unsigned char *)in + inLen; for (const unsigned char * inData = (const unsigned char *)in + 4; inData < end; ) { const uint32_t chunkOut = *(uint32_t *)inData; inData += 4; const uint32_t chunkIn = *(uint32_t *)inData; inData += 4; if (chunkIn > 0) { assert(inData + chunkIn <= end); assert(outPos + chunkOut <= *outLen); outPos += lzf_decompress(inData, chunkIn, out + outPos, chunkOut); inData += chunkIn; } else { assert(inData + chunkOut <= end); assert(outPos + chunkOut <= *outLen); memcpy(out + outPos, inData, chunkOut); inData += chunkOut; outPos += chunkOut; } } return out; } void * DbgContext::GetReadPixelsBuffer(const unsigned size) { if (lzf_refBufSize < size + 8) { Loading opengl/libs/GLES2_dbg/src/header.h +4 −1 Original line number Diff line number Diff line Loading @@ -73,8 +73,9 @@ struct GLFunctionBitfield { }; struct DbgContext { private: static const unsigned int LZF_CHUNK_SIZE = 256 * 1024; private: char * lzf_buf; // malloc / free; for lzf chunk compression and other uses // used as buffer and reference frame for ReadPixels; malloc/free Loading Loading @@ -129,6 +130,8 @@ public: void Fetch(const unsigned index, std::string * const data) const; void Compress(const void * in_data, unsigned in_len, std::string * const outStr); static unsigned char * Decompress(const void * in, const unsigned int inLen, unsigned int * const outLen); // malloc/free void * GetReadPixelsBuffer(const unsigned size); bool IsReadPixelBuffer(const void * const ptr) { return ptr == lzf_ref[lzf_readIndex]; Loading opengl/libs/GLES2_dbg/src/server.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ float Send(const glesv2debugger::Message & msg, glesv2debugger::Message & cmd) Die("Failed to send message length"); } nsecs_t c0 = systemTime(timeMode); sent = send(clientSock, str.c_str(), str.length(), 0); sent = send(clientSock, str.data(), str.length(), 0); float t = (float)ns2ms(systemTime(timeMode) - c0); if (sent != str.length()) { LOGD("actual sent=%d expected=%d clientSock=%d", sent, str.length(), clientSock); Loading Loading @@ -246,8 +246,9 @@ int * MessageLoop(FunctionCall & functionCall, glesv2debugger::Message & msg, msg.set_function(function); // when not exectResponse, set cmd to CONTINUE then SKIP // cmd will be overwritten by received command cmd.set_function(glesv2debugger::Message_Function_CONTINUE); cmd.set_expect_response(false); cmd.set_expect_response(expectResponse); glesv2debugger::Message_Function oldCmd = cmd.function(); Send(msg, cmd); expectResponse = cmd.expect_response(); Loading opengl/libs/GLES2_dbg/src/vertex.cpp +4 −12 Original line number Diff line number Diff line Loading @@ -43,10 +43,8 @@ void Debug_glDrawArrays(GLenum mode, GLint first, GLsizei count) void * pixels = NULL; int viewport[4] = {}; if (!expectResponse) { cmd.set_function(glesv2debugger::Message_Function_CONTINUE); cmd.set_expect_response(false); } cmd.set_expect_response(expectResponse); glesv2debugger::Message_Function oldCmd = cmd.function(); Send(msg, cmd); expectResponse = cmd.expect_response(); Loading @@ -61,8 +59,6 @@ void Debug_glDrawArrays(GLenum mode, GLint first, GLsizei count) msg.set_function(glesv2debugger::Message_Function_glDrawArrays); msg.set_type(glesv2debugger::Message_Type_AfterCall); msg.set_expect_response(expectResponse); if (!expectResponse) cmd.set_function(glesv2debugger::Message_Function_SKIP); if (!expectResponse) { cmd.set_function(glesv2debugger::Message_Function_SKIP); cmd.set_expect_response(false); Loading Loading @@ -154,10 +150,8 @@ void Debug_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* void * pixels = NULL; int viewport[4] = {}; if (!expectResponse) { cmd.set_function(glesv2debugger::Message_Function_CONTINUE); cmd.set_expect_response(false); } cmd.set_expect_response(expectResponse); glesv2debugger::Message_Function oldCmd = cmd.function(); Send(msg, cmd); expectResponse = cmd.expect_response(); Loading @@ -172,8 +166,6 @@ void Debug_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* msg.set_function(glesv2debugger::Message_Function_glDrawElements); msg.set_type(glesv2debugger::Message_Type_AfterCall); msg.set_expect_response(expectResponse); if (!expectResponse) cmd.set_function(glesv2debugger::Message_Function_SKIP); if (!expectResponse) { cmd.set_function(glesv2debugger::Message_Function_SKIP); cmd.set_expect_response(false); Loading Loading
opengl/libs/GLES2_dbg/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -45,3 +45,5 @@ LOCAL_MODULE:= libGLESv2_dbg LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) include $(LOCAL_PATH)/test/Android.mk
opengl/libs/GLES2_dbg/src/dbgcontext.cpp +34 −3 Original line number Diff line number Diff line Loading @@ -25,11 +25,11 @@ extern "C" namespace android { static pthread_key_t sEGLThreadLocalStorageKey = -1; pthread_key_t dbgEGLThreadLocalStorageKey = -1; DbgContext * getDbgContextThreadSpecific() { tls_t* tls = (tls_t*)pthread_getspecific(sEGLThreadLocalStorageKey); tls_t* tls = (tls_t*)pthread_getspecific(dbgEGLThreadLocalStorageKey); return tls->dbg; } Loading Loading @@ -63,7 +63,7 @@ DbgContext::~DbgContext() DbgContext * CreateDbgContext(const pthread_key_t EGLThreadLocalStorageKey, const unsigned version, const gl_hooks_t * const hooks) { sEGLThreadLocalStorageKey = EGLThreadLocalStorageKey; dbgEGLThreadLocalStorageKey = EGLThreadLocalStorageKey; assert(version < 2); assert(GL_NO_ERROR == hooks->gl.glGetError()); GLint MAX_VERTEX_ATTRIBS = 0; Loading Loading @@ -149,6 +149,37 @@ void DbgContext::Compress(const void * in_data, unsigned int in_len, } } unsigned char * DbgContext::Decompress(const void * in, const unsigned int inLen, unsigned int * const outLen) { assert(inLen > 4 * 3); if (inLen < 4 * 3) return NULL; *outLen = *(uint32_t *)in; unsigned char * const out = (unsigned char *)malloc(*outLen); unsigned int outPos = 0; const unsigned char * const end = (const unsigned char *)in + inLen; for (const unsigned char * inData = (const unsigned char *)in + 4; inData < end; ) { const uint32_t chunkOut = *(uint32_t *)inData; inData += 4; const uint32_t chunkIn = *(uint32_t *)inData; inData += 4; if (chunkIn > 0) { assert(inData + chunkIn <= end); assert(outPos + chunkOut <= *outLen); outPos += lzf_decompress(inData, chunkIn, out + outPos, chunkOut); inData += chunkIn; } else { assert(inData + chunkOut <= end); assert(outPos + chunkOut <= *outLen); memcpy(out + outPos, inData, chunkOut); inData += chunkOut; outPos += chunkOut; } } return out; } void * DbgContext::GetReadPixelsBuffer(const unsigned size) { if (lzf_refBufSize < size + 8) { Loading
opengl/libs/GLES2_dbg/src/header.h +4 −1 Original line number Diff line number Diff line Loading @@ -73,8 +73,9 @@ struct GLFunctionBitfield { }; struct DbgContext { private: static const unsigned int LZF_CHUNK_SIZE = 256 * 1024; private: char * lzf_buf; // malloc / free; for lzf chunk compression and other uses // used as buffer and reference frame for ReadPixels; malloc/free Loading Loading @@ -129,6 +130,8 @@ public: void Fetch(const unsigned index, std::string * const data) const; void Compress(const void * in_data, unsigned in_len, std::string * const outStr); static unsigned char * Decompress(const void * in, const unsigned int inLen, unsigned int * const outLen); // malloc/free void * GetReadPixelsBuffer(const unsigned size); bool IsReadPixelBuffer(const void * const ptr) { return ptr == lzf_ref[lzf_readIndex]; Loading
opengl/libs/GLES2_dbg/src/server.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ float Send(const glesv2debugger::Message & msg, glesv2debugger::Message & cmd) Die("Failed to send message length"); } nsecs_t c0 = systemTime(timeMode); sent = send(clientSock, str.c_str(), str.length(), 0); sent = send(clientSock, str.data(), str.length(), 0); float t = (float)ns2ms(systemTime(timeMode) - c0); if (sent != str.length()) { LOGD("actual sent=%d expected=%d clientSock=%d", sent, str.length(), clientSock); Loading Loading @@ -246,8 +246,9 @@ int * MessageLoop(FunctionCall & functionCall, glesv2debugger::Message & msg, msg.set_function(function); // when not exectResponse, set cmd to CONTINUE then SKIP // cmd will be overwritten by received command cmd.set_function(glesv2debugger::Message_Function_CONTINUE); cmd.set_expect_response(false); cmd.set_expect_response(expectResponse); glesv2debugger::Message_Function oldCmd = cmd.function(); Send(msg, cmd); expectResponse = cmd.expect_response(); Loading
opengl/libs/GLES2_dbg/src/vertex.cpp +4 −12 Original line number Diff line number Diff line Loading @@ -43,10 +43,8 @@ void Debug_glDrawArrays(GLenum mode, GLint first, GLsizei count) void * pixels = NULL; int viewport[4] = {}; if (!expectResponse) { cmd.set_function(glesv2debugger::Message_Function_CONTINUE); cmd.set_expect_response(false); } cmd.set_expect_response(expectResponse); glesv2debugger::Message_Function oldCmd = cmd.function(); Send(msg, cmd); expectResponse = cmd.expect_response(); Loading @@ -61,8 +59,6 @@ void Debug_glDrawArrays(GLenum mode, GLint first, GLsizei count) msg.set_function(glesv2debugger::Message_Function_glDrawArrays); msg.set_type(glesv2debugger::Message_Type_AfterCall); msg.set_expect_response(expectResponse); if (!expectResponse) cmd.set_function(glesv2debugger::Message_Function_SKIP); if (!expectResponse) { cmd.set_function(glesv2debugger::Message_Function_SKIP); cmd.set_expect_response(false); Loading Loading @@ -154,10 +150,8 @@ void Debug_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* void * pixels = NULL; int viewport[4] = {}; if (!expectResponse) { cmd.set_function(glesv2debugger::Message_Function_CONTINUE); cmd.set_expect_response(false); } cmd.set_expect_response(expectResponse); glesv2debugger::Message_Function oldCmd = cmd.function(); Send(msg, cmd); expectResponse = cmd.expect_response(); Loading @@ -172,8 +166,6 @@ void Debug_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* msg.set_function(glesv2debugger::Message_Function_glDrawElements); msg.set_type(glesv2debugger::Message_Type_AfterCall); msg.set_expect_response(expectResponse); if (!expectResponse) cmd.set_function(glesv2debugger::Message_Function_SKIP); if (!expectResponse) { cmd.set_function(glesv2debugger::Message_Function_SKIP); cmd.set_expect_response(false); Loading