def doInvokeFunction(self, function): if function.name in self.getProcAddressFunctionNames: nameArg = function.args[0].name Tracer.doInvokeFunction(self, function) # Replace function addresses with ours # XXX: Doing this here instead of wrapRet means that the trace will # contain the addresses of the wrapper functions, and not the real # functions, but in practice this should make no difference. print " _result = _wrapProcAddress(%s, _result);" % (nameArg,) else: Tracer.doInvokeFunction(self, function)
def doInvokeFunction(self, function): # Same as invokeFunction() but called both when trace is enabled or disabled. # # Used to modify the behavior of GL entry-points. # Override GL extensions if function.name in ('glGetString', 'glGetIntegerv', 'glGetStringi'): Tracer.doInvokeFunction(self, function, prefix='gltrace::_', suffix='_override') return # We implement GL_EXT_debug_marker, GL_GREMEDY_*, etc., and not the # driver if function.name in self.marker_functions: return # We may be faking KHR_debug, so ensure the pointer queries result is # always zeroed to prevent dereference of unitialized pointers if function.name == 'glGetPointerv': print ' if (params &&' print ' (pname == GL_DEBUG_CALLBACK_FUNCTION ||' print ' pname == GL_DEBUG_CALLBACK_USER_PARAM)) {' print ' *params = NULL;' print ' }' if function.name in self.getProcAddressFunctionNames: else_ = '' for marker_function in self.marker_functions: if self.api.getFunctionByName(marker_function): print ' %sif (strcmp("%s", (const char *)%s) == 0) {' % ( else_, marker_function, function.args[0].name) print ' _result = (%s)&%s;' % (function.type, marker_function) print ' }' else_ = 'else ' print ' %s{' % else_ Tracer.doInvokeFunction(self, function) # Replace function addresses with ours # XXX: Doing this here instead of wrapRet means that the trace will # contain the addresses of the wrapper functions, and not the real # functions, but in practice this should make no difference. if function.name in self.getProcAddressFunctionNames: print ' _result = _wrapProcAddress(%s, _result);' % ( function.args[0].name, ) print ' }' return Tracer.doInvokeFunction(self, function)
def doInvokeFunction(self, function): # Same as invokeFunction() but called both when trace is enabled or disabled. # # Used to modify the behavior of GL entry-points. # Override GL extensions if function.name in ('glGetString', 'glGetIntegerv', 'glGetStringi'): Tracer.doInvokeFunction(self, function, prefix = 'gltrace::_', suffix = '_override') return # We implement GL_EXT_debug_marker, GL_GREMEDY_*, etc., and not the # driver if function.name in self.marker_functions: return # We may be faking KHR_debug, so ensure the pointer queries result is # always zeroed to prevent dereference of unitialized pointers if function.name == 'glGetPointerv': print ' if (params &&' print ' (pname == GL_DEBUG_CALLBACK_FUNCTION ||' print ' pname == GL_DEBUG_CALLBACK_USER_PARAM)) {' print ' *params = NULL;' print ' }' if function.name in self.getProcAddressFunctionNames: else_ = '' for marker_function in self.marker_functions: if self.api.getFunctionByName(marker_function): print ' %sif (strcmp("%s", (const char *)%s) == 0) {' % (else_, marker_function, function.args[0].name) print ' _result = (%s)&%s;' % (function.type, marker_function) print ' }' else_ = 'else ' print ' %s{' % else_ Tracer.doInvokeFunction(self, function) # Replace function addresses with ours # XXX: Doing this here instead of wrapRet means that the trace will # contain the addresses of the wrapper functions, and not the real # functions, but in practice this should make no difference. if function.name in self.getProcAddressFunctionNames: print ' _result = _wrapProcAddress(%s, _result);' % (function.args[0].name,) print ' }' return Tracer.doInvokeFunction(self, function)
def doInvokeFunction(self, function): # Same as invokeFunction() but called both when trace is enabled or disabled. # # Used to modify the behavior of GL entry-points. # Override GL extensions if function.name in ('glGetString', 'glGetIntegerv', 'glGetStringi'): Tracer.doInvokeFunction(self, function, prefix = 'gltrace::_', suffix = '_override') return # We implement GL_EXT_debug_marker, GL_GREMEDY_*, etc., and not the # driver if function.name in self.marker_functions: return if function.name in self.getProcAddressFunctionNames: else_ = '' for marker_function in self.marker_functions: if self.api.getFunctionByName(marker_function): print ' %sif (strcmp("%s", (const char *)%s) == 0) {' % (else_, marker_function, function.args[0].name) print ' _result = (%s)&%s;' % (function.type, marker_function) print ' }' else_ = 'else ' print ' %s{' % else_ Tracer.doInvokeFunction(self, function) # Replace function addresses with ours # XXX: Doing this here instead of wrapRet means that the trace will # contain the addresses of the wrapper functions, and not the real # functions, but in practice this should make no difference. if function.name in self.getProcAddressFunctionNames: print ' _result = _wrapProcAddress(%s, _result);' % (function.args[0].name,) print ' }' return Tracer.doInvokeFunction(self, function)