# These functions have been dispatched already
return
+ Tracer.invokeFunction(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 ('glXGetProcAddress', 'glXGetProcAddressARB', 'wglGetProcAddress'):
+ if function.name in self.getProcAddressFunctionNames:
else_ = ''
for marker_function in self.marker_functions:
if self.api.getFunctionByName(marker_function):
print ' }'
else_ = 'else '
print ' %s{' % else_
- Tracer.invokeFunction(self, function)
- print ' }'
- return
+ Tracer.doInvokeFunction(self, function)
- # Override GL extensions
- if function.name in ('glGetString', 'glGetIntegerv', 'glGetStringi'):
- Tracer.invokeFunction(self, function, prefix = 'gltrace::_', suffix = '_override')
+ # 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.invokeFunction(self, function)
+ Tracer.doInvokeFunction(self, function)
buffer_targets = [
'ARRAY_BUFFER',
def wrapRet(self, function, instance):
Tracer.wrapRet(self, function, instance)
- # Replace function addresses with ours
- if function.name in self.getProcAddressFunctionNames:
- print ' %s = _wrapProcAddress(%s, %s);' % (instance, function.args[0].name, instance)
-
# Keep track of buffer mappings
if function.name in ('glMapBuffer', 'glMapBufferARB'):
print ' struct buffer_mapping *mapping = get_buffer_mapping(target);'