summaryrefslogtreecommitdiff
path: root/dispatch/glproc.py
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-07-17 20:42:35 +0100
committerJosé Fonseca <jfonseca@vmware.com>2014-07-23 11:50:02 +0100
commite91f5bc011868db5f5a1c1e10bf718a01c75992e (patch)
tree4613a6fa8009a31dd10299a30205bd18307ae591 /dispatch/glproc.py
parent790b5522362b90373c413692cae16a5035fa81c3 (diff)
gldispatch: Don't inline dispatch of GL functions.
Inlining the dispatch functions lead to slow compilation times, and probably slower runtime due to code bloat.
Diffstat (limited to 'dispatch/glproc.py')
-rw-r--r--dispatch/glproc.py72
1 files changed, 49 insertions, 23 deletions
diff --git a/dispatch/glproc.py b/dispatch/glproc.py
index 4ae97223..dd085c30 100644
--- a/dispatch/glproc.py
+++ b/dispatch/glproc.py
@@ -29,6 +29,8 @@ covers all the functions we support.
"""
+import sys
+
from dispatch import Dispatcher
import specs.stdapi as stdapi
from specs.glapi import glapi
@@ -491,18 +493,6 @@ public_symbols.update([
class GlDispatcher(Dispatcher):
- def header(self):
- print '''
-#if defined(_WIN32)
-extern HMODULE _libGlHandle;
-#else
-extern void * _libGlHandle;
-#endif
-
-void * _getPublicProcAddress(const char *procName);
-void * _getPrivateProcAddress(const char *procName);
-'''
-
def isFunctionPublic(self, module, function):
return function.name in public_symbols or function.name.startswith('CGL')
@@ -540,37 +530,73 @@ void * _getPrivateProcAddress(const char *procName);
if __name__ == '__main__':
+ decl, impl = sys.argv[1:]
+
+ sys.stdout = open(decl, 'wt')
print
print '#ifndef _GLPROC_HPP_'
print '#define _GLPROC_HPP_'
- print
+ print
print '#include "glimports.hpp"'
- print '#include "os.hpp"'
print
- dispatcher = GlDispatcher()
+ print '#if defined(_WIN32)'
+ print 'extern HMODULE _libGlHandle;'
+ print '#else'
+ print 'extern void * _libGlHandle;'
+ print '#endif'
print
- dispatcher.header()
+ print 'void * _getPublicProcAddress(const char *procName);'
+ print 'void * _getPrivateProcAddress(const char *procName);'
print
- dispatcher.dispatchModule(eglapi)
+ dispatcher = GlDispatcher()
+ print
+ dispatcher.dispatchModuleDecl(eglapi)
print
print '#if defined(_WIN32)'
print
- dispatcher.dispatchModule(wglapi)
+ dispatcher.dispatchModuleDecl(wglapi)
print
print '#elif defined(__APPLE__)'
print
- dispatcher.dispatchModule(cglapi)
+ dispatcher.dispatchModuleDecl(cglapi)
print
print '#elif defined(HAVE_X11)'
print
- dispatcher.dispatchModule(glxapi)
+ dispatcher.dispatchModuleDecl(glxapi)
print
print '#endif'
print
- dispatcher.dispatchModule(glapi)
+ dispatcher.dispatchModuleDecl(glapi)
print
- dispatcher.dispatchModule(glesapi)
+ dispatcher.dispatchModuleDecl(glesapi)
print
-
print '#endif /* !_GLPROC_HPP_ */'
print
+
+ sys.stdout = open(impl, 'wt')
+ print
+ print '#include "glproc.hpp"'
+ print '#include "os.hpp"'
+ print
+ dispatcher = GlDispatcher()
+ print
+ dispatcher.dispatchModuleImpl(eglapi)
+ print
+ print '#if defined(_WIN32)'
+ print
+ dispatcher.dispatchModuleImpl(wglapi)
+ print
+ print '#elif defined(__APPLE__)'
+ print
+ dispatcher.dispatchModuleImpl(cglapi)
+ print
+ print '#elif defined(HAVE_X11)'
+ print
+ dispatcher.dispatchModuleImpl(glxapi)
+ print
+ print '#endif'
+ print
+ dispatcher.dispatchModuleImpl(glapi)
+ print
+ dispatcher.dispatchModuleImpl(glesapi)
+ print