diff --git a/src/codegenerator.py b/src/codegenerator.py index 10d458a8..eca03227 100644 --- a/src/codegenerator.py +++ b/src/codegenerator.py @@ -1,41 +1,49 @@ import logging, os, urllib, traceback, textwrap, keyword import xmlreg from OpenGL._bytes import as_8_bit, as_str, unicode, as_unicode -HERE = os.path.join( os.path.dirname(__file__)) -log = logging.getLogger( __name__ ) -AUTOGENERATION_SENTINEL = """### DO NOT EDIT above the line "END AUTOGENERATED SECTION" below!""" + +HERE = os.path.join(os.path.dirname(__file__)) +log = logging.getLogger(__name__) +AUTOGENERATION_SENTINEL = ( + """### DO NOT EDIT above the line "END AUTOGENERATED SECTION" below!""" +) AUTOGENERATION_SENTINEL_END = """### END AUTOGENERATED SECTION""" -def nameToPathMinusGL( name ): - return "/".join( name.split( '_',2 )[1:] ) + +def nameToPathMinusGL(name): + return "/".join(name.split('_', 2)[1:]) + + def prefix_split(name): - return name.split( '_',2 )[1:] -def indent( text, indent='\t' ): - return "\n".join([ - '%s%s'%(indent,line) - for line in text.splitlines() - ]) - -class Generator( object ): - targetDirectory = os.path.join( HERE, '..','OpenGL') - rawTargetDirectory = os.path.join( HERE,'..','OpenGL','raw') + return name.split('_', 2)[1:] + + +def indent(text, indent='\t'): + return "\n".join(['%s%s' % (indent, line) for line in text.splitlines()]) + + +class Generator(object): + targetDirectory = os.path.join(HERE, '..', 'OpenGL') + rawTargetDirectory = os.path.join(HERE, '..', 'OpenGL', 'raw') prefix = 'GL' dll = '_p.PLATFORM.GL' includeOverviews = True - - def __init__( self, registry, type_translator ): + + def __init__(self, registry, type_translator): self.registry = registry self.type_translator = type_translator - def module( self, module ): - if hasattr( module, 'apis' ): + + def module(self, module): + if hasattr(module, 'apis'): for api in module.apis: if api != 'glcore': - gen = ModuleGenerator(module,self, api) + gen = ModuleGenerator(module, self, api) gen.generate() else: - gen = ModuleGenerator(module,self) + gen = ModuleGenerator(module, self) gen.generate() return gen + GLGET_PARAM_GROUPS = [ #'MaterialParameter', #'PixelMap', @@ -56,43 +64,49 @@ def _L(*args): _glget_size_mapping = _m = {} %(elements)s ''' - def group_sizes( self ): + + def group_sizes(self): """Generate a group-sizes data-table for the given group-name""" result = [] - for enum_name, size in sorted( self.glGetSizes.items(), key = lambda x: (bool(x[1]),x[0]) ): - value = self.registry.enumeration_set.get( enum_name ) + for enum_name, size in sorted( + self.glGetSizes.items(), key=lambda x: (bool(x[1]), x[0]) + ): + value = self.registry.enumeration_set.get(enum_name) size = [x for x in size if x] comment = '' if not size: size = 'TODO' comment = '# ' else: - size = ''.join( size ) + size = ''.join(size) if value is None: # common in cases where GL and GLES constants are updated together... - log.debug( 'Unrecognized constant: %s in GLGet section', enum_name ) + log.debug('Unrecognized constant: %s in GLGet section', enum_name) else: value = value.value - result.append( - '%(comment)s_m[%(value)s] = %(size)s # %(enum_name)s'%locals() + result.append( + '%(comment)s_m[%(value)s] = %(size)s # %(enum_name)s' % locals() ) - elements = '\n'.join( result ) + elements = '\n'.join(result) prefix = self.prefix - return self.GL_GET_TEMPLATE%locals() - def enum( self, enum ): + return self.GL_GET_TEMPLATE % locals() + + def enum(self, enum): comment = '' try: - int( enum.value, 0 ) + int(enum.value, 0) except ValueError: comment = '# ' - return '%s%s=_C(%r,%s)'%(comment, enum.name,enum.name,enum.value) - def safe_name( self, name ): - if keyword.iskeyword( name ): + return '%s%s=_C(%r,%s)' % (comment, enum.name, enum.name, enum.value) + + def safe_name(self, name): + if keyword.iskeyword(name): return name + '_' return name - def function( self, function ): + + def function(self, function): """Produce a declaration for this function in ctypes format""" - returnType = self.type_translator( function.returnType ) + returnType = self.type_translator(function.returnType) if returnType == 'arrays.GLbyteArray': returnType = 'ctypes.c_char_p' if function.argTypes: @@ -103,74 +117,73 @@ def function( self, function ): argNames = ','.join([self.safe_name(n) for n in function.argNames]) else: argNames = '' - arguments = ', '.join([ - '%s %s'%(t,self.safe_name(n)) - for (t,n) in zip( function.argTypes,function.argNames ) - ]) - name = function.name - if returnType.strip() in ('_cs.GLvoid', '_cs.void','void'): + arguments = ', '.join( + [ + '%s %s' % (t, self.safe_name(n)) + for (t, n) in zip(function.argTypes, function.argNames) + ] + ) + name = function.name + if returnType.strip() in ('_cs.GLvoid', '_cs.void', 'void'): returnType = pyReturn = 'None' else: pyReturn = function.returnType - doc = '%(name)s(%(arguments)s) -> %(pyReturn)s'%locals() -# log.info( '%s', doc ) - formatted= self.FUNCTION_TEMPLATE%locals() + doc = '%(name)s(%(arguments)s) -> %(pyReturn)s' % locals() + # log.info( '%s', doc ) + formatted = self.FUNCTION_TEMPLATE % locals() return formatted + FUNCTION_TEMPLATE = """@_f @_p.types(%(returnType)s,%(argTypes)s) def %(name)s(%(argNames)s):pass""" _glGetSizes = None + @property - def glGetSizes( self ): + def glGetSizes(self): if self._glGetSizes is None: self._glGetSizes = self.loadGLGetSizes() return self._glGetSizes - def loadGLGetSizes( self ): + + def loadGLGetSizes(self): """Load manually-generated table of glGet* sizes""" table = {} try: lines = [ line.split('\t') - for line in open( os.path.join( HERE, 'glgetsizes.csv') ).read().splitlines() + for line in open(os.path.join(HERE, 'glgetsizes.csv')) + .read() + .splitlines() ] except IOError: - pass + pass else: for line in lines: if line and line[0]: - value = [ - v for v in [ - v.strip('"') for v in line[1:] - ] - if v - ] + value = [v for v in [v.strip('"') for v in line[1:]] if v] if value: table[line[0].strip('"').strip()] = value # now make sure everything registered in the xml file is present... output_group_names = {} for function in self.registry.command_set.values(): - output_group_names.update( function.output_groups ) + output_group_names.update(function.output_groups) for output_group in output_group_names.keys(): - log.debug( 'Output parameter group: %s', output_group ) - for name in self.registry.enum_groups.get(output_group,[]): + log.debug('Output parameter group: %s', output_group) + for name in self.registry.enum_groups.get(output_group, []): if name not in table: - log.info( 'New %s value: %r', output_group, name ) + log.info('New %s value: %r', output_group, name) table[name] = '' return table - def saveGLGetSizes( self ): + + def saveGLGetSizes(self): """Save out sorted list of glGet sizes to disk""" - items = self.glGetSizes.items() + items = list(self.glGetSizes.items()) items.sort() - data = "\n".join([ - '%s\t%s'%( - key,"\t".join(value) - ) - for (key,value) in items - ]) - open( os.path.join( HERE, 'glgetsizes.csv'),'w').write( data ) + data = "\n".join(['%s\t%s' % (key, "\t".join(value)) for (key, value) in items]) + open(os.path.join(HERE, 'glgetsizes.csv'), 'w').write(data) -class ModuleGenerator( object ): + +class ModuleGenerator(object): ROOT_EXTENSION_SOURCE = 'http://www.opengl.org/registry/specs/' RAW_MODULE_TEMPLATE = """'''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays @@ -214,83 +227,100 @@ def glInit%(camelModule)s%(owner)s(): %(output_wrapping)s """ dll = '_p.PLATFORM.GL' - def __init__( self, registry, overall, api=None ): - self.registry = registry + + def __init__(self, registry, overall, api=None): + self.registry = registry self.overall = overall name = registry.name - if name in ('GL_ES_VERSION_3_1','GL_ES_VERSION_3_0'): + if name in ('GL_ES_VERSION_3_1', 'GL_ES_VERSION_3_0'): api = 'gles3' - name = 'GLES3'+name[5:] + name = 'GLES3' + name[5:] if api: self.prefix = api.upper() else: - if hasattr( self.registry, 'api' ): + if hasattr(self.registry, 'api'): self.prefix = self.registry.api.upper() else: self.prefix = name.split('_')[0] - name = name.split('_',1)[1] + name = name.split('_', 1)[1] try: - self.owner, self.module = name.split('_',1) - self.sentinelConstant = '%s_%s'%(self.owner,self.module) - + self.owner, self.module = name.split('_', 1) + self.sentinelConstant = '%s_%s' % (self.owner, self.module) + except ValueError: - if name.endswith( 'SGIX' ): + if name.endswith('SGIX'): self.prefix = "GL" self.owner = 'SGIX' self.module = name[3:-4] - self.sentinelConstant = '%s%s'%(self.module,self.owner) + self.sentinelConstant = '%s%s' % (self.module, self.owner) else: - log.error( """Unable to parse module name: %s""", name ) + log.error("""Unable to parse module name: %s""", name) raise - self.dll = '_p.PLATFORM.%s'%(self.prefix,) + self.dll = '_p.PLATFORM.%s' % (self.prefix,) if self.module[0].isdigit(): - self.module = '%s_%s'%(self.prefix,self.module,) + self.module = '%s_%s' % ( + self.prefix, + self.module, + ) if self.module == 'async': self.module = 'async_' self.camelModule = "".join([x.title() for x in self.module.split('_')]) self.rawModule = self.module - + self.rawOwner = self.owner while self.owner and self.owner[0].isdigit(): self.owner = self.owner[1:] - self.rawPathName = os.path.join( self.overall.rawTargetDirectory, self.prefix, self.owner, self.module+'.py' ) - self.pathName = os.path.join( self.overall.targetDirectory, self.prefix, self.owner, self.module+'.py' ) - - self.constantModule = '%(prefix)s_%(owner)s_%(rawModule)s'%self + self.rawPathName = os.path.join( + self.overall.rawTargetDirectory, + self.prefix, + self.owner, + self.module + '.py', + ) + self.pathName = os.path.join( + self.overall.targetDirectory, self.prefix, self.owner, self.module + '.py' + ) + + self.constantModule = '%(prefix)s_%(owner)s_%(rawModule)s' % self specification = self.getSpecification() self.constantsFromSpec() self.overview = '' if self.overall.includeOverviews: - for title,section in specification.blocks( specification.source ): - if title.startswith( 'Overview' ): - if isinstance(section,bytes): - section = section.decode('latin-1') # seems not to be utf in at lest some cases - self.overview = 'Overview (from the spec)\n%s\n\n'%( - indent( + for title, section in specification.blocks(specification.source): + if title.startswith('Overview'): + if isinstance(section, bytes): + section = section.decode( + 'latin-1' + ) # seems not to be utf in at lest some cases + self.overview = 'Overview (from the spec)\n%s\n\n' % ( + indent( as_unicode( as_str(section) - .replace('\xd4','O') - .replace('\xd5','O') - ).encode( 'ascii', 'ignore' ) - .decode( 'ascii', 'ignore' ) + .replace('\xd4', 'O') + .replace('\xd5', 'O') + ) + .encode('ascii', 'ignore') + .decode('ascii', 'ignore') ) ) break - def __getitem__( self, key ): + + def __getitem__(self, key): try: - return getattr( self, key ) + return getattr(self, key) except AttributeError: - raise KeyError( key ) - def __getattr__( self, key ): + raise KeyError(key) + + def __getattr__(self, key): if key not in ('registry',): - return getattr( self.registry, key ) + return getattr(self.registry, key) + @property - def extra_imports( self ): + def extra_imports(self): if self.name == 'GL_VERSION_1_1': # spec files have not properly separated out these two... return '# Spec mixes constants from 1.0 and 1.1\nfrom OpenGL.raw.GL.VERSION.GL_1_0 import *' return '' - + def constantsFromSpec(self, spec=None): """Examine spec text looking for new constants...""" spec = spec or self.getSpecification() @@ -303,118 +333,161 @@ def constantsFromSpec(self, spec=None): try: value = int(value, 16) except ValueError: - continue + continue short_key = '_'.join(key.split("_")[:-1]) if short_key in table: short_def = self.overall.registry.enumeration_set.get(short_key) if short_def and int(short_def.value, 16) == value: - key = short_def.name + key = short_def.name if not key in table: - table[key] = ['(1,)', '#TODO Review %s'%(self.specFile())] + table[key] = ['(1,)', '#TODO Review %s' % (self.specFile())] changed = True if changed: self.overall.saveGLGetSizes() - def shouldReplace( self ): + + def shouldReplace(self): """Should we replace the given filename?""" filename = self.pathName - if not os.path.isfile( - filename - ): + if not os.path.isfile(filename): return True else: hasLines = 0 - for line in open( filename ): + for line in open(filename): if line.strip() == AUTOGENERATION_SENTINEL_END.strip(): return True hasLines = 1 if not hasLines: return True - log.warning( 'Not replacing %s (no AUTOGENERATION_SENTINEL_END found)', filename ) + log.warning( + 'Not replacing %s (no AUTOGENERATION_SENTINEL_END found)', filename + ) return False + @property - def output_wrapping( self ): + def output_wrapping(self): """Generate output wrapping statements for our various functions""" try: statements = [] for function in self.registry.commands(): dependencies = function.size_dependencies - if dependencies: # temporarily just do single-output functions... + if dependencies: # temporarily just do single-output functions... base = [] - for param,dependency in sorted(dependencies.items()): - param = as_str( param ) - if isinstance( dependency, xmlreg.Output ): - statements.append( '# %s.%s is OUTPUT without known output size'%( - function.name,param, - )) - if isinstance( dependency, xmlreg.Staticsize ): - base.append( '.setOutput(\n %(param)r,size=(%(dependency)r,),orPassIn=True\n)'%locals()) - elif isinstance( dependency, xmlreg.Dynamicsize ): - base.append( '.setOutput(\n %(param)r,size=lambda x:(x,),pnameArg=%(dependency)r,orPassIn=True\n)'%locals()) - elif isinstance( dependency, xmlreg.Multiple ): - pname,multiple = dependency - base.append( '.setOutput(\n %(param)r,size=lambda x:(x,%(multiple)s),pnameArg=%(pname)r,orPassIn=True\n)'%locals()) - elif isinstance( dependency, xmlreg.Compsize ): + for param, dependency in sorted(dependencies.items()): + param = as_str(param) + if isinstance(dependency, xmlreg.Output): + statements.append( + '# %s.%s is OUTPUT without known output size' + % ( + function.name, + param, + ) + ) + if isinstance(dependency, xmlreg.Staticsize): + base.append( + '.setOutput(\n %(param)r,size=(%(dependency)r,),orPassIn=True\n)' + % locals() + ) + elif isinstance(dependency, xmlreg.Dynamicsize): + base.append( + '.setOutput(\n %(param)r,size=lambda x:(x,),pnameArg=%(dependency)r,orPassIn=True\n)' + % locals() + ) + elif isinstance(dependency, xmlreg.Multiple): + pname, multiple = dependency + base.append( + '.setOutput(\n %(param)r,size=lambda x:(x,%(multiple)s),pnameArg=%(pname)r,orPassIn=True\n)' + % locals() + ) + elif isinstance(dependency, xmlreg.Compsize): if len(dependency) == 1: pname = dependency[0] - base.append( '.setOutput(\n %(param)r,size=_glgets._glget_size_mapping,pnameArg=%(pname)r,orPassIn=True\n)'%locals()) + base.append( + '.setOutput(\n %(param)r,size=_glgets._glget_size_mapping,pnameArg=%(pname)r,orPassIn=True\n)' + % locals() + ) else: - statements.append('# OUTPUT %s.%s COMPSIZE(%s) '%(function.name,param,', '.join(dependency)) ) - elif isinstance( dependency, xmlreg.StaticInput ): - base.append( '.setInputArraySize(\n %(param)r, %(dependency)s\n)'%locals()) - elif isinstance( dependency, (xmlreg.DynamicInput, xmlreg.MultipleInput, xmlreg.Input) ): + statements.append( + '# OUTPUT %s.%s COMPSIZE(%s) ' + % (function.name, param, ', '.join(dependency)) + ) + elif isinstance(dependency, xmlreg.StaticInput): + base.append( + '.setInputArraySize(\n %(param)r, %(dependency)s\n)' + % locals() + ) + elif isinstance( + dependency, + (xmlreg.DynamicInput, xmlreg.MultiplyInput, xmlreg.Input), + ): if dependency is None: - continue - statements.append( '# INPUT %s.%s size not checked against %s'%( - function.name, - param, - dependency - )) - base.append( '.setInputArraySize(\n %(param)r, None\n)'%locals()) + continue + statements.append( + '# INPUT %s.%s size not checked against %s' + % (function.name, param, dependency) + ) + base.append( + '.setInputArraySize(\n %(param)r, None\n)' % locals() + ) if base: - base.insert(0, '%s=wrapper.wrapper(%s)'%(function.name,function.name) ) - statements.append( ''.join(base )) - return '\n'.join( statements ) + base.insert( + 0, '%s=wrapper.wrapper(%s)' % (function.name, function.name) + ) + statements.append(''.join(base)) + return '\n'.join(statements) except Exception as err: traceback.print_exc() - import pdb + import pdb + pdb.set_trace() - - def get_constants( self ): + + def get_constants(self): functions = self.registry.enums() - functions.sort( key = lambda x: x.name ) + functions.sort(key=lambda x: x.name) return functions - @property - def init_function( self ): - return self.INIT_TEMPLATE%self + + @property + def init_function(self): + return self.INIT_TEMPLATE % self + @property - def constants( self ): + def constants(self): result = [] try: for function in self.get_constants(): - result.append( self.overall.enum( function ) ) + result.append(self.overall.enum(function)) return '\n'.join(result) except Exception: traceback.print_exc() raise + @property - def declarations( self ): + def declarations(self): functions = self.registry.commands() - functions.sort( key = lambda x: x.name ) + functions.sort(key=lambda x: x.name) result = [] for function in functions: - result.append( self.overall.function( function ) ) - return "\n".join( result ) - EXTENSION_BASE = os.path.join(HERE,'khronosapi','extensions') + result.append(self.overall.function(function)) + return "\n".join(result) + + EXTENSION_BASE = os.path.join(HERE, 'khronosapi', 'extensions') + def specFile(self): """Lookup the specification file for our extension""" - prefix,name = prefix_split(self.name) - specFile = os.path.join(self.EXTENSION_BASE,prefix,'%s_%s.txt'%( - prefix,name, - )) + prefix, name = prefix_split(self.name) + specFile = os.path.join( + self.EXTENSION_BASE, + prefix, + '%s_%s.txt' + % ( + prefix, + name, + ), + ) return specFile - def getSpecification( self ): + + def getSpecification(self): """Retrieve our specification document... - + Retrieves the .txt file which defines this specification, allowing us to review the document locally in order to provide a reasonable wrapping of it... @@ -423,75 +496,78 @@ def getSpecification( self ): return Specification('') specFile = self.specFile() if os.path.exists(specFile): - data = open( specFile,'rb' ).read() - return Specification( data ) + data = open(specFile, 'rb').read() + return Specification(data) else: - log.info("No spec-file in %s",specFile) + log.info("No spec-file in %s", specFile) return Specification('') - - def generate( self ): - for target in (self.rawPathName,self.pathName): - directory = os.path.dirname( target ) - if not os.path.exists( directory ): - log.warning( 'Creating target directory: %s', directory ) - os.makedirs( directory ) - if not os.path.isfile( os.path.join(directory, '__init__.py')): - open( os.path.join(directory, '__init__.py'),'w').write( + + def generate(self): + for target in (self.rawPathName, self.pathName): + directory = os.path.dirname(target) + if not os.path.exists(directory): + log.warning('Creating target directory: %s', directory) + os.makedirs(directory) + if not os.path.isfile(os.path.join(directory, '__init__.py')): + open(os.path.join(directory, '__init__.py'), 'w').write( '''"""OpenGL Extensions"""''' ) - + directory = os.path.dirname(self.rawPathName) current = '' toWrite = self.RAW_MODULE_TEMPLATE % self try: - current = open( self.rawPathName, 'r').read() + current = open(self.rawPathName, 'r').read() except Exception as err: - pass + pass if current.strip() != toWrite.strip(): - fh = open( self.rawPathName, 'w') - fh.write( toWrite ) + fh = open(self.rawPathName, 'w') + fh.write(toWrite) fh.close() - if isinstance( self.registry, xmlreg.Feature ): + if isinstance(self.registry, xmlreg.Feature): # this is a core feature... - target = os.path.join( self.overall.rawTargetDirectory, self.prefix,'_glgets.py' ) - open( target,'w' ).write( self.overall.group_sizes()) - if self.shouldReplace( ): + target = os.path.join( + self.overall.rawTargetDirectory, self.prefix, '_glgets.py' + ) + open(target, 'w').write(self.overall.group_sizes()) + if self.shouldReplace(): # now the final module with any included custom code... toWrite = self.FINAL_MODULE_TEMPLATE % self current = '' try: - current = open( self.pathName, 'r').read() + current = open(self.pathName, 'r').read() except Exception as err: - pass + pass else: - found = current.rfind( '\n'+AUTOGENERATION_SENTINEL_END ) + found = current.rfind('\n' + AUTOGENERATION_SENTINEL_END) if found >= -1: if current[:found].strip() == toWrite.strip(): # we aren't going to change anything... return False - found += len( '\n' + AUTOGENERATION_SENTINEL_END ) + found += len('\n' + AUTOGENERATION_SENTINEL_END) current = current[found:] else: current = '' try: - fh = open( self.pathName, 'w') + fh = open(self.pathName, 'w') except IOError as err: - log.warning( "Unable to create module for %r %s", self.name, err ) + log.warning("Unable to create module for %r %s", self.name, err) return False else: - fh.write( toWrite ) - fh.write( AUTOGENERATION_SENTINEL_END ) - fh.write( current ) + fh.write(toWrite) + fh.write(AUTOGENERATION_SENTINEL_END) + fh.write(current) fh.close() return True return False -class Specification( object ): - """Parser for parsing OpenGL specifications for interesting information - """ - def __init__( self, source ): + +class Specification(object): + """Parser for parsing OpenGL specifications for interesting information""" + + def __init__(self, source): """Store the source text for the specification""" - if isinstance(source,bytes): + if isinstance(source, bytes): try: self.source = source.decode('utf-8') except UnicodeDecodeError as err: @@ -499,7 +575,8 @@ def __init__( self, source ): else: self.source = source assert isinstance(self.source, unicode) - def blocks( self, data ): + + def blocks(self, data): """Retrieve the set of all blocks""" data = data.splitlines() title = [] @@ -507,40 +584,48 @@ def blocks( self, data ): for line in data: if line and line.lstrip() == line: if block: - yield "\n".join(title), textwrap.dedent( "\n".join(block) ) - title = [ ] - block = [ ] - title.append( line ) + yield "\n".join(title), textwrap.dedent("\n".join(block)) + title = [] + block = [] + title.append(line) else: - block.append( line ) + block.append(line) if block: - yield "\n".join(title), textwrap.dedent( "\n".join(block) ) - def constantBlocks( self ): + yield "\n".join(title), textwrap.dedent("\n".join(block)) + + def constantBlocks(self): """Retrieve the set of constant blocks""" - for title,block in self.blocks( self.source ): - if title and title.startswith( 'New Tokens' ): + for title, block in self.blocks(self.source): + if title and title.startswith('New Tokens'): yield block - def glGetConstants( self ): + + def glGetConstants(self): """Retrieve the set of constants which pass to glGet* functions""" table = {} for block in self.constantBlocks(): - for title, section in self.blocks( block ): + for title, section in self.blocks(block): for possible in ( - 'GetBooleanv','GetIntegerv',' of Get', - ' parameter of Get', + 'GetBooleanv', + 'GetIntegerv', + ' of Get', + ' parameter of Get', ): if possible in title: for line in section.splitlines(): line = line.strip().split() if len(line) == 2: - constant,value = line + constant, value = line constant = constant.strip(':') - table['GL_%s'%(constant,)] = value + table['GL_%s' % (constant,)] = value break return table -def download( url ): + +def download(url): """Download the given url, informing the user of what we're doing""" - log.info( 'Download: %r',url,) - file = urllib.urlopen( url ) + log.info( + 'Download: %r', + url, + ) + file = urllib.urlopen(url) return file.read() diff --git a/src/glgetsizes.csv b/src/glgetsizes.csv index 9af3d980..46454c6b 100644 --- a/src/glgetsizes.csv +++ b/src/glgetsizes.csv @@ -38,10 +38,8 @@ GL_ALPHA_TEST_REF_QCOM (1,) GL_ALPHA_TO_COVERAGE_DITHER_MODE_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_alpha_to_coverage_dither_control.txt GL_AMBIENT (4,) GL_AMBIENT_AND_DIFFUSE (4,) -GL_AMBIENT_SGIX GL_ANY_SAMPLES_PASSED (1,) GL_ANY_SAMPLES_PASSED_CONSERVATIVE (1,) -GL_ARRAY_BUFFER GL_ARRAY_BUFFER_BINDING (1,) GL_ARRAY_BUFFER_BINDING_ARB (1,) GL_ARRAY_ELEMENT_LOCK_COUNT_EXT (1,) @@ -55,7 +53,6 @@ GL_ASYNC_HISTOGRAM_SGIX (1,) GL_ASYNC_MARKER_SGIX (1,) GL_ASYNC_READ_PIXELS_SGIX (1,) GL_ASYNC_TEX_IMAGE_SGIX (1,) -GL_ATOMIC_COUNTER_BUFFER GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS (1,) GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES (1,) #TODO Is actually GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS GL_ATOMIC_COUNTER_BUFFER_BINDING (1,) @@ -130,11 +127,7 @@ GL_BUFFER_SIZE_ARB (1,) GL_BUFFER_STORAGE_FLAGS (1,) GL_BUFFER_USAGE (1,) GL_BUFFER_USAGE_ARB (1,) -GL_BUMP_NUM_TEX_UNITS_ATI -GL_BUMP_ROT_MATRIX_ATI -GL_BUMP_ROT_MATRIX_SIZE_ATI GL_BUMP_TARGET_ATI (1,) -GL_BUMP_TEX_UNITS_ATI GL_CALLIGRAPHIC_FRAGMENT_SGIX (1,) GL_CLAMP_FRAGMENT_COLOR (1,) GL_CLAMP_FRAGMENT_COLOR_ARB (1,) @@ -163,7 +156,6 @@ GL_CLIP_PLANE3 (1,) GL_CLIP_PLANE4 (1,) GL_CLIP_PLANE5 (1,) GL_CLIP_VOLUME_CLIPPING_HINT_EXT (1,) -GL_COEFF GL_COLOR_ALPHA_PAIRING_ATI (1,) GL_COLOR_ARRAY (1,) GL_COLOR_ARRAY_BUFFER_BINDING (1,) @@ -248,9 +240,7 @@ GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV (1,) #TODO Review /home/mcfletch/Op GL_CONSERVATIVE_RASTER_DILATE_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_conservative_raster_dilate.txt GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_conservative_raster_dilate.txt GL_CONSERVATIVE_RASTER_MODE_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_conservative_raster_pre_snap_triangles.txt -GL_CONSTANT GL_CONSTANT_ATTENUATION (1,) -GL_CONSTANT_ATTENUATION_SGIX GL_CONSTANT_COLOR0_NV (4,) GL_CONSTANT_COLOR1_NV (4,) GL_CONST_EYE_NV (3,) @@ -358,20 +348,10 @@ GL_DETACHED_BUFFERS_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/ GL_DETACHED_MEMORY_INCARNATION_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_memory_attachment.txt GL_DETACHED_TEXTURES_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_memory_attachment.txt GL_DETAIL_TEXTURE_2D_BINDING_SGIS (1,) -GL_DETAIL_TEXTURE_2D_SGIS -GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS -GL_DETAIL_TEXTURE_LEVEL_SGIS -GL_DETAIL_TEXTURE_MODE_SGIS -GL_DEVICE_LUID_EXT -GL_DEVICE_NODE_MASK_EXT -GL_DEVICE_UUID_EXT GL_DIFFUSE (4,) -GL_DIFFUSE_SGIX -GL_DISPATCH_INDIRECT_BUFFER GL_DISPATCH_INDIRECT_BUFFER_BINDING (1,) GL_DISTANCE_ATTENUATION_SGIS (3,) GL_DITHER (1,) -GL_DOMAIN GL_DOUBLEBUFFER (1,) GL_DOWNSAMPLE_SCALES_IMG (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/IMG/IMG_framebuffer_downsample.txt GL_DRAW_BUFFER (1,) @@ -426,14 +406,11 @@ GL_DRAW_BUFFER9_ATI (1,) GL_DRAW_BUFFER_EXT (1,) GL_DRAW_FRAMEBUFFER (1,) GL_DRAW_FRAMEBUFFER_BINDING (1,) -GL_DRAW_INDIRECT_BUFFER GL_DRAW_INDIRECT_BUFFER_BINDING (1,) -GL_DRIVER_UUID_EXT GL_DS_BIAS_NV (1,) GL_DS_SCALE_NV (1,) GL_DT_BIAS_NV (1,) GL_DT_SCALE_NV (1,) -GL_DUAL_TEXTURE_SELECT_SGIS GL_EDGE_FLAG (1,) GL_EDGE_FLAG_ARRAY (1,) GL_EDGE_FLAG_ARRAY_BUFFER_BINDING (1,) @@ -445,7 +422,6 @@ GL_EDGE_FLAG_ARRAY_POINTER (1,) GL_EDGE_FLAG_ARRAY_STRIDE (1,) GL_EDGE_FLAG_ARRAY_STRIDE_EXT (1,) GL_EFFECTIVE_RASTER_SAMPLES_EXT (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_framebuffer_mixed_samples.txt -GL_ELEMENT_ARRAY_BUFFER GL_ELEMENT_ARRAY_BUFFER_BINDING (1,) GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB (1,) GL_ELEMENT_ARRAY_LENGTH_NV (1,) @@ -453,9 +429,7 @@ GL_ELEMENT_ARRAY_POINTER_APPLE (1,) #TODO Review http://www.opengl.org/registry/ GL_ELEMENT_ARRAY_TYPE_APPLE (1,) GL_ELEMENT_ARRAY_TYPE_ATI (1,) GL_EMISSION (4,) -GL_EVAL_2D_NV GL_EVAL_FRACTIONAL_TESSELLATION_NV (1,) -GL_EVAL_TRIANGULAR_2D_NV GL_EVAL_VERTEX_ATTRIB0_NV (1,) GL_EVAL_VERTEX_ATTRIB10_NV (1,) GL_EVAL_VERTEX_ATTRIB11_NV (1,) @@ -473,7 +447,6 @@ GL_EVAL_VERTEX_ATTRIB7_NV (1,) GL_EVAL_VERTEX_ATTRIB8_NV (1,) GL_EVAL_VERTEX_ATTRIB9_NV (1,) GL_EXTENSIONS (1,) -GL_EYE_LINEAR GL_EYE_LINE_SGIS (7,) GL_EYE_PLANE (4,) GL_EYE_POINT_SGIS (4,) @@ -535,34 +508,18 @@ GL_FRAGMENT_TEXTURE (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/ GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE (1,) GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE (1,) GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING (1,) -GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE (1,) -GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE (1,) GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE (1,) GL_FRAMEBUFFER_ATTACHMENT_LAYERED (1,) -GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB -GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT -GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME (1,) -GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT -GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE (1,) -GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT -GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE (1,) GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE (1,) -GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT -GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/OVR/OVR_multiview.txt GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE (1,) -GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT -GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER (1,) -GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL (1,) -GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT -GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/OVR/OVR_multiview.txt GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/EXT/EXT_multisampled_render_to_texture.txt GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/IMG/IMG_framebuffer_downsample.txt @@ -586,8 +543,6 @@ GL_FRONT_FACE (1,) GL_GENERATE_MIPMAP (1,) GL_GENERATE_MIPMAP_HINT (1,) GL_GENERATE_MIPMAP_HINT_SGIS (1,) -GL_GENERATE_MIPMAP_SGIS -GL_GEOMETRY_INPUT_TYPE GL_GEOMETRY_INPUT_TYPE_ARB (1,) GL_GEOMETRY_INPUT_TYPE_EXT (1,) #TODO Review http://www.opengl.org/registry/specs//NV/geometry_program4.txt GL_GEOMETRY_LINKED_INPUT_TYPE_EXT (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/EXT/EXT_geometry_shader.txt @@ -596,7 +551,6 @@ GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT (1,) #TODO Review /home/mcfletch/OpenGL-dev/p GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/OES/OES_geometry_shader.txt GL_GEOMETRY_LINKED_VERTICES_OUT_EXT (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/EXT/EXT_geometry_shader.txt GL_GEOMETRY_LINKED_VERTICES_OUT_OES (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/OES/OES_geometry_shader.txt -GL_GEOMETRY_OUTPUT_TYPE GL_GEOMETRY_OUTPUT_TYPE_ARB (1,) GL_GEOMETRY_OUTPUT_TYPE_EXT (1,) #TODO Review http://www.opengl.org/registry/specs//NV/geometry_program4.txt GL_GEOMETRY_PROGRAM_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/geometry_program4.txt @@ -604,7 +558,6 @@ GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV (1,) #TODO Review http://www.opengl.org/ GL_GEOMETRY_SHADER (1,) GL_GEOMETRY_SHADER_INVOCATIONS (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/gpu_shader5.txt GL_GEOMETRY_TEXTURE (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt -GL_GEOMETRY_VERTICES_OUT GL_GEOMETRY_VERTICES_OUT_ARB (1,) GL_GEOMETRY_VERTICES_OUT_EXT (1,) #TODO Review http://www.opengl.org/registry/specs//NV/geometry_program4.txt GL_GET_TEXTURE_IMAGE_FORMAT (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt @@ -615,6 +568,10 @@ GL_GL_CONTEXT_RELEASE_BEHAVIOR (1,) #TODO Review http://www.opengl.org/registry/ GL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH (1,) #TODO Review http://www.opengl.org/registry/specs//KHR/context_flush_control.txt GL_GL_NATIVE_GRAPHICS_HANDLE_PGI (1,) #TODO Review http://www.opengl.org/registry/specs//PGI/misc_hints.txt GL_GL_NONE (1,) #TODO Review http://www.opengl.org/registry/specs//KHR/context_flush_control.txt +GL_GL_PACK_ROW_LENGTH_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_pack_subimage.txt +GL_GL_PACK_SKIP_PIXELS_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_pack_subimage.txt +GL_GL_PACK_SKIP_ROWS_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_pack_subimage.txt +GL_GL_TRP_IMG (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/IMG/IMG_tile_region_protection.txt GL_GL_UNPACK_ROW_LENGTH_EXT (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/EXT/EXT_unpack_subimage.txt GL_GL_UNPACK_SKIP_PIXELS_EXT (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/EXT/EXT_unpack_subimage.txt GL_GL_UNPACK_SKIP_ROWS_EXT (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/EXT/EXT_unpack_subimage.txt @@ -650,20 +607,10 @@ GL_HISTOGRAM_WIDTH_EXT (1,) GL_HI_BIAS_NV (1,) GL_HI_SCALE_NV (1,) GL_IMAGE_COMPATIBILITY_CLASS (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt -GL_IMAGE_CUBIC_WEIGHT_HP GL_IMAGE_FORMAT_COMPATIBILITY_TYPE (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt -GL_IMAGE_MAG_FILTER_HP -GL_IMAGE_MIN_FILTER_HP GL_IMAGE_PIXEL_FORMAT (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt GL_IMAGE_PIXEL_TYPE (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt -GL_IMAGE_ROTATE_ANGLE_HP -GL_IMAGE_ROTATE_ORIGIN_X_HP -GL_IMAGE_ROTATE_ORIGIN_Y_HP -GL_IMAGE_SCALE_X_HP -GL_IMAGE_SCALE_Y_HP GL_IMAGE_TEXEL_SIZE (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt -GL_IMAGE_TRANSLATE_X_HP -GL_IMAGE_TRANSLATE_Y_HP GL_IMPLEMENTATION_COLOR_READ_FORMAT (1,) GL_IMPLEMENTATION_COLOR_READ_TYPE (1,) GL_INDEX_ARRAY (1,) @@ -725,7 +672,6 @@ GL_LIGHT_MODEL_COLOR_CONTROL_EXT (1,) GL_LIGHT_MODEL_LOCAL_VIEWER (1,) GL_LIGHT_MODEL_TWO_SIDE (1,) GL_LINEAR_ATTENUATION (1,) -GL_LINEAR_ATTENUATION_SGIX GL_LINE_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_polygon_mode.txt GL_LINE_SMOOTH (1,) GL_LINE_SMOOTH_HINT (1,) @@ -739,7 +685,6 @@ GL_LINK_STATUS (1,) GL_LIST_BASE (1,) GL_LIST_INDEX (1,) GL_LIST_MODE (1,) -GL_LIST_PRIORITY_SGIX GL_LOCATION (1,) GL_LOCATION_INDEX (1,) GL_LOGIC_OP (1,) @@ -1119,6 +1064,7 @@ GL_MAX_TEXTURE_SIZE (1,) GL_MAX_TEXTURE_STACK_DEPTH (1,) GL_MAX_TEXTURE_UNITS (1,) GL_MAX_TEXTURE_UNITS_ARB (1,) +GL_MAX_TIMELINE_SEMAPHORE_VALUE_DIFFERENCE_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_timeline_semaphore.txt GL_MAX_TRACK_MATRICES_NV (1,) GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV (1,) GL_MAX_TRANSFORM_FEEDBACK_BUFFERS (1,) @@ -1229,6 +1175,8 @@ GL_MODELVIEW9_ARB (4,4) GL_MODELVIEW_MATRIX (4, 4) GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/OES/OES_matrix_get.txt GL_MODELVIEW_STACK_DEPTH (1,) +GL_MOTION_ESTIMATION_SEARCH_BLOCK_X_QCOM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/QCOM/QCOM_motion_estimation.txt +GL_MOTION_ESTIMATION_SEARCH_BLOCK_Y_QCOM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/QCOM/QCOM_motion_estimation.txt GL_MULTICAST_GPUS_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_gpu_multicast.txt GL_MULTICAST_PROGRAMMABLE_SAMPLE_LOCATION_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_gpu_multicast.txt GL_MULTISAMPLE (1,) @@ -1247,7 +1195,6 @@ GL_NAMED_STRING_TYPE_ARB (1,) GL_NAME_LENGTH (1,) GL_NAME_STACK_DEPTH (1,) GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/video_capture.txt -GL_NONE GL_NORMALIZE (1,) GL_NORMAL_ARRAY (1,) GL_NORMAL_ARRAY_BUFFER_BINDING (1,) @@ -1267,7 +1214,6 @@ GL_NUM_ACTIVE_VARIABLES (1,) GL_NUM_COMPATIBLE_SUBROUTINES (1,) GL_NUM_COMPRESSED_TEXTURE_FORMATS (1,) GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB (1,) -GL_NUM_DEVICE_UUIDS_EXT GL_NUM_DOWNSAMPLE_SCALES_IMG (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/IMG/IMG_framebuffer_downsample.txt GL_NUM_EXTENSIONS (1,) GL_NUM_FILL_STREAMS_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/present_video.txt @@ -1296,7 +1242,6 @@ GL_OBJECT_BUFFER_USAGE_ATI (4,) GL_OBJECT_COMPILE_STATUS_ARB (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/shader_objects.txt GL_OBJECT_DELETE_STATUS_ARB (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/shader_objects.txt GL_OBJECT_INFO_LOG_LENGTH_ARB (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/shader_objects.txt -GL_OBJECT_LINEAR GL_OBJECT_LINE_SGIS (7,) GL_OBJECT_LINK_STATUS_ARB (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/shader_objects.txt GL_OBJECT_PLANE (4,) @@ -1320,7 +1265,6 @@ GL_OPERAND2_ALPHA (1,) GL_OPERAND2_RGB (1,) GL_OPERAND3_ALPHA_NV (1,) GL_OPERAND3_RGB_NV (1,) -GL_ORDER GL_PACK_ALIGNMENT (1,) GL_PACK_CMYK_HINT_EXT (1,) GL_PACK_COMPRESSED_BLOCK_DEPTH (1,) @@ -1342,10 +1286,9 @@ GL_PACK_SKIP_IMAGES_EXT (1,) GL_PACK_SKIP_PIXELS (1,) GL_PACK_SKIP_ROWS (1,) GL_PACK_SKIP_VOLUMES_SGIS (1,) -GL_PACK_SUBSAMPLE_RATE_SGIX +GL_PACK_SUBSAMPLE_RATE_SGIX (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/SGIX/SGIX_subsample.txt GL_PACK_SWAP_BYTES (1,) GL_PARALLEL_ARRAYS_INTEL (1,) -GL_PARAMETER_BUFFER GL_PARAMETER_BUFFER_BINDING_ARB (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/indirect_parameters.txt GL_PATCH_DEFAULT_INNER_LEVEL (1,) GL_PATCH_DEFAULT_OUTER_LEVEL (1,) @@ -1362,7 +1305,6 @@ GL_PATH_GEN_COEFF_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/ GL_PATH_GEN_COLOR_FORMAT_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/path_rendering.txt GL_PATH_GEN_COMPONENTS_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/path_rendering.txt GL_PATH_GEN_MODE_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/path_rendering.txt -GL_PATH_OBJECT_BOUNDING_BOX_NV GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV (1,) GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV (1,) GL_PATH_STENCIL_FUNC_NV (1,) @@ -1406,7 +1348,6 @@ GL_PIXEL_MAP_R_TO_R (_L(0xCB6),) GL_PIXEL_MAP_R_TO_R_SIZE (1,) GL_PIXEL_MAP_S_TO_S (_L(0xCB1),) GL_PIXEL_MAP_S_TO_S_SIZE (1,) -GL_PIXEL_PACK_BUFFER GL_PIXEL_PACK_BUFFER_BINDING (1,) GL_PIXEL_PACK_BUFFER_BINDING_ARB (1,) GL_PIXEL_PACK_BUFFER_BINDING_EXT (1,) @@ -1423,7 +1364,6 @@ GL_PIXEL_TILE_HEIGHT_SGIX (1,) GL_PIXEL_TILE_WIDTH_SGIX (1,) GL_PIXEL_TRANSFORM_2D_MATRIX_EXT (1,) #TODO Review http://www.opengl.org/registry/specs//EXT/pixel_transform.txt GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT (1,) -GL_PIXEL_UNPACK_BUFFER GL_PIXEL_UNPACK_BUFFER_BINDING (1,) GL_PIXEL_UNPACK_BUFFER_BINDING_ARB (1,) GL_PIXEL_UNPACK_BUFFER_BINDING_EXT (1,) @@ -1471,7 +1411,6 @@ GL_POLYGON_SMOOTH (1,) GL_POLYGON_SMOOTH_HINT (1,) GL_POLYGON_STIPPLE (1,) GL_POSITION (4,) -GL_POSITION_SGIX GL_POST_COLOR_MATRIX_ALPHA_BIAS (1,) GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI (1,) GL_POST_COLOR_MATRIX_ALPHA_SCALE (1,) @@ -1571,33 +1510,9 @@ GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES (1,) #TODO Review /home/mcfletch/Open GL_PROJECTION_STACK_DEPTH (1,) GL_PROVOKING_VERTEX (1,) GL_PROVOKING_VERTEX_EXT (1,) -GL_PROXY_TEXTURE_1D -GL_PROXY_TEXTURE_1D_ARRAY -GL_PROXY_TEXTURE_1D_ARRAY_EXT -GL_PROXY_TEXTURE_1D_EXT -GL_PROXY_TEXTURE_2D -GL_PROXY_TEXTURE_2D_ARRAY -GL_PROXY_TEXTURE_2D_ARRAY_EXT -GL_PROXY_TEXTURE_2D_EXT -GL_PROXY_TEXTURE_2D_MULTISAMPLE -GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY -GL_PROXY_TEXTURE_3D -GL_PROXY_TEXTURE_3D_EXT -GL_PROXY_TEXTURE_4D_SGIS -GL_PROXY_TEXTURE_CUBE_MAP -GL_PROXY_TEXTURE_CUBE_MAP_ARB -GL_PROXY_TEXTURE_CUBE_MAP_ARRAY -GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB -GL_PROXY_TEXTURE_CUBE_MAP_EXT -GL_PROXY_TEXTURE_RECTANGLE -GL_PROXY_TEXTURE_RECTANGLE_ARB -GL_PROXY_TEXTURE_RECTANGLE_NV GL_QUADRATIC_ATTENUATION (1,) -GL_QUADRATIC_ATTENUATION_SGIX GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION (1,) GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT (1,) -GL_QUAD_TEXTURE_SELECT_SGIS -GL_QUERY_BUFFER GL_QUERY_BUFFER_BINDING (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/query_buffer_object.txt GL_QUERY_BUFFER_BINDING_AMD (1,) GL_QUERY_COUNTER_BITS (1,) @@ -1635,46 +1550,22 @@ GL_REFERENCE_PLANE_EQUATION_SGIX (4,) GL_REFERENCE_PLANE_SGIX (1,) GL_REGISTER_COMBINERS_NV (1,) GL_RENDERBUFFER_ALPHA_SIZE (1,) -GL_RENDERBUFFER_ALPHA_SIZE_EXT -GL_RENDERBUFFER_ALPHA_SIZE_OES GL_RENDERBUFFER_BINDING (1,) GL_RENDERBUFFER_BINDING_EXT (1,) GL_RENDERBUFFER_BLUE_SIZE (1,) -GL_RENDERBUFFER_BLUE_SIZE_EXT -GL_RENDERBUFFER_BLUE_SIZE_OES -GL_RENDERBUFFER_COLOR_SAMPLES_AMD GL_RENDERBUFFER_COLOR_SAMPLES_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/framebuffer_multisample_coverage.txt -GL_RENDERBUFFER_COVERAGE_SAMPLES_AMD GL_RENDERBUFFER_COVERAGE_SAMPLES_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/framebuffer_multisample_coverage.txt GL_RENDERBUFFER_DEPTH_SIZE (1,) -GL_RENDERBUFFER_DEPTH_SIZE_EXT -GL_RENDERBUFFER_DEPTH_SIZE_OES GL_RENDERBUFFER_FREE_MEMORY_ATI (1,) GL_RENDERBUFFER_GREEN_SIZE (1,) -GL_RENDERBUFFER_GREEN_SIZE_EXT -GL_RENDERBUFFER_GREEN_SIZE_OES GL_RENDERBUFFER_HEIGHT (1,) -GL_RENDERBUFFER_HEIGHT_EXT -GL_RENDERBUFFER_HEIGHT_OES GL_RENDERBUFFER_INTERNAL_FORMAT (1,) -GL_RENDERBUFFER_INTERNAL_FORMAT_EXT -GL_RENDERBUFFER_INTERNAL_FORMAT_OES GL_RENDERBUFFER_RED_SIZE (1,) -GL_RENDERBUFFER_RED_SIZE_EXT -GL_RENDERBUFFER_RED_SIZE_OES GL_RENDERBUFFER_SAMPLES (1,) -GL_RENDERBUFFER_SAMPLES_ANGLE -GL_RENDERBUFFER_SAMPLES_APPLE -GL_RENDERBUFFER_SAMPLES_EXT GL_RENDERBUFFER_SAMPLES_IMG (1,) -GL_RENDERBUFFER_SAMPLES_NV GL_RENDERBUFFER_STENCIL_SIZE (1,) -GL_RENDERBUFFER_STENCIL_SIZE_EXT -GL_RENDERBUFFER_STENCIL_SIZE_OES GL_RENDERBUFFER_STORAGE_SAMPLES_AMD (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/AMD/AMD_framebuffer_multisample_advanced.txt GL_RENDERBUFFER_WIDTH (1,) -GL_RENDERBUFFER_WIDTH_EXT -GL_RENDERBUFFER_WIDTH_OES GL_RENDERER (1,) GL_RENDER_GPU_MASK_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_gpu_multicast.txt GL_RENDER_MODE (1,) @@ -1757,6 +1648,13 @@ GL_SEPARABLE_2D (1,) GL_SEPARABLE_2D_EXT (1,) GL_SHADER_BINARY_FORMATS (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/ES2_compatibility.txt GL_SHADER_COMPILER (1,) +GL_SHADER_CORE_ACTIVE_COUNT_ARM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/ARM/ARM_shader_core_properties.txt +GL_SHADER_CORE_COUNT_ARM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/ARM/ARM_shader_core_properties.txt +GL_SHADER_CORE_FMA_RATE_ARM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/ARM/ARM_shader_core_properties.txt +GL_SHADER_CORE_MAX_WARP_COUNT_ARM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/ARM/ARM_shader_core_properties.txt +GL_SHADER_CORE_PIXEL_RATE_ARM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/ARM/ARM_shader_core_properties.txt +GL_SHADER_CORE_PRESENT_MASK_ARM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/ARM/ARM_shader_core_properties.txt +GL_SHADER_CORE_TEXEL_RATE_ARM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/ARM/ARM_shader_core_properties.txt GL_SHADER_IMAGE_ATOMIC (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt GL_SHADER_IMAGE_LOAD (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt GL_SHADER_IMAGE_STORE (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt @@ -1773,12 +1671,12 @@ GL_SHADE_MODEL (1,) GL_SHADING_LANGUAGE_VERSION (1,) GL_SHADING_RATE_IMAGE_BINDING_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_shading_rate_image.txt GL_SHADING_RATE_IMAGE_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_shading_rate_image.txt +GL_SHADING_RATE_IMAGE_PALETTE_COUNT_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_primitive_shading_rate.txt GL_SHADING_RATE_IMAGE_PALETTE_SIZE_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_shading_rate_image.txt +GL_SHADING_RATE_IMAGE_PER_PRIMITIVE_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_primitive_shading_rate.txt GL_SHADING_RATE_IMAGE_TEXEL_HEIGHT_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_shading_rate_image.txt GL_SHADING_RATE_IMAGE_TEXEL_WIDTH_NV (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NV/NV_shading_rate_image.txt -GL_SHADOW_AMBIENT_SGIX -GL_SHARED_TEXTURE_PALETTE_EXT -GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS +GL_SHADING_RATE_QCOM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/QCOM/QCOM_shading_rate.txt GL_SHININESS (1,) GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt @@ -1795,14 +1693,10 @@ GL_SPARSE_BUFFER_PAGE_SIZE_ARB (1,) #TODO Review http://www.opengl.org/registry/ GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/sparse_texture.txt GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/EXT/EXT_sparse_texture.txt GL_SPECULAR (4,) -GL_SPECULAR_SGIX GL_SPIR_V_BINARY_ARB (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/ARB/ARB_gl_spirv.txt GL_SPOT_CUTOFF (1,) -GL_SPOT_CUTOFF_SGIX GL_SPOT_DIRECTION (3,) -GL_SPOT_DIRECTION_SGIX GL_SPOT_EXPONENT (1,) -GL_SPOT_EXPONENT_SGIX GL_SPRITE_AXIS_SGIX (3,) GL_SPRITE_MODE_SGIX (1,) GL_SPRITE_SGIX (1,) @@ -1894,15 +1788,12 @@ GL_TEXTURE_1D_STACK_MESAX (1,) GL_TEXTURE_2D (1,) GL_TEXTURE_2D_ARRAY (1,) GL_TEXTURE_2D_BINDING_EXT (1,) -GL_TEXTURE_2D_MULTISAMPLE -GL_TEXTURE_2D_MULTISAMPLE_ARRAY GL_TEXTURE_2D_STACK_BINDING_MESAX (1,) GL_TEXTURE_2D_STACK_MESAX (1,) GL_TEXTURE_3D (1,) GL_TEXTURE_3D_BINDING_EXT (1,) GL_TEXTURE_3D_EXT (1,) GL_TEXTURE_3D_OES (1,) -GL_TEXTURE_4DSIZE_SGIS GL_TEXTURE_4D_BINDING_SGIS (1,) GL_TEXTURE_4D_SGIS (1,) GL_TEXTURE_ALPHA_SIZE (1,) @@ -1954,7 +1845,6 @@ GL_TEXTURE_BUFFER_SIZE (1,) GL_TEXTURE_CLIPMAP_CENTER_SGIX (2,) GL_TEXTURE_CLIPMAP_DEPTH_SGIX (1,) GL_TEXTURE_CLIPMAP_FRAME_SGIX (1,) -GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX GL_TEXTURE_CLIPMAP_OFFSET_SGIX (2,) GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX (3,) GL_TEXTURE_COLOR_SAMPLES_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/texture_multisample.txt @@ -1965,7 +1855,6 @@ GL_TEXTURE_COMPARE_FUNC (1,) GL_TEXTURE_COMPARE_MODE (1,) GL_TEXTURE_COMPARE_OPERATOR_SGIX (1,) GL_TEXTURE_COMPARE_SGIX (1,) -GL_TEXTURE_COMPONENTS GL_TEXTURE_COMPRESSED (1,) GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt GL_TEXTURE_COMPRESSED_BLOCK_SIZE (1,) #TODO Review http://www.opengl.org/registry/specs//ARB/internalformat_query2.txt @@ -1991,15 +1880,6 @@ GL_TEXTURE_CROP_RECT_OES (4,) GL_TEXTURE_CUBE_MAP (1,) GL_TEXTURE_CUBE_MAP_ARB (1,) GL_TEXTURE_CUBE_MAP_ARRAY (1,) -GL_TEXTURE_CUBE_MAP_ARRAY_ARB -GL_TEXTURE_CUBE_MAP_ARRAY_EXT -GL_TEXTURE_CUBE_MAP_ARRAY_OES -GL_TEXTURE_CUBE_MAP_NEGATIVE_X -GL_TEXTURE_CUBE_MAP_NEGATIVE_Y -GL_TEXTURE_CUBE_MAP_NEGATIVE_Z -GL_TEXTURE_CUBE_MAP_POSITIVE_X -GL_TEXTURE_CUBE_MAP_POSITIVE_Y -GL_TEXTURE_CUBE_MAP_POSITIVE_Z GL_TEXTURE_CUBE_MAP_SEAMLESS (1,) GL_TEXTURE_DEPTH (1,) GL_TEXTURE_DEPTH_EXT (1,) @@ -2009,7 +1889,6 @@ GL_TEXTURE_DS_SIZE_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV GL_TEXTURE_DT_SIZE_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/texture_shader.txt GL_TEXTURE_ENV_COLOR (4,) GL_TEXTURE_ENV_MODE (1,) -GL_TEXTURE_FILTER4_SIZE_SGIS GL_TEXTURE_FIXED_SAMPLE_LOCATIONS (1,) GL_TEXTURE_FLOAT_COMPONENTS_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/float_buffer.txt GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/QCOM/QCOM_texture_foveated.txt @@ -2023,7 +1902,6 @@ GL_TEXTURE_GEN_R (1,) GL_TEXTURE_GEN_S (1,) GL_TEXTURE_GEN_STR_OES (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/OES/OES_texture_cube_map.txt GL_TEXTURE_GEN_T (1,) -GL_TEXTURE_GEQUAL_R_SGIX GL_TEXTURE_GREEN_SIZE (1,) GL_TEXTURE_GREEN_TYPE (1,) GL_TEXTURE_HEIGHT (1,) @@ -2036,7 +1914,6 @@ GL_TEXTURE_INDEX_SIZE_EXT (1,) GL_TEXTURE_INTENSITY_SIZE (1,) GL_TEXTURE_INTENSITY_TYPE (1,) GL_TEXTURE_INTERNAL_FORMAT (1,) -GL_TEXTURE_LEQUAL_R_SGIX GL_TEXTURE_LIGHT_EXT (1,) GL_TEXTURE_LOD_BIAS (1,) GL_TEXTURE_LOD_BIAS_R_SGIX (1,) @@ -2051,7 +1928,6 @@ GL_TEXTURE_MATERIAL_FACE_EXT (1,) GL_TEXTURE_MATERIAL_PARAMETER_EXT (1,) GL_TEXTURE_MATRIX (4, 4) GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/OES/OES_matrix_get.txt -GL_TEXTURE_MAX_ANISOTROPY GL_TEXTURE_MAX_ANISOTROPY_EXT (1,) GL_TEXTURE_MAX_CLAMP_R_SGIX (1,) GL_TEXTURE_MAX_CLAMP_S_SGIX (1,) @@ -2107,7 +1983,6 @@ GL_TRACK_MATRIX_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/ve GL_TRACK_MATRIX_TRANSFORM_NV (1,) #TODO Review http://www.opengl.org/registry/specs//NV/vertex_program.txt GL_TRANSFORM_FEEDBACK_BINDING (1,) GL_TRANSFORM_FEEDBACK_BINDING_NV (1,) -GL_TRANSFORM_FEEDBACK_BUFFER GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE (1,) GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV (1,) GL_TRANSFORM_FEEDBACK_BUFFER_BINDING (1,) @@ -2150,7 +2025,6 @@ GL_UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV (1,) #TODO Review /home/mcfletch/O GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER (1,) GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER (1,) GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER (1,) -GL_UNIFORM_BUFFER GL_UNIFORM_BUFFER_BINDING (1,) GL_UNIFORM_BUFFER_BINDING_EXT (1,) GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT (1,) @@ -2182,7 +2056,7 @@ GL_UNPACK_SKIP_IMAGES_EXT (1,) GL_UNPACK_SKIP_PIXELS (1,) GL_UNPACK_SKIP_ROWS (1,) GL_UNPACK_SKIP_VOLUMES_SGIS (1,) -GL_UNPACK_SUBSAMPLE_RATE_SGIX +GL_UNPACK_SUBSAMPLE_RATE_SGIX (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/SGIX/SGIX_subsample.txt GL_UNPACK_SWAP_BYTES (1,) GL_UPLOAD_GPU_MASK_NVX (1,) #TODO Review /home/mcfletch/OpenGL-dev/pyopengl/src/khronosapi/extensions/NVX/NVX_gpu_multicast2.txt GL_VALIDATE_STATUS (1,) diff --git a/src/xmlreg.py b/src/xmlreg.py index 57fb5fe4..d2995490 100755 --- a/src/xmlreg.py +++ b/src/xmlreg.py @@ -3,12 +3,13 @@ from lxml import etree as ET import os, sys, json, logging from OpenGL._bytes import as_8_bit, unicode, as_str -log = logging.getLogger( __name__ ) -HERE = os.path.dirname( __file__ ) -LENGTH_OVERRIDES={ +log = logging.getLogger(__name__) +HERE = os.path.dirname(__file__) + +LENGTH_OVERRIDES = { 'glGetPolygonStipple': { - 'mask': str(32*32/8), # 32x32 bits + 'mask': str(32 * 32 / 8), # 32x32 bits }, 'glGetUniformfv': { 'params': None, @@ -16,17 +17,17 @@ 'glGetUniformiv': { 'params': None, }, -# 'glShaderSourceARB': { -# 'string': None, -# }, -# 'glShaderSource': { -# 'string': None, -# }, + # 'glShaderSourceARB': { + # 'string': None, + # }, + # 'glShaderSource': { + # 'string': None, + # }, } -class Registry( object ): - def __init__( self ): +class Registry(object): + def __init__(self): self.type_set = {} self.enum_namespaces = {} self.enum_groups = {} @@ -35,101 +36,112 @@ def __init__( self ): self.apis = {} self.feature_set = {} self.extension_set = {} - self.output_mapping = json.loads( open( os.path.join( HERE, 'gl_out_parameters.json' )).read()) + self.output_mapping = json.loads( + open(os.path.join(HERE, 'gl_out_parameters.json')).read() + ) self.output_enum_groups = {} - - def load( self, tree ): + + def load(self, tree): """Load an lxml.etree structure into our internal descriptions""" - self.dispatch( tree, None ) - - def dispatch( self, tree, context=None): + self.dispatch(tree, None) + + def dispatch(self, tree, context=None): """Dispatch for all children of the element""" for element in tree: - if isinstance( element.tag, (str,unicode)): - method = getattr( self, element.tag, None ) + if isinstance(element.tag, (str, unicode)): + method = getattr(self, element.tag, None) if method: - method( element, context ) + method(element, context) else: print('Expand', element.tag) - self.dispatch( element, context ) - - def type( self, element, context=None ): + self.dispatch(element, context) + + def type(self, element, context=None): name = element.get('name') if not name: - name = element.find('name').text - self.type_set[as_str(name)] = element - - def debug_types( self ): - for name,type in self.types.items(): + name = element.find('name').text + self.type_set[as_str(name)] = element + + def debug_types(self): + for name, type in self.types.items(): print(name, type) - - def enums( self, element, context=None ): + + def enums(self, element, context=None): name = as_str(element.get('namespace')) if name not in self.enum_namespaces: namespace = EnumNamespace(name) self.enum_namespaces[name] = namespace else: namespace = self.enum_namespaces[name] - self.dispatch( element, namespace ) - - def enum( self, element, context=None ): - if isinstance( context, EnumNamespace ): - name,value = as_str(element.get('name')),element.get('value') - enum = Enum( name, value ) - context.append( enum ) + self.dispatch(element, namespace) + + def enum(self, element, context=None): + if isinstance(context, EnumNamespace): + name, value = as_str(element.get('name')), element.get('value') + enum = Enum(name, value) + context.append(enum) self.enumeration_set[name] = enum - elif isinstance( context, (Require,Remove)): - context.append( self.enumeration_set[element.get('name')] ) - elif isinstance( context, EnumGroup ): + elif isinstance(context, (Require, Remove)): + context.append(self.enumeration_set[element.get('name')]) + elif isinstance(context, EnumGroup): name = element.get('name') - assert name, 'No name on %s'%ET.tostring(element) - context.append( as_str(name) ) - - def debug_enums( self ): - for name,namespace in self.enum_namespaces.items(): + assert name, 'No name on %s' % ET.tostring(element) + context.append(as_str(name)) + + def debug_enums(self): + for name, namespace in self.enum_namespaces.items(): print('Namespace', namespace.namespace) for enum in namespace: print(' ', enum) - - def command( self, element, context=None ): + + def command(self, element, context=None): """Parse command definition into structured format""" - proto = element.find( 'proto' ) + proto = element.find('proto') if proto is not None: name = as_str(proto.find('name').text) - assert name, 'No name in command: %s'%(ET.tostring( element)) - return_type = self._type_decl( proto ) - assert return_type, 'No return type in command: %s'%(ET.tostring( element)) + assert name, 'No name in command: %s' % (ET.tostring(element)) + return_type = self._type_decl(proto) + assert return_type, 'No return type in command: %s' % (ET.tostring(element)) arg_names = [] arg_types = [] lengths = {} groups = {} for param in [x for x in element if x.tag == 'param']: - pname = as_str(param.find( 'name' ).text) - arg_names.append( pname ) - arg_types.append( self._type_decl( param )) - if param.get( 'len' ): + pname = as_str(param.find('name').text) + arg_names.append(pname) + arg_types.append(self._type_decl(param)) + if param.get('len'): length = param.get('len') - while length.endswith( '*1' ): + while length.endswith('*1'): length = length[:-2] - length = LENGTH_OVERRIDES.get(name,{}).get(pname,length) - lengths[pname] = length - if param.get( 'group' ): + length = LENGTH_OVERRIDES.get(name, {}).get(pname, length) + lengths[pname] = length + if param.get('group'): groups[pname] = param.get('group') aliases = [] for alias in [x for x in element if x.tag == 'alias']: - aliases.append( alias.get('name') ) + aliases.append(alias.get('name')) # Process lengths to look for output parameters - outputs = self.output_mapping.get( name ) - command = Command( name, return_type, arg_names, arg_types, aliases, lengths,groups, outputs=outputs ) + outputs = self.output_mapping.get(name) + command = Command( + name, + return_type, + arg_names, + arg_types, + aliases, + lengths, + groups, + outputs=outputs, + ) self.command_set[name] = command - elif isinstance( context, (Require,Remove)): - context.append( self.command_set[element.get('name')]) - - def _type_decl( self, proto ): + elif isinstance(context, (Require, Remove)): + context.append(self.command_set[element.get('name')]) + + def _type_decl(self, proto): """Get the string type declaration for parent (proto/param)""" return_type = [] if proto.text: - return_type.append( proto.text ) + return_type.append(proto.text) for item in proto: if item.tag == 'name': break @@ -138,67 +150,88 @@ def _type_decl( self, proto ): return_type.append(item.text.strip()) if item.tail: return_type.append(item.tail.strip()) - return ' '.join( [x for x in return_type if x] ) or 'void' - - def debug_commands( self ): - for name,command in sorted(self.command_set.items()): - print( command ) - - def feature( self, element, context=None ): - api,name,number = [element.get(x) for x in ('api','name','number')] - feature = Feature( api, name, number ) - self.feature_set[name] = feature - self.dispatch( element, feature ) - def extension( self, element, context=None ): - name,apis,require = [element.get(x) for x in ['name','supported','protect']] - extension = Extension( name, apis.split('|'),require) + return ' '.join([x for x in return_type if x]) or 'void' + + def debug_commands(self): + for name, command in sorted(self.command_set.items()): + print(command) + + def feature(self, element, context=None): + api, name, number = [element.get(x) for x in ('api', 'name', 'number')] + feature = Feature(api, name, number) + self.feature_set[name] = feature + self.dispatch(element, feature) + + def extension(self, element, context=None): + name, apis, require = [element.get(x) for x in ['name', 'supported', 'protect']] + extension = Extension(name, apis.split('|'), require) self.extension_set[name] = extension - self.dispatch( element, extension ) - def unused( self, element, context=None): + self.dispatch(element, extension) + + def unused(self, element, context=None): pass - def group( self, element, context=None): + + def group(self, element, context=None): name = element.get('name') - current = self.enum_groups.get( name ) + current = self.enum_groups.get(name) if current is None: - current = self.enum_groups[name] = EnumGroup( name ) - self.dispatch( element, current ) - - def require( self, element, context ): - if isinstance( context, (Feature,Extension)): - profile,comment = element.get('profile'),element.get('comment') - require = Require( profile, comment ) - context.append( require ) - self.dispatch( element, require ) - def remove( self, element, context ): - if isinstance( context, Feature): - profile,comment = element.get('profile'),element.get('comment') - remove = Remove( profile, comment ) - context.append( remove ) - self.dispatch( element, remove ) - - def debug_apis( self ): - print( [x.api for x in self.feature_set.values()]) - -class EnumNamespace( list ): - def __init__( self, namespace, *args ): - self.namespace = namespace - super( EnumNamespace, self ).__init__(*args) -class EnumGroup( list ): - def __init__( self, name, *args ): - self.name = name - super( EnumGroup, self ).__init__( *args ) -class Enum( object ): - def __init__( self, name, value ): - self.name = name + current = self.enum_groups[name] = EnumGroup(name) + self.dispatch(element, current) + + def require(self, element, context): + if isinstance(context, (Feature, Extension)): + profile, comment = element.get('profile'), element.get('comment') + require = Require(profile, comment) + context.append(require) + self.dispatch(element, require) + + def remove(self, element, context): + if isinstance(context, Feature): + profile, comment = element.get('profile'), element.get('comment') + remove = Remove(profile, comment) + context.append(remove) + self.dispatch(element, remove) + + def debug_apis(self): + print([x.api for x in self.feature_set.values()]) + + +class EnumNamespace(list): + def __init__(self, namespace, *args): + self.namespace = namespace + super(EnumNamespace, self).__init__(*args) + + +class EnumGroup(list): + def __init__(self, name, *args): + self.name = name + super(EnumGroup, self).__init__(*args) + + +class Enum(object): + def __init__(self, name, value): + self.name = name self.value = value - def __repr__( self ): - return '%s = %s'%( self.name, self.value ) - -class Command( object ): - def __init__( self, name, returnType, argNames, argTypes, aliases=None, lengths=None, groups=None, outputs=None ): - self.name =name - self.returnType = returnType - self.argNames = argNames + + def __repr__(self): + return '%s = %s' % (self.name, self.value) + + +class Command(object): + def __init__( + self, + name, + returnType, + argNames, + argTypes, + aliases=None, + lengths=None, + groups=None, + outputs=None, + ): + self.name = name + self.returnType = returnType + self.argNames = argNames self.argTypes = argTypes self.aliases = aliases or [] self.lengths = lengths or {} @@ -206,204 +239,253 @@ def __init__( self, name, returnType, argNames, argTypes, aliases=None, lengths= self.outputs = outputs or {} self.output_groups = {} self.size_dependencies = self.calculate_sizes() - def __repr__( self ): - return '%s %s( %s )'%( - self.returnType, - self.name, - ', '.join([ - '%s %s'%(typ,name) - for (typ,name) in zip( self.argTypes,self.argNames ) - ]) + + def __repr__(self): + return '%s %s( %s )' % ( + self.returnType, + self.name, + ', '.join( + [ + '%s %s' % (typ, name) + for (typ, name) in zip(self.argTypes, self.argNames) + ] + ), ) - def calculate_sizes( self ): + + def calculate_sizes(self): result = [] other_lengths = self.lengths.copy() for target in self.outputs.keys(): - definition = self.lengths.get( target ) + definition = self.lengths.get(target) if definition is None: if target not in self.argNames: # may be a discrepency between .spec and xml registry file... if target == 'params' and 'data' in self.argNames: target = 'data' - definition = self.lengths.get( 'data' ) + definition = self.lengths.get('data') if target in other_lengths: del other_lengths[target] - + if definition is None: - result.append( (target, Output() )) - elif definition.startswith( 'COMPSIZE' ): + result.append((target, Output())) + elif definition.startswith('COMPSIZE'): variables = definition[8:].strip('()').split(',') output_groups = {} if len(variables) == 1: # for now we only support automated single-dependency wrapping... for var in variables: if var in self.groups: - output_groups.setdefault( self.groups[var], []).append( target ) - self.output_groups.update( output_groups ) - result.append( (target,Compsize( variables, output_groups ))) + output_groups.setdefault(self.groups[var], []).append( + target + ) + self.output_groups.update(output_groups) + result.append((target, Compsize(variables, output_groups))) elif definition.isdigit(): - result.append( (target,Staticsize( int(definition,10)))) + result.append((target, Staticsize(int(definition, 10)))) elif '*' in definition: - var,multiple = definition.split('*') - result.append( (target,Multiple( var, int(multiple,10)))) + var, multiple = definition.split('*') + result.append((target, Multiple(var, int(multiple, 10)))) else: - result.append( (target,Dynamicsize( definition ))) - for (target,length) in other_lengths.items(): + result.append((target, Dynamicsize(definition))) + for target, length in other_lengths.items(): if length is None: # length/array-conversion suppressed - continue + continue if length.isdigit(): - result.append( (target,StaticInput( int(length,10)))) - elif length.startswith( 'COMPSIZE' ): - result.append( (target,Input(length[9:-1]))) + result.append((target, StaticInput(int(length, 10)))) + elif length.startswith('COMPSIZE'): + result.append((target, Input(length[9:-1]))) elif length in self.argNames: - result.append( (target,DynamicInput(length))) + result.append((target, DynamicInput(length))) elif '*' in length: - params = length.split('*') - in_set = [ - x for x in params - if x in self.argNames - ] -# if params == in_set: - result.append( (target,MultipleInput(params))) -# else: -# result.append( (target, Input())) + params = [x.strip() for x in length.split('*')] + in_set = [x for x in params if x in self.argNames] + result.append((target, MultiplyInput(params))) + elif '/' in length: + params = [x.strip() for x in length.split('/')] + in_set = [x for x in params if x in self.argNames] + result.append((target, DivideInput(params))) else: - raise RuntimeError( (target,length)) + raise RuntimeError((target, length)) return dict(result) + + class IsInput(object): pass -class Input( IsInput, object ): + + +class Input(IsInput, object): """Unsized Input Parameter""" - def __init__( self, value=None ): + + def __init__(self, value=None): self.value = value - def __repr__( self ): + + def __repr__(self): return repr(self.value) -class StaticInput( IsInput,int ): + + +class StaticInput(IsInput, int): """Statically sized input parameter""" -class DynamicInput( IsInput,str ): + + +class DynamicInput(IsInput, str): """Dynamically sized based on other parameter""" -class MultipleInput( IsInput,list ): + + +class MultiplyInput(IsInput, list): """Size depends on multiple elements being multiplied""" - def __str__( self ): - return '*'.join( self ) - -class Output( object ): + + def __str__(self): + return '*'.join(self) + + +class DivideInput(IsInput, list): + """Size depends on multiple elements being multiplied""" + + def __str__(self): + return '/'.join(self) + + +class Output(object): """Unsized output parameter""" -class Compsize( list ): + + +class Compsize(list): """Compute size based on other variables""" - def __init__( self, iterable, groups=None ): - super( Compsize,self ).__init__( iterable ) + + def __init__(self, iterable, groups=None): + super(Compsize, self).__init__(iterable) self.groups = groups -class Staticsize( int ): + +class Staticsize(int): """Static output array size""" -class Dynamicsize( str ): + + +class Dynamicsize(str): """Sized by the value in dynamic variable""" -class Multiple( list ): + + +class Multiple(list): """Variable * static size for array""" + # The order-dependent set of require/remove holding features/extensions -class Module( list ): +class Module(list): """Base class for Features and Extensions""" + feature = False - def __init__( self, name ): - self.name = name - def members( self, of_type=None ): + + def __init__(self, name): + self.name = name + + def members(self, of_type=None): members = [] for req in self: if req.require: for item in req: if of_type is not None: - if isinstance( item, of_type ): - members.append( item ) + if isinstance(item, of_type): + members.append(item) else: - members.append( item ) + members.append(item) return members - def enums( self ): - return self.members( Enum ) - def commands( self ): - return self.members( Command ) + def enums(self): + return self.members(Enum) + + def commands(self): + return self.members(Command) -class Feature( Module ): + +class Feature(Module): feature = True NORMALIZERS = { 'GL_VERSION_ES_CM_1_0': 'GLES_VERSION_1_0', 'GL_ES_VERSION_2_0': 'GLES_VERSION_2_0', 'GL_ES_VERSION_3_0': 'GLES_VERSION_3_0', } - def __init__( self, api,name,number ): - super( Feature, self ).__init__(self.NORMALIZERS.get(name,name)) - self.api = api + + def __init__(self, api, name, number): + super(Feature, self).__init__(self.NORMALIZERS.get(name, name)) + self.api = api if name == 'GL_ES_VERSION_3_0': self.api = 'gles3' - self.number = number + self.number = number + _profiles = None - @property - def profiles( self ): + + @property + def profiles(self): """Create set of profiles with subsets of our functionality""" if self._profiles is None: profiles = {} for req in self: - # Logic isn't right here, there's a base and then + # Logic isn't right here, there's a base and then # a set of profiles which customize the base... profile = req.profile or '' - set = profiles.get( profile ) + set = profiles.get(profile) if set is None: - set = Module( profile or '' ) + set = Module(profile or '') set.feature = True profiles[profile] = set if req.require: - - set.extend( req ) + + set.extend(req) else: for item in req: while item in set: - set.remove( item ) - self._profiles = sorted(profiles.values(),key=lambda x: x.name) + set.remove(item) + self._profiles = sorted(profiles.values(), key=lambda x: x.name) return self._profiles - -class Extension( Module ): - def __init__(self, name, apis, require=None ): - super( Extension, self ).__init__(name) - self.apis = apis # only available for these APIs + + +class Extension(Module): + def __init__(self, name, apis, require=None): + super(Extension, self).__init__(name) + self.apis = apis # only available for these APIs self.require = require + @property - def profiles( self ): - module = Module( 'default' ) - module.extend( self ) + def profiles(self): + module = Module('default') + module.extend(self) return module - -class Require( list ): + + +class Require(list): require = True remove = False - def __init__( self, profile=None, comment=None ): - self.profile = profile - self.comment = comment - super( Require, self ).__init__() -class Remove( list ): + + def __init__(self, profile=None, comment=None): + self.profile = profile + self.comment = comment + super(Require, self).__init__() + + +class Remove(list): require = False remove = True - def __init__( self, profile=None, comment=None ): - self.profile = profile - self.comment = comment - super( Remove, self ).__init__() -def parse( xmlfile ): + def __init__(self, profile=None, comment=None): + self.profile = profile + self.comment = comment + super(Remove, self).__init__() + + +def parse(xmlfile): registry = Registry() - registry.load( ET.fromstring( open( xmlfile, 'rb' ).read()) ) - return registry + registry.load(ET.fromstring(open(xmlfile, 'rb').read())) + return registry if __name__ == "__main__": if sys.argv[1:]: for file in sys.argv[1:]: print(file) - registry = parse( file ) - - #registry.debug_types() - #registry.debug_enums() - #registry.debug_commands() - #registry.debug_apis() - + registry = parse(file) + + # registry.debug_types() + # registry.debug_enums() + # registry.debug_commands() + # registry.debug_apis()