]> git.cworth.org Git - apitrace/blobdiff - cgltrace.py
Move local writer definitions to a separate header file.
[apitrace] / cgltrace.py
index 33765f9b8d3b1ebfae3e81656c994e6434cc3cac..e2e98745fe4808b2fa309d6a447bb27d973c76f1 100644 (file)
@@ -27,9 +27,9 @@
 """Cgl tracing generator."""
 
 
-from stdapi import API
-from glapi import glapi
-from cglapi import cglapi
+from specs.stdapi import API
+from specs.glapi import glapi
+from specs.cglapi import cglapi
 from gltrace import GlTracer
 
 
@@ -45,12 +45,7 @@ if __name__ == '__main__':
     print '#include <stdlib.h>'
     print '#include <string.h>'
     print
-    print '#ifndef _GNU_SOURCE'
-    print '#define _GNU_SOURCE // for dladdr'
-    print '#endif'
-    print '#include <dlfcn.h>'
-    print
-    print '#include "trace_write.hpp"'
+    print '#include "trace_writer_local.hpp"'
     print
     print '// To validate our prototypes'
     print '#define GL_GLEXT_PROTOTYPES'
@@ -67,48 +62,6 @@ if __name__ == '__main__':
 
     print r'''
 
-
-/*
- * Handle to the true libGL.so
- */
-static void *libgl_handle = NULL;
-
-
-/*
- * Lookup a libGL symbol
- */
-static void * __dlsym(const char *symbol)
-{
-    void *result;
-    if (!libgl_handle) {
-        const char * libgl_filename;
-
-        /* 
-         * Unfortunately we can't just dlopen
-         * /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib
-         * because DYLD_LIBRARY_PATH takes precedence, even for absolute paths.
-         */
-        libgl_filename = "libGL.system.dylib";
-
-        libgl_handle = dlopen(libgl_filename, RTLD_LOCAL | RTLD_NOW | RTLD_FIRST);
-        if (!libgl_handle) {
-            OS::DebugMessage("error: couldn't load %s\n", libgl_filename);
-            return NULL;
-        }
-    }
-
-    result = dlsym(libgl_handle, symbol);
-
-    if (result == dlsym(RTLD_SELF, symbol)) {
-        OS::DebugMessage("error: symbol lookup recursion\n");
-        OS::Abort();
-        return NULL;
-    }
-
-    return result;
-}
-
-
 PUBLIC
 void * gll_noop = 0;