summaryrefslogtreecommitdiff
path: root/wrappers
diff options
context:
space:
mode:
authorPeter Lohrmann <PeterL@valvesoftware.com>2013-06-03 14:58:41 -0700
committerJosé Fonseca <jfonseca@vmware.com>2013-10-08 16:47:02 -0700
commit0b5b75e507df681260ea9c43b142ee48fff780c5 (patch)
treed171040433bd51bf3605084a2c5a11c5cd3dd881 /wrappers
parenteb8f6114572db0117d021584e18a687f7a7a9bae (diff)
trace: Additional support for GL_KHR_debug, GL_ARB_debug_output, and GL_AMD_debug_output.
* Mark some of the entrypoints as having sideeffects so that they will be replayed and can be seen in other 3rd party tools. * Add the three additional extensions to the supported extensions list. * Create new list of debug_entrypoints which may be implemented by a driver. These entrypoints need to be handled differently from the marker_entrypoints in that debug_entrypoints may be exposed by the driver via wglGetProcAddress and apitrace should pass the calls along if they are available. The marker_extensions are not expected to be implemented by the driver, so wglGetProcAddress(..) does not need to be called on them. Note that even though this causes apitrace to return the extension strings, the full extension implementation has not been completed, but the entrypoints are exposed for the application to call. Signed-off-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'wrappers')
-rw-r--r--wrappers/glcaps.cpp3
-rw-r--r--wrappers/gltrace.py42
2 files changed, 44 insertions, 1 deletions
diff --git a/wrappers/glcaps.cpp b/wrappers/glcaps.cpp
index 1f2bbe6b..43d5e5d3 100644
--- a/wrappers/glcaps.cpp
+++ b/wrappers/glcaps.cpp
@@ -57,6 +57,9 @@ static const char *
extraExtension_stringsFull[] = {
"GL_GREMEDY_string_marker",
"GL_GREMEDY_frame_terminator",
+ "GL_ARB_debug_output",
+ "GL_AMD_debug_output",
+ "GL_KHR_debug",
};
static const char *
diff --git a/wrappers/gltrace.py b/wrappers/gltrace.py
index e73c5918..7bf2a350 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