]> git.cworth.org Git - apitrace/blobdiff - gltrace.py
Catch exceptions on Windows.
[apitrace] / gltrace.py
index 4280b91f2eac4fb26832de62d06c7047422a0fcd..af5714242e5a7a148a1befc4d928bd929000405b 100644 (file)
@@ -107,6 +107,8 @@ class GlTracer(Tracer):
     def header(self, api):
         Tracer.header(self, api)
 
+        print '#include "gltrace.hpp"'
+        print
         print '// Whether user arrays were used'
         print 'static bool __user_arrays = false;'
         print 'static bool __user_arrays_arb = false;'
@@ -121,7 +123,7 @@ class GlTracer(Tracer):
         print '};'
         print
         print 'static vertex_attrib __get_vertex_attrib(void) {'
-        print '    if (__user_arrays_arb) {'
+        print '    if (__user_arrays_arb || __user_arrays_nv) {'
         print '        GLboolean __vertex_program = GL_FALSE;'
         print '        __glGetBooleanv(GL_VERTEX_PROGRAM_ARB, &__vertex_program);'
         print '        if (__vertex_program) {'
@@ -492,11 +494,32 @@ class GlTracer(Tracer):
 
         Tracer.trace_function_impl_body(self, function)
 
+    gremedy_functions = [
+        'glStringMarkerGREMEDY',
+        'glFrameTerminatorGREMEDY',
+    ]
+
     def dispatch_function(self, function):
         if function.name in ('glLinkProgram', 'glLinkProgramARB'):
             # These functions have been dispatched already
             return
 
+        # We implement the GREMEDY extensions, not the driver
+        if function.name in self.gremedy_functions:
+            return
+
+        if function.name in ('glXGetProcAddress', 'glXGetProcAddressARB', 'wglGetProcAddress'):
+            if_ = 'if'
+            for gremedy_function in self.gremedy_functions:
+                print '    %s (strcmp("%s", (const char *)%s) == 0) {' % (if_, gremedy_function, function.args[0].name)
+                print '        __result = (%s)&%s;' % (function.type, gremedy_function)
+                print '    }'
+                if_ = 'else if'
+            print '    else {'
+            Tracer.dispatch_function(self, function)
+            print '    }'
+            return
+
         Tracer.dispatch_function(self, function)
 
     def emit_memcpy(self, dest, src, length):
@@ -523,6 +546,17 @@ class GlTracer(Tracer):
 
     def wrap_ret(self, function, instance):
         Tracer.wrap_ret(self, function, instance)
+
+        if function.name == 'glGetString':
+            print '    if (__result) {'
+            print '        switch (name) {'
+            print '        case GL_EXTENSIONS:'
+            print '            __result = gltrace::translateExtensionsString(__result);'
+            print '            break;'
+            print '        default:'
+            print '            break;'
+            print '        }'
+            print '    }'
             
         if function.name in ('glMapBuffer', 'glMapBufferARB'):
             print '    struct buffer_mapping *mapping = get_buffer_mapping(target);'