X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=wrappers%2Fgltrace.py;h=7bf2a3507a4169dec9b56c8ef5cdcf055fb09408;hb=0b5b75e507df681260ea9c43b142ee48fff780c5;hp=e73c5918140dcc63e6030cf7fb3b762ebff304eb;hpb=2cfa02c89ce8779e328aecdcc4eeecce6c9a2dbf;p=apitrace diff --git a/wrappers/gltrace.py b/wrappers/gltrace.py index e73c591..7bf2a35 100644 --- a/wrappers/gltrace.py +++ b/wrappers/gltrace.py @@ -329,9 +329,21 @@ class GlTracer(Tracer): Tracer.traceApi(self, api) print 'static %s _wrapProcAddress(%s procName, %s procPtr) {' % (retType, argType, retType) + + # Provide fallback functions to missing debug functions print ' if (!procPtr) {' - print ' return procPtr;' + else_ = '' + for function_name in self.debug_functions: + if self.api.getFunctionByName(function_name): + print ' %sif (strcmp("%s", (const char *)procName) == 0) {' % (else_, function_name) + print ' return (%s)&%s;' % (retType, function_name) + print ' }' + else_ = 'else ' + print ' %s{' % else_ + print ' return NULL;' + print ' }' print ' }' + for function in api.getAllFunctions(): ptype = function_pointer_type(function) pvalue = function_pointer_value(function) @@ -684,6 +696,8 @@ class GlTracer(Tracer): Tracer.traceFunctionImplBody(self, function) + # These entrypoints are only expected to be implemented by tools; + # drivers will probably not implement them. marker_functions = [ # GL_GREMEDY_string_marker 'glStringMarkerGREMEDY', @@ -695,6 +709,32 @@ class GlTracer(Tracer): 'glPopGroupMarkerEXT', ] + # These entrypoints may be implemented by drivers, but are also very useful + # for debugging / analysis tools. + debug_functions = [ + # GL_KHR_debug + 'glDebugMessageControl', + 'glDebugMessageInsert', + 'glDebugMessageCallback', + 'glGetDebugMessageLog', + 'glPushDebugGroup', + 'glPopDebugGroup', + 'glObjectLabel', + 'glGetObjectLabel', + 'glObjectPtrLabel', + 'glGetObjectPtrLabel', + # GL_ARB_debug_output + 'glDebugMessageControlARB', + 'glDebugMessageInsertARB', + 'glDebugMessageCallbackARB', + 'glGetDebugMessageLogARB', + # GL_AMD_debug_output + 'glDebugMessageEnableAMD', + 'glDebugMessageInsertAMD', + 'glDebugMessageCallbackAMD', + 'glGetDebugMessageLogAMD', + ] + def invokeFunction(self, function): if function.name in ('glLinkProgram', 'glLinkProgramARB'): # These functions have been dispatched already