early-access version 2251
This commit is contained in:
64
externals/Vulkan-Headers/registry/genvk.py
vendored
64
externals/Vulkan-Headers/registry/genvk.py
vendored
@@ -20,6 +20,7 @@ from generator import write
|
||||
from spirvcapgenerator import SpirvCapabilityOutputGenerator
|
||||
from hostsyncgenerator import HostSynchronizationOutputGenerator
|
||||
from pygenerator import PyOutputGenerator
|
||||
from rubygenerator import RubyOutputGenerator
|
||||
from reflib import logDiag, logWarn, setLogFile
|
||||
from reg import Registry
|
||||
from validitygenerator import ValidityOutputGenerator
|
||||
@@ -77,6 +78,9 @@ def makeGenOpts(args):
|
||||
# SPIR-V capabilities / features to emit (list of extensions & capabilities)
|
||||
emitSpirv = args.emitSpirv
|
||||
|
||||
# Vulkan Formats to emit
|
||||
emitFormats = args.emitFormats
|
||||
|
||||
# Features to include (list of features)
|
||||
features = args.feature
|
||||
|
||||
@@ -97,13 +101,14 @@ def makeGenOpts(args):
|
||||
|
||||
# Descriptive names for various regexp patterns used to select
|
||||
# versions and extensions
|
||||
allSpirv = allFeatures = allExtensions = r'.*'
|
||||
allFormats = allSpirv = allFeatures = allExtensions = r'.*'
|
||||
|
||||
# Turn lists of names/patterns into matching regular expressions
|
||||
addExtensionsPat = makeREstring(extensions, None)
|
||||
removeExtensionsPat = makeREstring(removeExtensions, None)
|
||||
emitExtensionsPat = makeREstring(emitExtensions, allExtensions)
|
||||
emitSpirvPat = makeREstring(emitSpirv, allSpirv)
|
||||
emitFormatsPat = makeREstring(emitFormats, allFormats)
|
||||
featuresPat = makeREstring(features, allFeatures)
|
||||
|
||||
# Copyright text prefixing all headers (list of strings).
|
||||
@@ -182,7 +187,32 @@ def makeGenOpts(args):
|
||||
reparentEnums = False)
|
||||
]
|
||||
|
||||
# Ruby representation of API information, used by scripts that
|
||||
# don't need to load the full XML.
|
||||
genOpts['api.rb'] = [
|
||||
RubyOutputGenerator,
|
||||
DocGeneratorOptions(
|
||||
conventions = conventions,
|
||||
filename = 'api.rb',
|
||||
directory = directory,
|
||||
genpath = None,
|
||||
apiname = 'vulkan',
|
||||
profile = None,
|
||||
versions = featuresPat,
|
||||
emitversions = featuresPat,
|
||||
defaultExtensions = None,
|
||||
addExtensions = addExtensionsPat,
|
||||
removeExtensions = removeExtensionsPat,
|
||||
emitExtensions = emitExtensionsPat,
|
||||
reparentEnums = False)
|
||||
]
|
||||
|
||||
|
||||
# API validity files for spec
|
||||
#
|
||||
# requireCommandAliases is set to True because we need validity files
|
||||
# for the command something is promoted to even when the promoted-to
|
||||
# feature is not included. This avoids wordy includes of validity files.
|
||||
genOpts['validinc'] = [
|
||||
ValidityOutputGenerator,
|
||||
DocGeneratorOptions(
|
||||
@@ -197,7 +227,9 @@ def makeGenOpts(args):
|
||||
defaultExtensions = None,
|
||||
addExtensions = addExtensionsPat,
|
||||
removeExtensions = removeExtensionsPat,
|
||||
emitExtensions = emitExtensionsPat)
|
||||
emitExtensions = emitExtensionsPat,
|
||||
requireCommandAliases = True,
|
||||
)
|
||||
]
|
||||
|
||||
# API host sync table files for spec
|
||||
@@ -307,6 +339,7 @@ def makeGenOpts(args):
|
||||
'VK_EXT_video_decode_h264',
|
||||
'VK_EXT_video_decode_h265',
|
||||
'VK_EXT_video_encode_h264',
|
||||
'VK_EXT_video_encode_h265',
|
||||
]
|
||||
|
||||
betaSuppressExtensions = []
|
||||
@@ -314,10 +347,13 @@ def makeGenOpts(args):
|
||||
platforms = [
|
||||
[ 'vulkan_android.h', [ 'VK_KHR_android_surface',
|
||||
'VK_ANDROID_external_memory_android_hardware_buffer'
|
||||
], commonSuppressExtensions ],
|
||||
], commonSuppressExtensions +
|
||||
[ 'VK_KHR_format_feature_flags2',
|
||||
] ],
|
||||
[ 'vulkan_fuchsia.h', [ 'VK_FUCHSIA_imagepipe_surface',
|
||||
'VK_FUCHSIA_external_memory',
|
||||
'VK_FUCHSIA_external_semaphore' ], commonSuppressExtensions ],
|
||||
'VK_FUCHSIA_external_semaphore',
|
||||
'VK_FUCHSIA_buffer_collection' ], commonSuppressExtensions ],
|
||||
[ 'vulkan_ggp.h', [ 'VK_GGP_stream_descriptor_surface',
|
||||
'VK_GGP_frame_token' ], commonSuppressExtensions ],
|
||||
[ 'vulkan_ios.h', [ 'VK_MVK_ios_surface' ], commonSuppressExtensions ],
|
||||
@@ -546,6 +582,8 @@ def genTarget(args):
|
||||
logDiag('* options.addExtensions =', options.addExtensions)
|
||||
logDiag('* options.removeExtensions =', options.removeExtensions)
|
||||
logDiag('* options.emitExtensions =', options.emitExtensions)
|
||||
logDiag('* options.emitSpirv =', options.emitSpirv)
|
||||
logDiag('* options.emitFormats =', options.emitFormats)
|
||||
|
||||
gen = createGenerator(errFile=errWarn,
|
||||
warnFile=errWarn,
|
||||
@@ -578,6 +616,9 @@ if __name__ == '__main__':
|
||||
parser.add_argument('-emitSpirv', action='append',
|
||||
default=[],
|
||||
help='Specify a SPIR-V extension or capability to emit in targets')
|
||||
parser.add_argument('-emitFormats', action='append',
|
||||
default=[],
|
||||
help='Specify Vulkan Formats to emit in targets')
|
||||
parser.add_argument('-feature', action='append',
|
||||
default=[],
|
||||
help='Specify a core API feature name or names to add to targets')
|
||||
@@ -601,7 +642,7 @@ if __name__ == '__main__':
|
||||
parser.add_argument('-time', action='store_true',
|
||||
help='Enable timing')
|
||||
parser.add_argument('-validate', action='store_true',
|
||||
help='Enable XML group validation')
|
||||
help='Validate the registry properties and exit')
|
||||
parser.add_argument('-genpath', action='store', default='gen',
|
||||
help='Path to generated files')
|
||||
parser.add_argument('-o', action='store', dest='directory',
|
||||
@@ -635,8 +676,14 @@ if __name__ == '__main__':
|
||||
else:
|
||||
diag = None
|
||||
|
||||
# Create the API generator & generator options
|
||||
(gen, options) = genTarget(args)
|
||||
if args.time:
|
||||
# Log diagnostics and warnings
|
||||
setLogFile(setDiag = True, setWarn = True, filename = '-')
|
||||
|
||||
(gen, options) = (None, None)
|
||||
if not args.validate:
|
||||
# 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.
|
||||
@@ -653,7 +700,8 @@ if __name__ == '__main__':
|
||||
endTimer(args.time, '* Time to parse ElementTree =')
|
||||
|
||||
if args.validate:
|
||||
reg.validateGroups()
|
||||
success = reg.validateRegistry()
|
||||
sys.exit(0 if success else 1)
|
||||
|
||||
if args.dump:
|
||||
logDiag('* Dumping registry to regdump.txt')
|
||||
|
Reference in New Issue
Block a user