diff --git a/OpenGL/GL/AMD/performance_monitor.py b/OpenGL/GL/AMD/performance_monitor.py index 08c48184..caab1a57 100644 --- a/OpenGL/GL/AMD/performance_monitor.py +++ b/OpenGL/GL/AMD/performance_monitor.py @@ -66,6 +66,6 @@ def glInitPerformanceMonitorAMD(): glGetPerfMonitorCounterDataAMD=wrapper.wrapper(glGetPerfMonitorCounterDataAMD).setOutput( 'bytesWritten',size=(1,),orPassIn=True ).setOutput( - 'data',size=lambda x:(x,),pnameArg='dataSize / 4',orPassIn=True + 'data',size=lambda x: (x//4),pnameArg='dataSize',orPassIn=True ) ### END AUTOGENERATED SECTION \ No newline at end of file diff --git a/OpenGL/GL/ARB/robustness.py b/OpenGL/GL/ARB/robustness.py index d09ea97a..1e97e04c 100644 --- a/OpenGL/GL/ARB/robustness.py +++ b/OpenGL/GL/ARB/robustness.py @@ -124,19 +124,19 @@ def glInitRobustnessARB(): 'img',size=lambda x:(x,),pnameArg='bufSize',orPassIn=True ) glGetnUniformfvARB=wrapper.wrapper(glGetnUniformfvARB).setOutput( - 'params',size=lambda x:(x,),pnameArg='bufSize / 4',orPassIn=True + 'params',size=lambda x: (x//4),pnameArg='bufSize',orPassIn=True ) glGetnUniformivARB=wrapper.wrapper(glGetnUniformivARB).setOutput( - 'params',size=lambda x:(x,),pnameArg='bufSize / 4',orPassIn=True + 'params',size=lambda x: (x//4),pnameArg='bufSize',orPassIn=True ) glGetnUniformuivARB=wrapper.wrapper(glGetnUniformuivARB).setOutput( - 'params',size=lambda x:(x,),pnameArg='bufSize / 4',orPassIn=True + 'params',size=lambda x: (x//4),pnameArg='bufSize',orPassIn=True ) glGetnUniformdvARB=wrapper.wrapper(glGetnUniformdvARB).setOutput( - 'params',size=lambda x:(x,),pnameArg='bufSize / 8',orPassIn=True + 'params',size=lambda x: (x//8),pnameArg='bufSize',orPassIn=True ) glGetnMapdvARB=wrapper.wrapper(glGetnMapdvARB).setOutput( - 'v',size=lambda x:(x,),pnameArg='bufSize / 8',orPassIn=True + 'v',size=lambda x: (x//8),pnameArg='bufSize',orPassIn=True ) glGetnMapfvARB=wrapper.wrapper(glGetnMapfvARB).setOutput( 'v',size=lambda x:(x,),pnameArg='bufSize',orPassIn=True @@ -145,7 +145,7 @@ def glInitRobustnessARB(): 'v',size=lambda x:(x,),pnameArg='bufSize',orPassIn=True ) glGetnPixelMapfvARB=wrapper.wrapper(glGetnPixelMapfvARB).setOutput( - 'values',size=lambda x:(x,),pnameArg='bufSize / 4',orPassIn=True + 'values',size=lambda x: (x//4),pnameArg='bufSize',orPassIn=True ) glGetnPixelMapuivARB=wrapper.wrapper(glGetnPixelMapuivARB).setOutput( 'values',size=lambda x:(x,),pnameArg='bufSize',orPassIn=True diff --git a/OpenGL/GLES2/AMD/performance_monitor.py b/OpenGL/GLES2/AMD/performance_monitor.py index 839dad1a..ec2ec5df 100644 --- a/OpenGL/GLES2/AMD/performance_monitor.py +++ b/OpenGL/GLES2/AMD/performance_monitor.py @@ -66,6 +66,6 @@ def glInitPerformanceMonitorAMD(): glGetPerfMonitorCounterDataAMD=wrapper.wrapper(glGetPerfMonitorCounterDataAMD).setOutput( 'bytesWritten',size=(1,),orPassIn=True ).setOutput( - 'data',size=lambda x:(x,),pnameArg='dataSize / 4',orPassIn=True + 'data',size=lambda x: (x//4),pnameArg='dataSize',orPassIn=True ) ### END AUTOGENERATED SECTION \ No newline at end of file diff --git a/src/readme.md b/src/README.md similarity index 100% rename from src/readme.md rename to src/README.md diff --git a/src/codegenerator.py b/src/codegenerator.py index eca03227..5f7ca811 100644 --- a/src/codegenerator.py +++ b/src/codegenerator.py @@ -388,8 +388,19 @@ def output_wrapping(self): % locals() ) elif isinstance(dependency, xmlreg.Dynamicsize): + if '/' in dependency: + fragments = [x.strip() for x in dependency.split('/')] + functor = 'lambda x: (x//%s)' % (fragments[1]) + dependency = fragments[0] + elif '*' in dependency: + fragments = [x.strip() for x in dependency.split('/')] + functor = 'lambda x: (x*%s)' % (fragments[1]) + dependency = fragments[0] + else: + functor = 'lambda x:(x,)' + base.append( - '.setOutput(\n %(param)r,size=lambda x:(x,),pnameArg=%(dependency)r,orPassIn=True\n)' + '.setOutput(\n %(param)r,size=%(functor)s,pnameArg=%(dependency)r,orPassIn=True\n)' % locals() ) elif isinstance(dependency, xmlreg.Multiple): diff --git a/src/xml_generate.py b/src/xml_generate.py index 599fe57a..82dff49f 100755 --- a/src/xml_generate.py +++ b/src/xml_generate.py @@ -4,38 +4,43 @@ import os, logging, subprocess, glob import xmlreg, codegenerator import ctypetopytype -log = logging.getLogger( 'xml-generate' ) + +log = logging.getLogger('xml-generate') KHRONOS_URL = 'https://github.com/KhronosGroup/OpenGL-Registry.git' -KHRONOS_API = os.path.join( os.path.dirname(__file__), 'khronosapi' ) +KHRONOS_API = os.path.join(os.path.dirname(__file__), 'khronosapi') + + +def get_khronos(khronosapi): + if not os.path.exists(khronosapi): + log.info("Cloning the Khronos API into %s", khronosapi) + subprocess.check_call(['git', 'clone', KHRONOS_URL, khronosapi]) + else: + log.info("Pulling new commits from Khronos API") + subprocess.check_call(['git', 'pull', '--ff-only'], cwd=khronosapi) -def get_khronos( khronosapi ): - if not os.path.exists( khronosapi ): - subprocess.check_call(['git','clone', KHRONOS_URL, khronosapi ]) def main(khronosapi=None): khronosapi = khronosapi or KHRONOS_API - get_khronos( khronosapi ) - - files = sorted( glob.glob( os.path.join( khronosapi, 'xml','*.xml' ) )) + get_khronos(khronosapi) + + files = sorted(glob.glob(os.path.join(khronosapi, 'xml', '*.xml'))) for file in files: - generate_for_file( file ) - -def generate_for_file( filename ): - log.info( 'Starting file: %s', filename ) - registry = xmlreg.parse( filename ) - generator = codegenerator.Generator( - registry, - ctypetopytype.ctype_to_pytype - ) - for name,feature in registry.feature_set.items(): + generate_for_file(file) + + +def generate_for_file(filename): + log.info('Starting file: %s', filename) + registry = xmlreg.parse(filename) + generator = codegenerator.Generator(registry, ctypetopytype.ctype_to_pytype) + for name, feature in registry.feature_set.items(): print(feature.name, feature.api) - generator.module( feature ) - for name,extension in registry.extension_set.items(): + generator.module(feature) + for name, extension in registry.extension_set.items(): print(extension.name, extension.apis) - generator.module( extension ) + generator.module(extension) + if __name__ == "__main__": - logging.basicConfig( level=logging.INFO ) + logging.basicConfig(level=logging.INFO) main() -