Loading opengl/libs/GLES2_dbg/generate_api_cpp.py +30 −22 Original line number Diff line number Diff line Loading @@ -31,11 +31,11 @@ def generate_api(lines): externs = [] i = 0 # these have been hand written skipFunctions = ["glReadPixels", "glDrawArrays", "glDrawElements"] skipFunctions = ["glDrawArrays", "glDrawElements"] # these have an EXTEND_Debug_* macro for getting data extendFunctions = ["glCopyTexImage2D", "glCopyTexSubImage2D", "glShaderSource", "glTexImage2D", "glTexSubImage2D"] extendFunctions = ["glCopyTexImage2D", "glCopyTexSubImage2D", "glReadPixels", "glShaderSource", "glTexImage2D", "glTexSubImage2D"] # these also needs to be forwarded to DbgContext contextFunctions = ["glUseProgram", "glEnableVertexAttribArray", "glDisableVertexAttribArray", Loading Loading @@ -141,6 +141,11 @@ def generate_api(lines): if inout in ["out", "inout"]: print " msg.set_time((systemTime(timeMode) - c0) * 1e-6f);" print " " + getData if functionName in extendFunctions: print "\ #ifdef EXTEND_AFTER_CALL_Debug_%s\n\ EXTEND_AFTER_CALL_Debug_%s;\n\ #endif" % (functionName, functionName) if functionName in contextFunctions: print " getDbgContextThreadSpecific()->%s(%s);" % (functionName, arguments) if returnType == "void": Loading @@ -157,7 +162,10 @@ def generate_api(lines): if inout in ["in", "inout"]: print getData if functionName in extendFunctions: print " EXTEND_Debug_%s;" % (functionName) print "\ #ifdef EXTEND_Debug_%s\n\ EXTEND_Debug_%s;\n\ #endif" % (functionName, functionName) print " int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_%s);"\ % (functionName) if returnType != "void": Loading opengl/libs/GLES2_dbg/generate_debugger_message_proto.py +13 −12 Original line number Diff line number Diff line Loading @@ -104,7 +104,8 @@ message Message { BeforeCall = 0; AfterCall = 1; Response = 2; // currently used for misc messages AfterGeneratedCall = 2; Response = 3; // currently used for misc messages } required Type type = 3; required bool expect_response = 4; Loading opengl/libs/GLES2_dbg/src/api.cpp +68 −0 Original line number Diff line number Diff line Loading @@ -597,6 +597,9 @@ void Debug_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, G const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); #ifdef EXTEND_AFTER_CALL_Debug_glCopyTexImage2D EXTEND_AFTER_CALL_Debug_glCopyTexImage2D; #endif return 0; } } caller; Loading @@ -618,7 +621,9 @@ void Debug_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, G msg.set_arg6(height); msg.set_arg7(border); #ifdef EXTEND_Debug_glCopyTexImage2D EXTEND_Debug_glCopyTexImage2D; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCopyTexImage2D); } Loading @@ -637,6 +642,9 @@ void Debug_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); #ifdef EXTEND_AFTER_CALL_Debug_glCopyTexSubImage2D EXTEND_AFTER_CALL_Debug_glCopyTexSubImage2D; #endif return 0; } } caller; Loading @@ -658,7 +666,9 @@ void Debug_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint msg.set_arg6(width); msg.set_arg7(height); #ifdef EXTEND_Debug_glCopyTexSubImage2D EXTEND_Debug_glCopyTexSubImage2D; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCopyTexSubImage2D); } Loading Loading @@ -2169,6 +2179,49 @@ void Debug_glPolygonOffset(GLfloat factor, GLfloat units) int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glPolygonOffset); } void Debug_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) { glesv2debugger::Message msg; struct : public FunctionCall { GLint x; GLint y; GLsizei width; GLsizei height; GLenum format; GLenum type; GLvoid* pixels; const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glReadPixels(x, y, width, height, format, type, pixels); #ifdef EXTEND_AFTER_CALL_Debug_glReadPixels EXTEND_AFTER_CALL_Debug_glReadPixels; #endif return 0; } } caller; caller.x = x; caller.y = y; caller.width = width; caller.height = height; caller.format = format; caller.type = type; caller.pixels = pixels; msg.set_arg0(x); msg.set_arg1(y); msg.set_arg2(width); msg.set_arg3(height); msg.set_arg4(format); msg.set_arg5(type); msg.set_arg6(ToInt(pixels)); // FIXME: check for pointer usage #ifdef EXTEND_Debug_glReadPixels EXTEND_Debug_glReadPixels; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glReadPixels); } void Debug_glReleaseShaderCompiler(void) { glesv2debugger::Message msg; Loading Loading @@ -2302,6 +2355,9 @@ void Debug_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, c const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glShaderSource(shader, count, string, length); #ifdef EXTEND_AFTER_CALL_Debug_glShaderSource EXTEND_AFTER_CALL_Debug_glShaderSource; #endif return 0; } } caller; Loading @@ -2316,7 +2372,9 @@ void Debug_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, c msg.set_arg3(ToInt(length)); // FIXME: check for pointer usage #ifdef EXTEND_Debug_glShaderSource EXTEND_Debug_glShaderSource; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glShaderSource); } Loading Loading @@ -2477,6 +2535,9 @@ void Debug_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsize const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); #ifdef EXTEND_AFTER_CALL_Debug_glTexImage2D EXTEND_AFTER_CALL_Debug_glTexImage2D; #endif return 0; } } caller; Loading @@ -2501,7 +2562,9 @@ void Debug_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsize msg.set_arg8(ToInt(pixels)); // FIXME: check for pointer usage #ifdef EXTEND_Debug_glTexImage2D EXTEND_Debug_glTexImage2D; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexImage2D); } Loading Loading @@ -2621,6 +2684,9 @@ void Debug_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoff const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); #ifdef EXTEND_AFTER_CALL_Debug_glTexSubImage2D EXTEND_AFTER_CALL_Debug_glTexSubImage2D; #endif return 0; } } caller; Loading @@ -2645,7 +2711,9 @@ void Debug_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoff msg.set_arg8(ToInt(pixels)); // FIXME: check for pointer usage #ifdef EXTEND_Debug_glTexSubImage2D EXTEND_Debug_glTexSubImage2D; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexSubImage2D); } Loading opengl/libs/GLES2_dbg/src/api.h +13 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,19 @@ #define EXTEND_Debug_glCopyTexSubImage2D EXTEND_Debug_glCopyTexImage2D #define EXTEND_AFTER_CALL_Debug_glReadPixels \ { \ DbgContext * const dbg = getDbgContextThreadSpecific(); \ if (dbg->IsReadPixelBuffer(pixels)) { \ dbg->CompressReadPixelBuffer(msg.mutable_data()); \ msg.set_data_type(msg.ReferencedImage); \ } else { \ const unsigned int size = width * height * GetBytesPerPixel(format, type); \ dbg->Compress(pixels, size, msg.mutable_data()); \ msg.set_data_type(msg.NonreferencedImage); \ } \ } #define EXTEND_Debug_glShaderSource \ std::string * const data = msg.mutable_data(); \ for (unsigned i = 0; i < count; i++) \ Loading opengl/libs/GLES2_dbg/src/caller.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -771,7 +771,7 @@ const int * GenerateCall(DbgContext * const dbg, const glesv2debugger::Message & msg.set_time((systemTime(timeMode) - c0) * 1e-6f); msg.set_context_id(reinterpret_cast<int>(dbg)); msg.set_function(cmd.function()); msg.set_type(glesv2debugger::Message_Type_AfterCall); msg.set_type(glesv2debugger::Message_Type_AfterGeneratedCall); return ret; } Loading Loading
opengl/libs/GLES2_dbg/generate_api_cpp.py +30 −22 Original line number Diff line number Diff line Loading @@ -31,11 +31,11 @@ def generate_api(lines): externs = [] i = 0 # these have been hand written skipFunctions = ["glReadPixels", "glDrawArrays", "glDrawElements"] skipFunctions = ["glDrawArrays", "glDrawElements"] # these have an EXTEND_Debug_* macro for getting data extendFunctions = ["glCopyTexImage2D", "glCopyTexSubImage2D", "glShaderSource", "glTexImage2D", "glTexSubImage2D"] extendFunctions = ["glCopyTexImage2D", "glCopyTexSubImage2D", "glReadPixels", "glShaderSource", "glTexImage2D", "glTexSubImage2D"] # these also needs to be forwarded to DbgContext contextFunctions = ["glUseProgram", "glEnableVertexAttribArray", "glDisableVertexAttribArray", Loading Loading @@ -141,6 +141,11 @@ def generate_api(lines): if inout in ["out", "inout"]: print " msg.set_time((systemTime(timeMode) - c0) * 1e-6f);" print " " + getData if functionName in extendFunctions: print "\ #ifdef EXTEND_AFTER_CALL_Debug_%s\n\ EXTEND_AFTER_CALL_Debug_%s;\n\ #endif" % (functionName, functionName) if functionName in contextFunctions: print " getDbgContextThreadSpecific()->%s(%s);" % (functionName, arguments) if returnType == "void": Loading @@ -157,7 +162,10 @@ def generate_api(lines): if inout in ["in", "inout"]: print getData if functionName in extendFunctions: print " EXTEND_Debug_%s;" % (functionName) print "\ #ifdef EXTEND_Debug_%s\n\ EXTEND_Debug_%s;\n\ #endif" % (functionName, functionName) print " int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_%s);"\ % (functionName) if returnType != "void": Loading
opengl/libs/GLES2_dbg/generate_debugger_message_proto.py +13 −12 Original line number Diff line number Diff line Loading @@ -104,7 +104,8 @@ message Message { BeforeCall = 0; AfterCall = 1; Response = 2; // currently used for misc messages AfterGeneratedCall = 2; Response = 3; // currently used for misc messages } required Type type = 3; required bool expect_response = 4; Loading
opengl/libs/GLES2_dbg/src/api.cpp +68 −0 Original line number Diff line number Diff line Loading @@ -597,6 +597,9 @@ void Debug_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, G const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); #ifdef EXTEND_AFTER_CALL_Debug_glCopyTexImage2D EXTEND_AFTER_CALL_Debug_glCopyTexImage2D; #endif return 0; } } caller; Loading @@ -618,7 +621,9 @@ void Debug_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, G msg.set_arg6(height); msg.set_arg7(border); #ifdef EXTEND_Debug_glCopyTexImage2D EXTEND_Debug_glCopyTexImage2D; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCopyTexImage2D); } Loading @@ -637,6 +642,9 @@ void Debug_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); #ifdef EXTEND_AFTER_CALL_Debug_glCopyTexSubImage2D EXTEND_AFTER_CALL_Debug_glCopyTexSubImage2D; #endif return 0; } } caller; Loading @@ -658,7 +666,9 @@ void Debug_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint msg.set_arg6(width); msg.set_arg7(height); #ifdef EXTEND_Debug_glCopyTexSubImage2D EXTEND_Debug_glCopyTexSubImage2D; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCopyTexSubImage2D); } Loading Loading @@ -2169,6 +2179,49 @@ void Debug_glPolygonOffset(GLfloat factor, GLfloat units) int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glPolygonOffset); } void Debug_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) { glesv2debugger::Message msg; struct : public FunctionCall { GLint x; GLint y; GLsizei width; GLsizei height; GLenum format; GLenum type; GLvoid* pixels; const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glReadPixels(x, y, width, height, format, type, pixels); #ifdef EXTEND_AFTER_CALL_Debug_glReadPixels EXTEND_AFTER_CALL_Debug_glReadPixels; #endif return 0; } } caller; caller.x = x; caller.y = y; caller.width = width; caller.height = height; caller.format = format; caller.type = type; caller.pixels = pixels; msg.set_arg0(x); msg.set_arg1(y); msg.set_arg2(width); msg.set_arg3(height); msg.set_arg4(format); msg.set_arg5(type); msg.set_arg6(ToInt(pixels)); // FIXME: check for pointer usage #ifdef EXTEND_Debug_glReadPixels EXTEND_Debug_glReadPixels; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glReadPixels); } void Debug_glReleaseShaderCompiler(void) { glesv2debugger::Message msg; Loading Loading @@ -2302,6 +2355,9 @@ void Debug_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, c const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glShaderSource(shader, count, string, length); #ifdef EXTEND_AFTER_CALL_Debug_glShaderSource EXTEND_AFTER_CALL_Debug_glShaderSource; #endif return 0; } } caller; Loading @@ -2316,7 +2372,9 @@ void Debug_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, c msg.set_arg3(ToInt(length)); // FIXME: check for pointer usage #ifdef EXTEND_Debug_glShaderSource EXTEND_Debug_glShaderSource; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glShaderSource); } Loading Loading @@ -2477,6 +2535,9 @@ void Debug_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsize const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); #ifdef EXTEND_AFTER_CALL_Debug_glTexImage2D EXTEND_AFTER_CALL_Debug_glTexImage2D; #endif return 0; } } caller; Loading @@ -2501,7 +2562,9 @@ void Debug_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsize msg.set_arg8(ToInt(pixels)); // FIXME: check for pointer usage #ifdef EXTEND_Debug_glTexImage2D EXTEND_Debug_glTexImage2D; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexImage2D); } Loading Loading @@ -2621,6 +2684,9 @@ void Debug_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoff const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) { _c->glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); #ifdef EXTEND_AFTER_CALL_Debug_glTexSubImage2D EXTEND_AFTER_CALL_Debug_glTexSubImage2D; #endif return 0; } } caller; Loading @@ -2645,7 +2711,9 @@ void Debug_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoff msg.set_arg8(ToInt(pixels)); // FIXME: check for pointer usage #ifdef EXTEND_Debug_glTexSubImage2D EXTEND_Debug_glTexSubImage2D; #endif int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexSubImage2D); } Loading
opengl/libs/GLES2_dbg/src/api.h +13 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,19 @@ #define EXTEND_Debug_glCopyTexSubImage2D EXTEND_Debug_glCopyTexImage2D #define EXTEND_AFTER_CALL_Debug_glReadPixels \ { \ DbgContext * const dbg = getDbgContextThreadSpecific(); \ if (dbg->IsReadPixelBuffer(pixels)) { \ dbg->CompressReadPixelBuffer(msg.mutable_data()); \ msg.set_data_type(msg.ReferencedImage); \ } else { \ const unsigned int size = width * height * GetBytesPerPixel(format, type); \ dbg->Compress(pixels, size, msg.mutable_data()); \ msg.set_data_type(msg.NonreferencedImage); \ } \ } #define EXTEND_Debug_glShaderSource \ std::string * const data = msg.mutable_data(); \ for (unsigned i = 0; i < count; i++) \ Loading
opengl/libs/GLES2_dbg/src/caller.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -771,7 +771,7 @@ const int * GenerateCall(DbgContext * const dbg, const glesv2debugger::Message & msg.set_time((systemTime(timeMode) - c0) * 1e-6f); msg.set_context_id(reinterpret_cast<int>(dbg)); msg.set_function(cmd.function()); msg.set_type(glesv2debugger::Message_Type_AfterCall); msg.set_type(glesv2debugger::Message_Type_AfterGeneratedCall); return ret; } Loading