From: José Fonseca Date: Thu, 25 Nov 2010 17:50:26 +0000 (+0000) Subject: Handle glXxxPointer X-Git-Tag: 2.0_alpha^2~1295 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dacd8dd5910b1e32e4a8c378fe9ac01b2bce695b;p=tools%2Fapitrace.git Handle glXxxPointer --- diff --git a/glretrace.py b/glretrace.py index 0724cff..3e2e922 100644 --- a/glretrace.py +++ b/glretrace.py @@ -26,12 +26,33 @@ import stdapi import glapi -import retrace - - -class GlRetracer(retrace.Retracer): - - pass +from retrace import Retracer + + +class GlRetracer(Retracer): + + def extract_arg(self, function, arg, arg_type, lvalue, rvalue): + if function.name in [ + "glColorPointer" + "glEdgeFlagPointer" + "glIndexPointer", + "glNormalPointer", + "glTexCoordPointer", + "glVertexPointer", + "glFogCoordPointer", + "glSecondaryColorPointer", + "glVertexAttribPointer", + ] and arg.name == 'pointer': + self.extract_pointer(function, arg, arg_type, lvalue, rvalue) + else: + Retracer.extract_arg(self, function, arg, arg_type, lvalue, rvalue) + + def extract_pointer(self, function, arg, arg_type, lvalue, rvalue): + print ' if (dynamic_cast(&%s)) {' % rvalue + print ' %s = 0;' % (lvalue) + print ' } else {' + print ' %s = (%s)(uintptr_t)(%s);' % (lvalue, arg_type, rvalue) + print ' }' if __name__ == '__main__': diff --git a/retrace.py b/retrace.py index a2d30a4..7525185 100644 --- a/retrace.py +++ b/retrace.py @@ -168,7 +168,7 @@ class Retracer: rvalue = 'call.arg(%u)' % (arg.index,) lvalue = arg.name try: - ValueExtractor().visit(arg_type, lvalue, rvalue) + self.extract_arg(function, arg, arg_type, lvalue, rvalue) except NotImplementedError: success = False print ' %s = 0; // FIXME' % arg.name @@ -200,6 +200,8 @@ class Retracer: print '}' print + def extract_arg(self, function, arg, arg_type, lvalue, rvalue): + ValueExtractor().visit(arg_type, lvalue, rvalue) def retrace_functions(self, functions): for function in functions: