Update for Vulkan-Docs 1.2.140
This commit is contained in:
@@ -25,9 +25,11 @@ from cgenerator import CGeneratorOptions, COutputGenerator
|
||||
from docgenerator import DocGeneratorOptions, DocOutputGenerator
|
||||
from extensionmetadocgenerator import (ExtensionMetaDocGeneratorOptions,
|
||||
ExtensionMetaDocOutputGenerator)
|
||||
from interfacedocgenerator import InterfaceDocGenerator
|
||||
from generator import write
|
||||
from hostsyncgenerator import HostSynchronizationOutputGenerator
|
||||
from pygenerator import PyOutputGenerator
|
||||
from reflib import logDiag, logWarn, setLogFile
|
||||
from reg import Registry
|
||||
from validitygenerator import ValidityOutputGenerator
|
||||
from vkconventions import VulkanConventions
|
||||
@@ -47,7 +49,7 @@ def endTimer(timeit, msg):
|
||||
global startTime
|
||||
if timeit:
|
||||
endTime = time.process_time()
|
||||
write(msg, endTime - startTime, file=sys.stderr)
|
||||
logDiag(msg, endTime - startTime)
|
||||
startTime = None
|
||||
|
||||
|
||||
@@ -212,10 +214,14 @@ def makeGenOpts(args):
|
||||
defaultExtensions = None,
|
||||
addExtensions = addExtensionsPat,
|
||||
removeExtensions = removeExtensionsPat,
|
||||
emitExtensions = emitExtensionsPat)
|
||||
emitExtensions = emitExtensionsPat,
|
||||
reparentEnums = False)
|
||||
]
|
||||
|
||||
# Extension metainformation for spec extension appendices
|
||||
# Includes all extensions by default, but only so that the generated
|
||||
# 'promoted_extensions_*' files refer to all extensions that were
|
||||
# promoted to a core version.
|
||||
genOpts['extinc'] = [
|
||||
ExtensionMetaDocOutputGenerator,
|
||||
ExtensionMetaDocGeneratorOptions(
|
||||
@@ -227,11 +233,30 @@ def makeGenOpts(args):
|
||||
versions = featuresPat,
|
||||
emitversions = None,
|
||||
defaultExtensions = defaultExtensions,
|
||||
addExtensions = None,
|
||||
addExtensions = addExtensionsPat,
|
||||
removeExtensions = None,
|
||||
emitExtensions = emitExtensionsPat)
|
||||
]
|
||||
|
||||
# Version and extension interface docs for version/extension appendices
|
||||
# Includes all extensions by default.
|
||||
genOpts['interfaceinc'] = [
|
||||
InterfaceDocGenerator,
|
||||
DocGeneratorOptions(
|
||||
conventions = conventions,
|
||||
filename = 'timeMarker',
|
||||
directory = directory,
|
||||
apiname = 'vulkan',
|
||||
profile = None,
|
||||
versions = featuresPat,
|
||||
emitversions = featuresPat,
|
||||
defaultExtensions = None,
|
||||
addExtensions = addExtensionsPat,
|
||||
removeExtensions = removeExtensionsPat,
|
||||
emitExtensions = emitExtensionsPat,
|
||||
reparentEnums = False)
|
||||
]
|
||||
|
||||
# Platform extensions, in their own header files
|
||||
# Each element of the platforms[] array defines information for
|
||||
# generating a single platform:
|
||||
@@ -313,8 +338,7 @@ def makeGenOpts(args):
|
||||
apicall = 'VKAPI_ATTR ',
|
||||
apientry = 'VKAPI_CALL ',
|
||||
apientryp = 'VKAPI_PTR *',
|
||||
alignFuncParam = 48,
|
||||
genEnumBeginEndRange = True)
|
||||
alignFuncParam = 48)
|
||||
|
||||
genOpts[headername] = [ COutputGenerator, opts ]
|
||||
|
||||
@@ -352,8 +376,7 @@ def makeGenOpts(args):
|
||||
apicall = 'VKAPI_ATTR ',
|
||||
apientry = 'VKAPI_CALL ',
|
||||
apientryp = 'VKAPI_PTR *',
|
||||
alignFuncParam = 48,
|
||||
genEnumBeginEndRange = True)
|
||||
alignFuncParam = 48)
|
||||
]
|
||||
|
||||
# Unused - vulkan10.h target.
|
||||
@@ -415,7 +438,8 @@ def makeGenOpts(args):
|
||||
|
||||
|
||||
def genTarget(args):
|
||||
"""Generate a target based on the options in the matching genOpts{} object.
|
||||
"""Create an API generator and corresponding generator options based on
|
||||
the requested target and command line options.
|
||||
|
||||
This is encapsulated in a function so it can be profiled and/or timed.
|
||||
The args parameter is an parsed argument object containing the following
|
||||
@@ -425,35 +449,30 @@ def genTarget(args):
|
||||
- directory - directory to generate it in
|
||||
- protect - True if re-inclusion wrappers should be created
|
||||
- extensions - list of additional extensions to include in generated interfaces"""
|
||||
# Create generator options with specified parameters
|
||||
|
||||
# Create generator options with parameters specified on command line
|
||||
makeGenOpts(args)
|
||||
|
||||
# Select a generator matching the requested target
|
||||
if args.target in genOpts:
|
||||
createGenerator = genOpts[args.target][0]
|
||||
options = genOpts[args.target][1]
|
||||
|
||||
if not args.quiet:
|
||||
write('* Building', options.filename, file=sys.stderr)
|
||||
write('* options.versions =', options.versions, file=sys.stderr)
|
||||
write('* options.emitversions =', options.emitversions, file=sys.stderr)
|
||||
write('* options.defaultExtensions =', options.defaultExtensions, file=sys.stderr)
|
||||
write('* options.addExtensions =', options.addExtensions, file=sys.stderr)
|
||||
write('* options.removeExtensions =', options.removeExtensions, file=sys.stderr)
|
||||
write('* options.emitExtensions =', options.emitExtensions, file=sys.stderr)
|
||||
logDiag('* Building', options.filename)
|
||||
logDiag('* options.versions =', options.versions)
|
||||
logDiag('* options.emitversions =', options.emitversions)
|
||||
logDiag('* options.defaultExtensions =', options.defaultExtensions)
|
||||
logDiag('* options.addExtensions =', options.addExtensions)
|
||||
logDiag('* options.removeExtensions =', options.removeExtensions)
|
||||
logDiag('* options.emitExtensions =', options.emitExtensions)
|
||||
|
||||
startTimer(args.time)
|
||||
gen = createGenerator(errFile=errWarn,
|
||||
warnFile=errWarn,
|
||||
diagFile=diag)
|
||||
reg.setGenerator(gen)
|
||||
reg.apiGen(options)
|
||||
|
||||
if not args.quiet:
|
||||
write('* Generated', options.filename, file=sys.stderr)
|
||||
endTimer(args.time, '* Time to generate ' + options.filename + ' =')
|
||||
return (gen, options)
|
||||
else:
|
||||
write('No generator options for unknown target:',
|
||||
args.target, file=sys.stderr)
|
||||
logErr('No generator options for unknown target:', args.target)
|
||||
return None
|
||||
|
||||
|
||||
# -feature name
|
||||
@@ -515,27 +534,6 @@ if __name__ == '__main__':
|
||||
args.feature = [name for arg in args.feature for name in arg.split()]
|
||||
args.extension = [name for arg in args.extension for name in arg.split()]
|
||||
|
||||
# Load & parse registry
|
||||
reg = Registry()
|
||||
|
||||
startTimer(args.time)
|
||||
tree = etree.parse(args.registry)
|
||||
endTimer(args.time, '* Time to make ElementTree =')
|
||||
|
||||
if args.debug:
|
||||
pdb.run('reg.loadElementTree(tree)')
|
||||
else:
|
||||
startTimer(args.time)
|
||||
reg.loadElementTree(tree)
|
||||
endTimer(args.time, '* Time to parse ElementTree =')
|
||||
|
||||
if args.validate:
|
||||
reg.validateGroups()
|
||||
|
||||
if args.dump:
|
||||
write('* Dumping registry to regdump.txt', file=sys.stderr)
|
||||
reg.dumpReg(filehandle=open('regdump.txt', 'w', encoding='utf-8'))
|
||||
|
||||
# create error/warning & diagnostic files
|
||||
if args.errfile:
|
||||
errWarn = open(args.errfile, 'w', encoding='utf-8')
|
||||
@@ -547,13 +545,37 @@ if __name__ == '__main__':
|
||||
else:
|
||||
diag = None
|
||||
|
||||
# Create the API generator & generator options
|
||||
(gen, options) = genTarget(args)
|
||||
|
||||
# Create the registry object with the specified generator and generator
|
||||
# options. The options are set before XML loading as they may affect it.
|
||||
reg = Registry(gen, options)
|
||||
|
||||
# Parse the specified registry XML into an ElementTree object
|
||||
startTimer(args.time)
|
||||
tree = etree.parse(args.registry)
|
||||
endTimer(args.time, '* Time to make ElementTree =')
|
||||
|
||||
# Load the XML tree into the registry object
|
||||
startTimer(args.time)
|
||||
reg.loadElementTree(tree)
|
||||
endTimer(args.time, '* Time to parse ElementTree =')
|
||||
|
||||
if args.validate:
|
||||
reg.validateGroups()
|
||||
|
||||
if args.dump:
|
||||
logDiag('* Dumping registry to regdump.txt')
|
||||
reg.dumpReg(filehandle=open('regdump.txt', 'w', encoding='utf-8'))
|
||||
|
||||
# Finally, use the output generator to create the requested target
|
||||
if args.debug:
|
||||
pdb.run('genTarget(args)')
|
||||
elif args.profile:
|
||||
import cProfile
|
||||
import pstats
|
||||
cProfile.run('genTarget(args)', 'profile.txt')
|
||||
p = pstats.Stats('profile.txt')
|
||||
p.strip_dirs().sort_stats('time').print_stats(50)
|
||||
pdb.run('reg.apiGen()')
|
||||
else:
|
||||
genTarget(args)
|
||||
startTimer(args.time)
|
||||
reg.apiGen()
|
||||
endTimer(args.time, '* Time to generate ' + options.filename + ' =')
|
||||
|
||||
if not args.quiet:
|
||||
logDiag('* Generated', options.filename)
|
||||
|
||||
Reference in New Issue
Block a user