Пример #1
0
 def __init__(
         self,
         blacklists=None,  # Path to JSON file listing apicalls and structs to ignore.
         platformTypes=None,  # Path to JSON file listing platform (WIN32, X11, etc.) defined types.
         # Khronos CGeneratorOptions
     filename=None,
         directory='.',
         prefixText='',
         protectFile=False,
         protectFeature=True,
         conventions=VulkanConventions(),
         apicall='VKAPI_ATTR ',
         apientry='VKAPI_CALL ',
         apientryp='VKAPI_PTR *',
         indentFuncProto=True,
         alignFuncParam=48,
         sortProcedure=regSortFeatures,
         apiname='vulkan',
         profile=None,
         versions=_featuresPat,
         emitversions=_featuresPat,
         defaultExtensions=_defaultExtensions,
         addExtensions=_addExtensionsPat,
         removeExtensions=_removeExtensionsPat,
         emitExtensions=_emitExtensionsPat):
     GeneratorOptions.__init__(self,
                               conventions=conventions,
                               filename=filename,
                               directory=directory,
                               apiname=apiname,
                               profile=profile,
                               versions=versions,
                               emitversions=emitversions,
                               defaultExtensions=defaultExtensions,
                               addExtensions=addExtensions,
                               removeExtensions=removeExtensions,
                               emitExtensions=emitExtensions,
                               sortProcedure=sortProcedure)
     self.blacklists = blacklists
     self.platformTypes = platformTypes
     # Khronos CGeneratorOptions
     self.prefixText = prefixText
     self.protectFile = protectFile
     self.protectFeature = protectFeature
     self.apicall = apicall
     self.apientry = apientry  # NOTE: While not used in this file, apientry is expected to be defined here by the OutputGenerator base class.
     self.apientryp = apientryp  # NOTE: While not used in this file, apientry is expected to be defined here by the OutputGenerator base class.
     self.indentFuncProto = indentFuncProto
     self.alignFuncParam = alignFuncParam
     self.codeGenerator = True
Пример #2
0
def makeGenOpts(args):
    global genOpts
    genOpts = {}

    # Default class of extensions to include, or None
    defaultExtensions = args.defaultExtensions

    # Additional extensions to include (list of extensions)
    extensions = args.extension

    # Extensions to remove (list of extensions)
    removeExtensions = args.removeExtensions

    # Extensions to emit (list of extensions)
    emitExtensions = args.emitExtensions

    # Features to include (list of features)
    features = args.feature

    # Whether to disable inclusion protect in headers
    protect = args.protect

    # Output target directory
    directory = args.directory

    # Descriptive names for various regexp patterns used to select
    # versions and extensions
    allFeatures     = allExtensions = '.*'
    noFeatures      = noExtensions = None

    # Turn lists of names/patterns into matching regular expressions
    addExtensionsPat     = makeREstring(extensions, None)
    removeExtensionsPat  = makeREstring(removeExtensions, None)
    emitExtensionsPat    = makeREstring(emitExtensions, allExtensions)
    featuresPat          = makeREstring(features, allFeatures)

    # Copyright text prefixing all headers (list of strings).
    prefixStrings = [
        '/*',
        '** Copyright (c) 2015-2019 The Khronos Group Inc.',
        '**',
        '** Licensed under the Apache License, Version 2.0 (the "License");',
        '** you may not use this file except in compliance with the License.',
        '** You may obtain a copy of the License at',
        '**',
        '**     http://www.apache.org/licenses/LICENSE-2.0',
        '**',
        '** Unless required by applicable law or agreed to in writing, software',
        '** distributed under the License is distributed on an "AS IS" BASIS,',
        '** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
        '** See the License for the specific language governing permissions and',
        '** limitations under the License.',
        '*/',
        ''
    ]

    # Text specific to Vulkan headers
    vkPrefixStrings = [
        '/*',
        '** This header is generated from the Khronos Vulkan XML API Registry.',
        '**',
        '*/',
        ''
    ]

    # Defaults for generating re-inclusion protection wrappers (or not)
    protectFeature = protect

    # An API style convention object
    conventions = VulkanConventions()

    # ValidationLayer Generators
    # Options for thread safety header code-generation
    genOpts['thread_safety.h'] = [
          ThreadOutputGenerator,
          ThreadGeneratorOptions(
            conventions       = conventions,
            filename          = 'thread_safety.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants = False)
        ]

    # Options for thread safety source code-generation
    genOpts['thread_safety.cpp'] = [
          ThreadOutputGenerator,
          ThreadGeneratorOptions(
            conventions       = conventions,
            filename          = 'thread_safety.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants = False)
        ]

    # Options for stateless validation source file
    genOpts['parameter_validation.cpp'] = [
          ParameterValidationOutputGenerator,
          ParameterValidationGeneratorOptions(
            conventions       = conventions,
            filename          = 'parameter_validation.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            valid_usage_path  = args.scripts)
          ]

    # Options for stateless validation source file
    genOpts['parameter_validation.h'] = [
          ParameterValidationOutputGenerator,
          ParameterValidationGeneratorOptions(
            conventions       = conventions,
            filename          = 'parameter_validation.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            valid_usage_path  = args.scripts)
          ]

    # Options for object_tracker code-generated validation routines
    genOpts['object_tracker.cpp'] = [
          ObjectTrackerOutputGenerator,
          ObjectTrackerGeneratorOptions(
            conventions       = conventions,
            filename          = 'object_tracker.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            valid_usage_path  = args.scripts)
        ]

    # Options for object_tracker code-generated prototypes
    genOpts['object_tracker.h'] = [
          ObjectTrackerOutputGenerator,
          ObjectTrackerGeneratorOptions(
            conventions       = conventions,
            filename          = 'object_tracker.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            valid_usage_path  = args.scripts)
        ]

    # Options for dispatch table helper generator
    genOpts['vk_dispatch_table_helper.h'] = [
          DispatchTableHelperOutputGenerator,
          DispatchTableHelperOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_dispatch_table_helper.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants = False)
        ]

    # Options for Layer dispatch table generator
    genOpts['vk_layer_dispatch_table.h'] = [
          LayerDispatchTableOutputGenerator,
          LayerDispatchTableGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_layer_dispatch_table.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants = False)
        ]

    # Helper file generator options for vk_enum_string_helper.h
    genOpts['vk_enum_string_helper.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_enum_string_helper.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            helper_file_type  = 'enum_string_header')
        ]

    # Helper file generator options for vk_safe_struct.h
    genOpts['vk_safe_struct.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_safe_struct.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            helper_file_type  = 'safe_struct_header')
        ]

    # Helper file generator options for vk_safe_struct.cpp
    genOpts['vk_safe_struct.cpp'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_safe_struct.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            helper_file_type  = 'safe_struct_source')
        ]

    # Helper file generator options for vk_object_types.h
    genOpts['vk_object_types.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_object_types.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            helper_file_type  = 'object_types_header')
        ]

    # Helper file generator options for extension_helper.h
    genOpts['vk_extension_helper.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_extension_helper.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            helper_file_type  = 'extension_helper_header')
        ]

    # Helper file generator options for typemap_helper.h
    genOpts['vk_typemap_helper.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_typemap_helper.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False,
            helper_file_type  = 'typemap_helper_header')
        ]

    # Layer chassis related generation structs
    # Options for layer chassis header
    genOpts['chassis.h'] = [
          LayerChassisOutputGenerator,
          LayerChassisGeneratorOptions(
            conventions       = conventions,
            filename          = 'chassis.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            helper_file_type  = 'layer_chassis_header',
            expandEnumerants = False)
        ]

    # Options for layer chassis source file
    genOpts['chassis.cpp'] = [
          LayerChassisOutputGenerator,
          LayerChassisGeneratorOptions(
            conventions       = conventions,
            filename          = 'chassis.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            helper_file_type  = 'layer_chassis_source',
            expandEnumerants = False)
        ]

    # Options for layer chassis dispatch source file
    genOpts['layer_chassis_dispatch.cpp'] = [
          LayerChassisDispatchOutputGenerator,
          LayerChassisDispatchGeneratorOptions(
            conventions       = conventions,
            filename          = 'layer_chassis_dispatch.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants = False)
        ]

    # Options for layer chassis dispatch header file
    genOpts['layer_chassis_dispatch.h'] = [
          LayerChassisDispatchOutputGenerator,
          LayerChassisDispatchGeneratorOptions(
            conventions       = conventions,
            filename          = 'layer_chassis_dispatch.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants = False)
        ]
Пример #3
0
def makeGenOpts(args):
    """Returns a directory of [ generator function, generator options ] indexed
    by specified short names. The generator options incorporate the following
    parameters:

    args is an parsed argument object; see below for the fields that are used."""
    global genOpts
    genOpts = {}

    # Default class of extensions to include, or None
    defaultExtensions = args.defaultExtensions

    # Additional extensions to include (list of extensions)
    extensions = args.extension

    # Extensions to remove (list of extensions)
    removeExtensions = args.removeExtensions

    # Extensions to emit (list of extensions)
    emitExtensions = args.emitExtensions

    # Features to include (list of features)
    features = args.feature

    # Whether to disable inclusion protect in headers
    protect = args.protect

    # Output target directory
    directory = args.directory

    # Path to generated files, particularly api.py
    genpath = args.genpath

    # Descriptive names for various regexp patterns used to select
    # versions and extensions
    allFeatures = allExtensions = r'.*'

    # Turn lists of names/patterns into matching regular expressions
    addExtensionsPat = makeREstring(extensions, None)
    removeExtensionsPat = makeREstring(removeExtensions, None)
    emitExtensionsPat = makeREstring(emitExtensions, allExtensions)
    featuresPat = makeREstring(features, allFeatures)

    # Copyright text prefixing all headers (list of strings).
    prefixStrings = [
        '/*', '** Copyright (c) 2015-2020 The Khronos Group Inc.', '**',
        '** SPDX-License-Identifier: Apache-2.0', '*/', ''
    ]

    # Text specific to Vulkan headers
    vkPrefixStrings = [
        '/*',
        '** This header is generated from the Khronos Vulkan XML API Registry.',
        '**', '*/', ''
    ]

    # Defaults for generating re-inclusion protection wrappers (or not)
    protectFile = protect

    # An API style conventions object
    conventions = VulkanConventions()

    # API include files for spec and ref pages
    # Overwrites include subdirectories in spec source tree
    # The generated include files do not include the calling convention
    # macros (apientry etc.), unlike the header files.
    # Because the 1.0 core branch includes ref pages for extensions,
    # all the extension interfaces need to be generated, even though
    # none are used by the core spec itself.
    genOpts['apiinc'] = [
        DocOutputGenerator,
        DocGeneratorOptions(conventions=conventions,
                            filename='timeMarker',
                            directory=directory,
                            genpath=genpath,
                            apiname='vulkan',
                            profile=None,
                            versions=featuresPat,
                            emitversions=featuresPat,
                            defaultExtensions=None,
                            addExtensions=addExtensionsPat,
                            removeExtensions=removeExtensionsPat,
                            emitExtensions=emitExtensionsPat,
                            prefixText=prefixStrings + vkPrefixStrings,
                            apicall='',
                            apientry='',
                            apientryp='*',
                            alignFuncParam=48,
                            expandEnumerants=False)
    ]

    # Python representation of API information, used by scripts that
    # don't need to load the full XML.
    genOpts['api.py'] = [
        PyOutputGenerator,
        DocGeneratorOptions(conventions=conventions,
                            filename='api.py',
                            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
    genOpts['validinc'] = [
        ValidityOutputGenerator,
        DocGeneratorOptions(conventions=conventions,
                            filename='timeMarker',
                            directory=directory,
                            genpath=None,
                            apiname='vulkan',
                            profile=None,
                            versions=featuresPat,
                            emitversions=featuresPat,
                            defaultExtensions=None,
                            addExtensions=addExtensionsPat,
                            removeExtensions=removeExtensionsPat,
                            emitExtensions=emitExtensionsPat)
    ]

    # API host sync table files for spec
    genOpts['hostsyncinc'] = [
        HostSynchronizationOutputGenerator,
        DocGeneratorOptions(conventions=conventions,
                            filename='timeMarker',
                            directory=directory,
                            genpath=None,
                            apiname='vulkan',
                            profile=None,
                            versions=featuresPat,
                            emitversions=featuresPat,
                            defaultExtensions=None,
                            addExtensions=addExtensionsPat,
                            removeExtensions=removeExtensionsPat,
                            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(conventions=conventions,
                                         filename='timeMarker',
                                         directory=directory,
                                         genpath=None,
                                         apiname='vulkan',
                                         profile=None,
                                         versions=featuresPat,
                                         emitversions=None,
                                         defaultExtensions=defaultExtensions,
                                         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,
                            genpath=None,
                            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:
    #   [0] is the generated header file name
    #   [1] is the set of platform extensions to generate
    #   [2] is additional extensions whose interfaces should be considered,
    #   but suppressed in the output, to avoid duplicate definitions of
    #   dependent types like VkDisplayKHR and VkSurfaceKHR which come from
    #   non-platform extensions.

    # Track all platform extensions, for exclusion from vulkan_core.h
    allPlatformExtensions = []

    # Extensions suppressed for all WSI platforms (WSI extensions required
    # by all platforms)
    commonSuppressExtensions = ['VK_KHR_display', 'VK_KHR_swapchain']

    # Extensions required and suppressed for beta "platform". This can
    # probably eventually be derived from the requires= attributes of
    # the extension blocks.
    betaRequireExtensions = [
        'VK_KHR_ray_tracing', 'VK_KHR_deferred_host_operations',
        'VK_KHR_pipeline_library'
    ]
    betaSuppressExtensions = ['VK_NV_ray_tracing']

    platforms = [
        [
            'vulkan_android.h',
            [
                'VK_KHR_android_surface',
                'VK_ANDROID_external_memory_android_hardware_buffer'
            ], commonSuppressExtensions
        ],
        [
            'vulkan_fuchsia.h', ['VK_FUCHSIA_imagepipe_surface'],
            commonSuppressExtensions
        ],
        [
            'vulkan_ggp.h',
            ['VK_GGP_stream_descriptor_surface', 'VK_GGP_frame_token'],
            commonSuppressExtensions
        ],
        ['vulkan_ios.h', ['VK_MVK_ios_surface'], commonSuppressExtensions],
        ['vulkan_macos.h', ['VK_MVK_macos_surface'], commonSuppressExtensions],
        ['vulkan_vi.h', ['VK_NN_vi_surface'], commonSuppressExtensions],
        [
            'vulkan_wayland.h', ['VK_KHR_wayland_surface'],
            commonSuppressExtensions
        ],
        [
            'vulkan_win32.h',
            ['VK_.*_win32(|_.*)', 'VK_EXT_full_screen_exclusive'],
            commonSuppressExtensions + [
                'VK_KHR_external_semaphore',
                'VK_KHR_external_memory_capabilities',
                'VK_KHR_external_fence',
                'VK_KHR_external_fence_capabilities',
                'VK_KHR_get_surface_capabilities2',
                'VK_NV_external_memory_capabilities',
            ]
        ],
        ['vulkan_xcb.h', ['VK_KHR_xcb_surface'], commonSuppressExtensions],
        ['vulkan_xlib.h', ['VK_KHR_xlib_surface'], commonSuppressExtensions],
        [
            'vulkan_xlib_xrandr.h', ['VK_EXT_acquire_xlib_display'],
            commonSuppressExtensions
        ],
        ['vulkan_metal.h', ['VK_EXT_metal_surface'], commonSuppressExtensions],
        ['vulkan_beta.h', betaRequireExtensions, betaSuppressExtensions],
    ]

    for platform in platforms:
        headername = platform[0]

        allPlatformExtensions += platform[1]

        addPlatformExtensionsRE = makeREstring(platform[1] + platform[2],
                                               strings_are_regex=True)
        emitPlatformExtensionsRE = makeREstring(platform[1],
                                                strings_are_regex=True)

        opts = CGeneratorOptions(conventions=conventions,
                                 filename=headername,
                                 directory=directory,
                                 genpath=None,
                                 apiname='vulkan',
                                 profile=None,
                                 versions=featuresPat,
                                 emitversions=None,
                                 defaultExtensions=None,
                                 addExtensions=addPlatformExtensionsRE,
                                 removeExtensions=None,
                                 emitExtensions=emitPlatformExtensionsRE,
                                 prefixText=prefixStrings + vkPrefixStrings,
                                 genFuncPointers=True,
                                 protectFile=protectFile,
                                 protectFeature=False,
                                 protectProto='#ifndef',
                                 protectProtoStr='VK_NO_PROTOTYPES',
                                 apicall='VKAPI_ATTR ',
                                 apientry='VKAPI_CALL ',
                                 apientryp='VKAPI_PTR *',
                                 alignFuncParam=48)

        genOpts[headername] = [COutputGenerator, opts]

    # Header for core API + extensions.
    # To generate just the core API,
    # change to 'defaultExtensions = None' below.
    #
    # By default this adds all enabled, non-platform extensions.
    # It removes all platform extensions (from the platform headers options
    # constructed above) as well as any explicitly specified removals.

    removeExtensionsPat = makeREstring(allPlatformExtensions +
                                       removeExtensions,
                                       None,
                                       strings_are_regex=True)

    genOpts['vulkan_core.h'] = [
        COutputGenerator,
        CGeneratorOptions(conventions=conventions,
                          filename='vulkan_core.h',
                          directory=directory,
                          genpath=None,
                          apiname='vulkan',
                          profile=None,
                          versions=featuresPat,
                          emitversions=featuresPat,
                          defaultExtensions=defaultExtensions,
                          addExtensions=None,
                          removeExtensions=removeExtensionsPat,
                          emitExtensions=emitExtensionsPat,
                          prefixText=prefixStrings + vkPrefixStrings,
                          genFuncPointers=True,
                          protectFile=protectFile,
                          protectFeature=False,
                          protectProto='#ifndef',
                          protectProtoStr='VK_NO_PROTOTYPES',
                          apicall='VKAPI_ATTR ',
                          apientry='VKAPI_CALL ',
                          apientryp='VKAPI_PTR *',
                          alignFuncParam=48)
    ]

    # Unused - vulkan10.h target.
    # It is possible to generate a header with just the Vulkan 1.0 +
    # extension interfaces defined, but since the promoted KHR extensions
    # are now defined in terms of the 1.1 interfaces, such a header is very
    # similar to vulkan_core.h.
    genOpts['vulkan10.h'] = [
        COutputGenerator,
        CGeneratorOptions(conventions=conventions,
                          filename='vulkan10.h',
                          directory=directory,
                          genpath=None,
                          apiname='vulkan',
                          profile=None,
                          versions='VK_VERSION_1_0',
                          emitversions='VK_VERSION_1_0',
                          defaultExtensions=None,
                          addExtensions=None,
                          removeExtensions=None,
                          emitExtensions=None,
                          prefixText=prefixStrings + vkPrefixStrings,
                          genFuncPointers=True,
                          protectFile=protectFile,
                          protectFeature=False,
                          protectProto='#ifndef',
                          protectProtoStr='VK_NO_PROTOTYPES',
                          apicall='VKAPI_ATTR ',
                          apientry='VKAPI_CALL ',
                          apientryp='VKAPI_PTR *',
                          alignFuncParam=48)
    ]

    # Unused - vulkan11.h target.
    # It is possible to generate a header with just the Vulkan 1.0 +
    # extension interfaces defined, but since the promoted KHR extensions
    # are now defined in terms of the 1.1 interfaces, such a header is very
    # similar to vulkan_core.h.
    genOpts['vulkan11.h'] = [
        COutputGenerator,
        CGeneratorOptions(conventions=conventions,
                          filename='vulkan11.h',
                          directory=directory,
                          genpath=None,
                          apiname='vulkan',
                          profile=None,
                          versions='^VK_VERSION_1_[01]$',
                          emitversions='^VK_VERSION_1_[01]$',
                          defaultExtensions=None,
                          addExtensions=None,
                          removeExtensions=None,
                          emitExtensions=None,
                          prefixText=prefixStrings + vkPrefixStrings,
                          genFuncPointers=True,
                          protectFile=protectFile,
                          protectFeature=False,
                          protectProto='#ifndef',
                          protectProtoStr='VK_NO_PROTOTYPES',
                          apicall='VKAPI_ATTR ',
                          apientry='VKAPI_CALL ',
                          apientryp='VKAPI_PTR *',
                          alignFuncParam=48)
    ]

    genOpts['alias.h'] = [
        COutputGenerator,
        CGeneratorOptions(conventions=conventions,
                          filename='alias.h',
                          directory=directory,
                          genpath=None,
                          apiname='vulkan',
                          profile=None,
                          versions=featuresPat,
                          emitversions=featuresPat,
                          defaultExtensions=defaultExtensions,
                          addExtensions=None,
                          removeExtensions=removeExtensionsPat,
                          emitExtensions=emitExtensionsPat,
                          prefixText=None,
                          genFuncPointers=False,
                          protectFile=False,
                          protectFeature=False,
                          protectProto='',
                          protectProtoStr='',
                          apicall='',
                          apientry='',
                          apientryp='',
                          alignFuncParam=36)
    ]
Пример #4
0
def makeGenOpts(args):
    global genOpts
    genOpts = {}

    # Default class of extensions to include, or None
    defaultExtensions = args.defaultExtensions

    # Additional extensions to include (list of extensions)
    extensions = args.extension

    # Extensions to remove (list of extensions)
    removeExtensions = args.removeExtensions

    # Extensions to emit (list of extensions)
    emitExtensions = args.emitExtensions

    # Features to include (list of features)
    features = args.feature

    # Whether to disable inclusion protect in headers
    protect = args.protect

    # Output target directory
    directory = args.directory

    # Descriptive names for various regexp patterns used to select
    # versions and extensions
    allFeatures = allExtensions = '.*'
    noFeatures = noExtensions = None

    # Turn lists of names/patterns into matching regular expressions
    addExtensionsPat = makeREstring(extensions, None)
    removeExtensionsPat = makeREstring(removeExtensions, None)
    emitExtensionsPat = makeREstring(emitExtensions, allExtensions)
    featuresPat = makeREstring(features, allFeatures)

    # Copyright text prefixing all headers (list of strings).
    prefixStrings = [
        '/*', '** Copyright (c) 2015-2019 The Khronos Group Inc.', '**',
        '** Licensed under the Apache License, Version 2.0 (the "License");',
        '** you may not use this file except in compliance with the License.',
        '** You may obtain a copy of the License at', '**',
        '**     http://www.apache.org/licenses/LICENSE-2.0', '**',
        '** Unless required by applicable law or agreed to in writing, software',
        '** distributed under the License is distributed on an "AS IS" BASIS,',
        '** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
        '** See the License for the specific language governing permissions and',
        '** limitations under the License.', '*/', ''
    ]

    # Text specific to Vulkan headers
    vkPrefixStrings = [
        '/*',
        '** This header is generated from the Khronos Vulkan XML API Registry.',
        '**', '*/', ''
    ]

    # Defaults for generating re-inclusion protection wrappers (or not)
    protectFile = protect
    protectFeature = protect
    protectProto = protect

    # An API style conventions object
    conventions = VulkanConventions()

    # API include files for spec and ref pages
    # Overwrites include subdirectories in spec source tree
    # The generated include files do not include the calling convention
    # macros (apientry etc.), unlike the header files.
    # Because the 1.0 core branch includes ref pages for extensions,
    # all the extension interfaces need to be generated, even though
    # none are used by the core spec itself.
    genOpts['apiinc'] = [
        DocOutputGenerator,
        DocGeneratorOptions(conventions=conventions,
                            filename='timeMarker',
                            directory=directory,
                            apiname='vulkan',
                            profile=None,
                            versions=featuresPat,
                            emitversions=featuresPat,
                            defaultExtensions=None,
                            addExtensions=addExtensionsPat,
                            removeExtensions=removeExtensionsPat,
                            emitExtensions=emitExtensionsPat,
                            prefixText=prefixStrings + vkPrefixStrings,
                            apicall='',
                            apientry='',
                            apientryp='*',
                            alignFuncParam=48,
                            expandEnumerants=False)
    ]

    # API names to validate man/api spec includes & links
    genOpts['vkapi.py'] = [
        PyOutputGenerator,
        DocGeneratorOptions(conventions=conventions,
                            filename='vkapi.py',
                            directory=directory,
                            apiname='vulkan',
                            profile=None,
                            versions=featuresPat,
                            emitversions=featuresPat,
                            defaultExtensions=None,
                            addExtensions=addExtensionsPat,
                            removeExtensions=removeExtensionsPat,
                            emitExtensions=emitExtensionsPat)
    ]

    # API validity files for spec
    genOpts['validinc'] = [
        ValidityOutputGenerator,
        DocGeneratorOptions(conventions=conventions,
                            filename='timeMarker',
                            directory=directory,
                            apiname='vulkan',
                            profile=None,
                            versions=featuresPat,
                            emitversions=featuresPat,
                            defaultExtensions=None,
                            addExtensions=addExtensionsPat,
                            removeExtensions=removeExtensionsPat,
                            emitExtensions=emitExtensionsPat)
    ]

    # API host sync table files for spec
    genOpts['hostsyncinc'] = [
        HostSynchronizationOutputGenerator,
        DocGeneratorOptions(conventions=conventions,
                            filename='timeMarker',
                            directory=directory,
                            apiname='vulkan',
                            profile=None,
                            versions=featuresPat,
                            emitversions=featuresPat,
                            defaultExtensions=None,
                            addExtensions=addExtensionsPat,
                            removeExtensions=removeExtensionsPat,
                            emitExtensions=emitExtensionsPat)
    ]

    # Extension metainformation for spec extension appendices
    genOpts['extinc'] = [
        ExtensionMetaDocOutputGenerator,
        ExtensionMetaDocGeneratorOptions(conventions=conventions,
                                         filename='timeMarker',
                                         directory=directory,
                                         apiname='vulkan',
                                         profile=None,
                                         versions=featuresPat,
                                         emitversions=None,
                                         defaultExtensions=defaultExtensions,
                                         addExtensions=None,
                                         removeExtensions=None,
                                         emitExtensions=emitExtensionsPat)
    ]

    # Platform extensions, in their own header files
    # Each element of the platforms[] array defines information for
    # generating a single platform:
    #   [0] is the generated header file name
    #   [1] is the set of platform extensions to generate
    #   [2] is additional extensions whose interfaces should be considered,
    #   but suppressed in the output, to avoid duplicate definitions of
    #   dependent types like VkDisplayKHR and VkSurfaceKHR which come from
    #   non-platform extensions.

    # Track all platform extensions, for exclusion from vulkan_core.h
    allPlatformExtensions = []

    # Extensions suppressed for all platforms.
    # Covers common WSI extension types.
    commonSuppressExtensions = ['VK_KHR_display', 'VK_KHR_swapchain']

    platforms = [
        [
            'vulkan_android.h',
            [
                'VK_KHR_android_surface',
                'VK_ANDROID_external_memory_android_hardware_buffer'
            ], commonSuppressExtensions
        ],
        [
            'vulkan_fuchsia.h', ['VK_FUCHSIA_imagepipe_surface'],
            commonSuppressExtensions
        ],
        [
            'vulkan_ggp.h',
            ['VK_GGP_stream_descriptor_surface', 'VK_GGP_frame_token'],
            commonSuppressExtensions
        ],
        ['vulkan_ios.h', ['VK_MVK_ios_surface'], commonSuppressExtensions],
        ['vulkan_macos.h', ['VK_MVK_macos_surface'], commonSuppressExtensions],
        ['vulkan_vi.h', ['VK_NN_vi_surface'], commonSuppressExtensions],
        [
            'vulkan_wayland.h', ['VK_KHR_wayland_surface'],
            commonSuppressExtensions
        ],
        [
            'vulkan_win32.h',
            ['VK_.*_win32(|_.*)', 'VK_EXT_full_screen_exclusive'],
            commonSuppressExtensions + [
                'VK_KHR_external_semaphore',
                'VK_KHR_external_memory_capabilities',
                'VK_KHR_external_fence',
                'VK_KHR_external_fence_capabilities',
                'VK_KHR_get_surface_capabilities2',
                'VK_NV_external_memory_capabilities',
            ]
        ],
        ['vulkan_xcb.h', ['VK_KHR_xcb_surface'], commonSuppressExtensions],
        ['vulkan_xlib.h', ['VK_KHR_xlib_surface'], commonSuppressExtensions],
        [
            'vulkan_xlib_xrandr.h', ['VK_EXT_acquire_xlib_display'],
            commonSuppressExtensions
        ],
        ['vulkan_metal.h', ['VK_EXT_metal_surface'], commonSuppressExtensions],
    ]

    for platform in platforms:
        headername = platform[0]

        allPlatformExtensions += platform[1]

        addPlatformExtensionsRE = makeREstring(platform[1] + platform[2])
        emitPlatformExtensionsRE = makeREstring(platform[1])

        opts = CGeneratorOptions(conventions=conventions,
                                 filename=headername,
                                 directory=directory,
                                 apiname='vulkan',
                                 profile=None,
                                 versions=featuresPat,
                                 emitversions=None,
                                 defaultExtensions=None,
                                 addExtensions=addPlatformExtensionsRE,
                                 removeExtensions=None,
                                 emitExtensions=emitPlatformExtensionsRE,
                                 prefixText=prefixStrings + vkPrefixStrings,
                                 genFuncPointers=True,
                                 protectFile=protectFile,
                                 protectFeature=False,
                                 protectProto='#ifndef',
                                 protectProtoStr='VK_NO_PROTOTYPES',
                                 apicall='VKAPI_ATTR ',
                                 apientry='VKAPI_CALL ',
                                 apientryp='VKAPI_PTR *',
                                 alignFuncParam=48,
                                 genEnumBeginEndRange=True)

        genOpts[headername] = [COutputGenerator, opts]

    # Header for core API + extensions.
    # To generate just the core API,
    # change to 'defaultExtensions = None' below.
    #
    # By default this adds all enabled, non-platform extensions.
    # It removes all platform extensions (from the platform headers options
    # constructed above) as well as any explicitly specified removals.

    removeExtensionsPat = makeREstring(
        allPlatformExtensions + removeExtensions, None)

    genOpts['vulkan_core.h'] = [
        COutputGenerator,
        CGeneratorOptions(conventions=conventions,
                          filename='vulkan_core.h',
                          directory=directory,
                          apiname='vulkan',
                          profile=None,
                          versions=featuresPat,
                          emitversions=featuresPat,
                          defaultExtensions=defaultExtensions,
                          addExtensions=None,
                          removeExtensions=removeExtensionsPat,
                          emitExtensions=emitExtensionsPat,
                          prefixText=prefixStrings + vkPrefixStrings,
                          genFuncPointers=True,
                          protectFile=protectFile,
                          protectFeature=False,
                          protectProto='#ifndef',
                          protectProtoStr='VK_NO_PROTOTYPES',
                          apicall='VKAPI_ATTR ',
                          apientry='VKAPI_CALL ',
                          apientryp='VKAPI_PTR *',
                          alignFuncParam=48,
                          genEnumBeginEndRange=True)
    ]

    # Unused - vulkan10.h target.
    # It is possible to generate a header with just the Vulkan 1.0 +
    # extension interfaces defined, but since the promoted KHR extensions
    # are now defined in terms of the 1.1 interfaces, such a header is very
    # similar to vulkan_core.h.
    genOpts['vulkan10.h'] = [
        COutputGenerator,
        CGeneratorOptions(conventions=conventions,
                          filename='vulkan10.h',
                          directory=directory,
                          apiname='vulkan',
                          profile=None,
                          versions='VK_VERSION_1_0',
                          emitversions='VK_VERSION_1_0',
                          defaultExtensions=defaultExtensions,
                          addExtensions=None,
                          removeExtensions=removeExtensionsPat,
                          emitExtensions=emitExtensionsPat,
                          prefixText=prefixStrings + vkPrefixStrings,
                          genFuncPointers=True,
                          protectFile=protectFile,
                          protectFeature=False,
                          protectProto='#ifndef',
                          protectProtoStr='VK_NO_PROTOTYPES',
                          apicall='VKAPI_ATTR ',
                          apientry='VKAPI_CALL ',
                          apientryp='VKAPI_PTR *',
                          alignFuncParam=48)
    ]

    genOpts['alias.h'] = [
        COutputGenerator,
        CGeneratorOptions(conventions=conventions,
                          filename='alias.h',
                          directory=directory,
                          apiname='vulkan',
                          profile=None,
                          versions=featuresPat,
                          emitversions=featuresPat,
                          defaultExtensions=defaultExtensions,
                          addExtensions=None,
                          removeExtensions=removeExtensionsPat,
                          emitExtensions=emitExtensionsPat,
                          prefixText=None,
                          genFuncPointers=False,
                          protectFile=False,
                          protectFeature=False,
                          protectProto='',
                          protectProtoStr='',
                          apicall='',
                          apientry='',
                          apientryp='',
                          alignFuncParam=36)
    ]
Пример #5
0
def makeGenOpts(args):
    global genOpts
    genOpts = {}

    # Default class of extensions to include, or None
    defaultExtensions = args.defaultExtensions

    # Additional extensions to include (list of extensions)
    extensions = args.extension

    # Extensions to remove (list of extensions)
    removeExtensions = args.removeExtensions

    # Extensions to emit (list of extensions)
    emitExtensions = args.emitExtensions

    # Features to include (list of features)
    features = args.feature

    # Whether to disable inclusion protect in headers
    protect = args.protect

    # Output target directory
    directory = args.directory

    # Descriptive names for various regexp patterns used to select
    # versions and extensions
    allFeatures = allExtensions = '.*'
    noFeatures = noExtensions = None

    # Turn lists of names/patterns into matching regular expressions
    addExtensionsPat = makeREstring(extensions, None)
    removeExtensionsPat = makeREstring(removeExtensions, None)
    emitExtensionsPat = makeREstring(emitExtensions, allExtensions)
    featuresPat = makeREstring(features, allFeatures)

    # Copyright text prefixing all headers (list of strings).
    prefixStrings = [
        '/*', '** Copyright (c) 2015-2018 The Khronos Group Inc.', '**',
        '** Licensed under the Apache License, Version 2.0 (the "License");',
        '** you may not use this file except in compliance with the License.',
        '** You may obtain a copy of the License at', '**',
        '**     http://www.apache.org/licenses/LICENSE-2.0', '**',
        '** Unless required by applicable law or agreed to in writing, software',
        '** distributed under the License is distributed on an "AS IS" BASIS,',
        '** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
        '** See the License for the specific language governing permissions and',
        '** limitations under the License.', '*/', ''
    ]

    # Text specific to Vulkan headers
    vkPrefixStrings = [
        '/*',
        '** This header is generated from the Khronos Vulkan XML API Registry.',
        '**', '*/', ''
    ]

    # Defaults for generating re-inclusion protection wrappers (or not)
    protectFeature = protect

    # An API style conventions object
    conventions = VulkanConventions()

    # Helper file generator options for typemap_helper.h
    genOpts['vk_typemap_helper.h'] = [
        HelperFileOutputGenerator,
        HelperFileOutputGeneratorOptions(
            conventions=conventions,
            filename='vk_typemap_helper.h',
            directory=directory,
            apiname='vulkan',
            profile=None,
            versions=featuresPat,
            emitversions=featuresPat,
            defaultExtensions='vulkan',
            addExtensions=addExtensionsPat,
            removeExtensions=removeExtensionsPat,
            emitExtensions=emitExtensionsPat,
            prefixText=prefixStrings + vkPrefixStrings,
            protectFeature=False,
            apicall='VKAPI_ATTR ',
            apientry='VKAPI_CALL ',
            apientryp='VKAPI_PTR *',
            alignFuncParam=48,
            expandEnumerants=False,
            helper_file_type='typemap_helper_header')
    ]

    # Options for mock ICD header
    genOpts['mock_icd.h'] = [
        MockICDOutputGenerator,
        MockICDGeneratorOptions(conventions=conventions,
                                filename='mock_icd.h',
                                directory=directory,
                                apiname='vulkan',
                                profile=None,
                                versions=featuresPat,
                                emitversions=featuresPat,
                                defaultExtensions='vulkan',
                                addExtensions=addExtensionsPat,
                                removeExtensions=removeExtensionsPat,
                                emitExtensions=emitExtensionsPat,
                                prefixText=prefixStrings + vkPrefixStrings,
                                protectFeature=False,
                                apicall='VKAPI_ATTR ',
                                apientry='VKAPI_CALL ',
                                apientryp='VKAPI_PTR *',
                                alignFuncParam=48,
                                expandEnumerants=False,
                                helper_file_type='mock_icd_header')
    ]

    # Options for mock ICD cpp
    genOpts['mock_icd.cpp'] = [
        MockICDOutputGenerator,
        MockICDGeneratorOptions(conventions=conventions,
                                filename='mock_icd.cpp',
                                directory=directory,
                                apiname='vulkan',
                                profile=None,
                                versions=featuresPat,
                                emitversions=featuresPat,
                                defaultExtensions='vulkan',
                                addExtensions=addExtensionsPat,
                                removeExtensions=removeExtensionsPat,
                                emitExtensions=emitExtensionsPat,
                                prefixText=prefixStrings + vkPrefixStrings,
                                protectFeature=False,
                                apicall='VKAPI_ATTR ',
                                apientry='VKAPI_CALL ',
                                apientryp='VKAPI_PTR *',
                                alignFuncParam=48,
                                expandEnumerants=False,
                                helper_file_type='mock_icd_source')
    ]

    # Options for vulkaninfo.hpp
    genOpts['vulkaninfo.hpp'] = [
        VulkanInfoGenerator,
        VulkanInfoGeneratorOptions(conventions=conventions,
                                   filename='vulkaninfo.hpp',
                                   directory=directory,
                                   apiname='vulkan',
                                   profile=None,
                                   versions=featuresPat,
                                   emitversions=featuresPat,
                                   defaultExtensions='vulkan',
                                   addExtensions=addExtensionsPat,
                                   removeExtensions=removeExtensionsPat,
                                   emitExtensions=emitExtensionsPat,
                                   prefixText=prefixStrings + vkPrefixStrings,
                                   protectFeature=False,
                                   apicall='VKAPI_ATTR ',
                                   apientry='VKAPI_CALL ',
                                   apientryp='VKAPI_PTR *',
                                   alignFuncParam=48,
                                   expandEnumerants=False)
    ]
Пример #6
0
                 sections=sections,
                 tail_content=makeExtensionInclude(name))
    refPageTail(pageName=name,
                specType=None,
                specAnchor=name,
                seeAlso=seeAlsoList(name, declares),
                fp=fp,
                auto=True)
    fp.close()


if __name__ == '__main__':
    global genDict, extensions, conventions, apiName
    genDict = {}
    extensions = OrderedDict()
    conventions = APIConventions()
    apiName = conventions.api_name('api')

    parser = argparse.ArgumentParser()

    parser.add_argument('-diag',
                        action='store',
                        dest='diagFile',
                        help='Set the diagnostic file')
    parser.add_argument('-warn',
                        action='store',
                        dest='warnFile',
                        help='Set the warning file')
    parser.add_argument(
        '-log',
        action='store',
def makeGenOpts(args):
    global genOpts
    genOpts = {}

    # Default class of extensions to include, or None
    defaultExtensions = args.defaultExtensions

    # Additional extensions to include (list of extensions)
    extensions = args.extension

    # Extensions to remove (list of extensions)
    removeExtensions = args.removeExtensions

    # Extensions to emit (list of extensions)
    emitExtensions = args.emitExtensions

    # Features to include (list of features)
    features = args.feature

    # Whether to disable inclusion protect in headers
    protect = args.protect

    # Output target directory
    directory = args.directory

    # Descriptive names for various regexp patterns used to select
    # versions and extensions
    allFeatures     = allExtensions = '.*'
    noFeatures      = noExtensions = None

    # Turn lists of names/patterns into matching regular expressions
    addExtensionsPat     = makeREstring(extensions, None)
    removeExtensionsPat  = makeREstring(removeExtensions, None)
    emitExtensionsPat    = makeREstring(emitExtensions, allExtensions)
    featuresPat          = makeREstring(features, allFeatures)

    if len(features) > 0:
        features = makeREstring(features)
    else:
        features = allFeatures

    # write('* Selecting features: ', features, file=sys.stderr)

    # Copyright text prefixing all headers (list of strings).
    prefixStrings = [
        '/*',
        '** Copyright (c) 2015-2017 The Khronos Group Inc.',
        '**',
        '** Licensed under the Apache License, Version 2.0 (the "License");',
        '** you may not use this file except in compliance with the License.',
        '** You may obtain a copy of the License at',
        '**',
        '**     http://www.apache.org/licenses/LICENSE-2.0',
        '**',
        '** Unless required by applicable law or agreed to in writing, software',
        '** distributed under the License is distributed on an "AS IS" BASIS,',
        '** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
        '** See the License for the specific language governing permissions and',
        '** limitations under the License.',
        '*/',
        ''
    ]

    # Text specific to Vulkan headers
    vkPrefixStrings = [
        '/*',
        '** This header is generated from the Khronos Vulkan XML API Registry.',
        '**',
        '*/',
        ''
    ]

    # Defaults for generating re-inclusion protection wrappers (or not)
    protectFeature = protect

    # An API style convention object
    conventions = VulkanConventions()

    # Options for Vulkan Layer Factory header
    genOpts['layer_factory.h'] = [
          LayerFactoryOutputGenerator,
          LayerFactoryGeneratorOptions(
            conventions       = conventions,
            filename          = 'layer_factory.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            helper_file_type  = 'layer_factory_header',
            expandEnumerants = False)
        ]

    # Options for Vulkan Layer Factory source file
    genOpts['layer_factory.cpp'] = [
          LayerFactoryOutputGenerator,
          LayerFactoryGeneratorOptions(
            conventions       = conventions,
            filename          = 'layer_factory.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            helper_file_type  = 'layer_factory_source',
            expandEnumerants = False)
        ]

    # API dump generator options for api_dump.cpp
    genOpts['api_dump.cpp'] = [
        ApiDumpOutputGenerator,
        ApiDumpGeneratorOptions(
            conventions       = conventions,
            input             = COMMON_CODEGEN,
            filename          = 'api_dump.cpp',
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            genFuncPointers   = True,
            protectFile       = protect,
            protectFeature    = False,
            protectProto      = None,
            protectProtoStr   = 'VK_NO_PROTOTYPES',
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants = False)
        ]

    # API dump generator options for api_dump_text.h
    genOpts['api_dump_text.h'] = [
        ApiDumpOutputGenerator,
        ApiDumpGeneratorOptions(
            conventions       = conventions,
            input             = TEXT_CODEGEN,
            filename          = 'api_dump_text.h',
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            genFuncPointers   = True,
            protectFile       = protect,
            protectFeature    = False,
            protectProto      = None,
            protectProtoStr   = 'VK_NO_PROTOTYPES',
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False)
    ]

    # API dump generator options for api_dump_html.h
    genOpts['api_dump_html.h'] = [
        ApiDumpOutputGenerator,
        ApiDumpGeneratorOptions(
            conventions       = conventions,
            input             = HTML_CODEGEN,
            filename          = 'api_dump_html.h',
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            genFuncPointers   = True,
            protectFile       = protect,
            protectFeature    = False,
            protectProto      = None,
            protectProtoStr   = 'VK_NO_PROTOTYPES',
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False)
    ]

    # API dump generator options for api_dump_json.h
    genOpts['api_dump_json.h'] = [
        ApiDumpOutputGenerator,
        ApiDumpGeneratorOptions(
            conventions       = conventions,
            input             = JSON_CODEGEN,
            filename          = 'api_dump_json.h',
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            genFuncPointers   = True,
            protectFile       = protect,
            protectFeature    = False,
            protectProto      = None,
            protectProtoStr   = 'VK_NO_PROTOTYPES',
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants  = False)
    ]

    # VkTrace file generator options for vkreplay_vk_objmapper.h
    genOpts['vkreplay_vk_objmapper.h'] = [
          VkTraceFileOutputGenerator,
          VkTraceFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vkreplay_vk_objmapper.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            vktrace_file_type  = 'vkreplay_objmapper_header',
            expandEnumerants  = False)
        ]

    # VkTrace file generator options for vkreplay_vk_func_ptrs.h
    genOpts['vkreplay_vk_func_ptrs.h'] = [
          VkTraceFileOutputGenerator,
          VkTraceFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vkreplay_vk_func_ptrs.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            vktrace_file_type  = 'vkreplay_funcptr_header',
            expandEnumerants  = False)
        ]

    # VkTrace file generator options for vkreplay_vk_replay_gen.cpp
    genOpts['vkreplay_vk_replay_gen.cpp'] = [
          VkTraceFileOutputGenerator,
          VkTraceFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vkreplay_vk_replay_gen.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            vktrace_file_type  = 'vkreplay_replay_gen_source',
            expandEnumerants  = False)
        ]

    # VkTrace file generator options for vktracedump_vk_dump_gen.cpp
    genOpts['vktracedump_vk_dump_gen.cpp'] = [
          VkTraceFileOutputGenerator,
          VkTraceFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vktracedump_vk_dump_gen.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            genFuncPointers   = True,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            vktrace_file_type  = 'vktrace_dump_gen_source',
            expandEnumerants  = False)
        ]


    # VkTrace file generator options for vktrace_vk_packet_id.h
    genOpts['vktrace_vk_packet_id.h'] = [
          VkTraceFileOutputGenerator,
          VkTraceFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vktrace_vk_packet_id.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            vktrace_file_type  = 'vktrace_packet_id_header',
            expandEnumerants  = False)
        ]

    # VkTrace file generator options for vktrace_vk_vk.h
    genOpts['vktrace_vk_vk.h'] = [
          VkTraceFileOutputGenerator,
          VkTraceFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vktrace_vk_vk.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            vktrace_file_type  = 'vktrace_vk_header',
            expandEnumerants  = False)
        ]

    # VkTrace file generator options for vktrace_vk_vk.cpp
    genOpts['vktrace_vk_vk.cpp'] = [
          VkTraceFileOutputGenerator,
          VkTraceFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vktrace_vk_vk.cpp',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            vktrace_file_type  = 'vktrace_vk_source',
            expandEnumerants  = False)
        ]

    # VkTrace file generator options for vktrace_vk_vk_packets.h
    genOpts['vktrace_vk_vk_packets.h'] = [
          VkTraceFileOutputGenerator,
          VkTraceFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vktrace_vk_vk_packets.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFile       = protect,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            vktrace_file_type  = 'vktrace_vk_packets_header',
            expandEnumerants  = False)
        ]

    # Helper file generator options for vk_struct_size_helper.h
    genOpts['vk_struct_size_helper.h'] = [
          ToolHelperFileOutputGenerator,
          ToolHelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_struct_size_helper.h',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            helper_file_type  = 'struct_size_header')
        ]

    # Helper file generator options for vk_struct_size_helper.c
    genOpts['vk_struct_size_helper.c'] = [
          ToolHelperFileOutputGenerator,
          ToolHelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_struct_size_helper.c',
            directory         = directory,
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            protectFeature    = False,
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            helper_file_type  = 'struct_size_source')
        ]

    # API cost generator options for api_cost.cpp
    genOpts['api_cost.cpp'] = [
        ApiDumpOutputGenerator,
        ApiDumpGeneratorOptions(
            input             = APICOST_CODEGEN,
            filename          = 'api_cost.cpp',
            apiname           = 'vulkan',
            profile           = None,
            versions          = featuresPat,
            emitversions      = featuresPat,
            defaultExtensions = 'vulkan',
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            prefixText        = prefixStrings + vkPrefixStrings,
            genFuncPointers   = True,
            protectFile       = protect,
            protectFeature    = False,
            protectProto      = None,
            protectProtoStr   = 'VK_NO_PROTOTYPES',
            apicall           = 'VKAPI_ATTR ',
            apientry          = 'VKAPI_CALL ',
            apientryp         = 'VKAPI_PTR *',
            alignFuncParam    = 48,
            expandEnumerants = False)
        ]
Пример #8
0
def makeGenOpts(args):
    global genOpts
    genOpts = {}

    # Default class of extensions to include, or None
    defaultExtensions = args.defaultExtensions

    # Additional extensions to include (list of extensions)
    extensions = args.extension

    # Extensions to remove (list of extensions)
    removeExtensions = args.removeExtensions

    # Extensions to emit (list of extensions)
    emitExtensions = args.emitExtensions

    # Features to include (list of features)
    features = args.feature

    # Spirv elements to emit (list of extensions and capabilities)
    emitSpirv = args.emitSpirv

    # Whether to disable inclusion protect in headers
    protect = args.protect

    # Output target directory
    directory = args.directory

    # Path to generated files, particularly api.py
    genpath = args.genpath

    # Descriptive names for various regexp patterns used to select
    # versions and extensions
    allFeatures     = allExtensions = allSpirv = '.*'
    noFeatures      = noExtensions = noSpirv = None

    # Turn lists of names/patterns into matching regular expressions
    addExtensionsPat     = makeREstring(extensions, None)
    removeExtensionsPat  = makeREstring(removeExtensions, None)
    emitExtensionsPat    = makeREstring(emitExtensions, allExtensions)
    featuresPat          = makeREstring(features, allFeatures)
    emitSpirvPat         = makeREstring(emitSpirv, allSpirv)

    # Defaults for generating re-inclusion protection wrappers (or not)
    protectFeature = protect

    # An API style convention object
    conventions = VulkanConventions()

    # ValidationLayer Generators
    # Options for thread safety header code-generation
    genOpts['thread_safety.h'] = [
          ThreadOutputGenerator,
          ThreadGeneratorOptions(
            conventions       = conventions,
            filename          = 'thread_safety.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat)
        ]

    # Options for thread safety source code-generation
    genOpts['thread_safety.cpp'] = [
          ThreadOutputGenerator,
          ThreadGeneratorOptions(
            conventions       = conventions,
            filename          = 'thread_safety.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat)
        ]

    # Options for stateless validation source file
    genOpts['parameter_validation.cpp'] = [
          ParameterValidationOutputGenerator,
          ParameterValidationGeneratorOptions(
            conventions       = conventions,
            filename          = 'parameter_validation.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            valid_usage_path  = args.scripts)
          ]

    # Options for stateless validation source file
    genOpts['parameter_validation.h'] = [
          ParameterValidationOutputGenerator,
          ParameterValidationGeneratorOptions(
            conventions       = conventions,
            filename          = 'parameter_validation.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            valid_usage_path  = args.scripts)
          ]

    # Options for object_tracker code-generated validation routines
    genOpts['object_tracker.cpp'] = [
          ObjectTrackerOutputGenerator,
          ObjectTrackerGeneratorOptions(
            conventions       = conventions,
            filename          = 'object_tracker.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            valid_usage_path  = args.scripts)
        ]

    # Options for object_tracker code-generated prototypes
    genOpts['object_tracker.h'] = [
          ObjectTrackerOutputGenerator,
          ObjectTrackerGeneratorOptions(
            conventions       = conventions,
            filename          = 'object_tracker.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            valid_usage_path  = args.scripts)
        ]

    # Options for dispatch table helper generator
    genOpts['vk_dispatch_table_helper.h'] = [
          DispatchTableHelperOutputGenerator,
          DispatchTableHelperOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_dispatch_table_helper.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat)
        ]

    # lvt_file generator options for lvt_function_pointers.h
    genOpts['lvt_function_pointers.h'] = [
          LvtFileOutputGenerator,
          LvtFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'lvt_function_pointers.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            lvt_file_type  = 'function_pointer_header')
        ]

    # lvt_file generator options for lvt_function_pointers.cpp
    genOpts['lvt_function_pointers.cpp'] = [
          LvtFileOutputGenerator,
          LvtFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'lvt_function_pointers.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            lvt_file_type  = 'function_pointer_source')
        ]

    # Options for Layer dispatch table generator
    genOpts['vk_layer_dispatch_table.h'] = [
          LayerDispatchTableOutputGenerator,
          LayerDispatchTableGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_layer_dispatch_table.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat)
        ]

    # Helper file generator options for vk_enum_string_helper.h
    genOpts['vk_enum_string_helper.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_enum_string_helper.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'enum_string_header')
        ]

    # Helper file generator options for vk_safe_struct.h
    genOpts['vk_safe_struct.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_safe_struct.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'safe_struct_header')
        ]

    # Helper file generator options for vk_safe_struct.cpp
    genOpts['vk_safe_struct.cpp'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_safe_struct.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'safe_struct_source')
        ]

    # Helper file generator options for vk_object_types.h
    genOpts['vk_object_types.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_object_types.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'object_types_header')
        ]

    # Helper file generator options for extension_helper.h
    genOpts['vk_extension_helper.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_extension_helper.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'extension_helper_header')
        ]

    # Helper file generator options for typemap_helper.h
    genOpts['vk_typemap_helper.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'vk_typemap_helper.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'typemap_helper_header')
        ]

    # Helper file generator options for corechecks_optick_instrumentation.h
    genOpts['corechecks_optick_instrumentation.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'corechecks_optick_instrumentation.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'optick_instrumentation_header')
        ]

    # Helper file generator options for corechecks_optick_instrumentation.cpp
    genOpts['corechecks_optick_instrumentation.cpp'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'corechecks_optick_instrumentation.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'optick_instrumentation_source')
        ]

    # Layer chassis related generation structs
    # Options for layer chassis header
    genOpts['chassis.h'] = [
          LayerChassisOutputGenerator,
          LayerChassisGeneratorOptions(
            conventions       = conventions,
            filename          = 'chassis.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'layer_chassis_header')
        ]

    # Options for layer chassis source file
    genOpts['chassis.cpp'] = [
          LayerChassisOutputGenerator,
          LayerChassisGeneratorOptions(
            conventions       = conventions,
            filename          = 'chassis.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'layer_chassis_source')
        ]

    # Layer chassis related generation structs
    # Options for layer chassis header
    genOpts['chassis_dispatch_helper.h'] = [
          LayerChassisOutputGenerator,
          LayerChassisGeneratorOptions(
            conventions       = conventions,
            filename          = 'chassis_dispatch_helper.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'layer_chassis_helper_header')
        ]



    # Options for layer chassis dispatch source file
    genOpts['layer_chassis_dispatch.cpp'] = [
          LayerChassisDispatchOutputGenerator,
          LayerChassisDispatchGeneratorOptions(
            conventions       = conventions,
            filename          = 'layer_chassis_dispatch.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat)
        ]

    # Options for layer chassis dispatch header file
    genOpts['layer_chassis_dispatch.h'] = [
          LayerChassisDispatchOutputGenerator,
          LayerChassisDispatchGeneratorOptions(
            conventions       = conventions,
            filename          = 'layer_chassis_dispatch.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat)
        ]

    # Options for best practices code-generated source
    genOpts['best_practices.cpp'] = [
          BestPracticesOutputGenerator,
          BestPracticesOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'best_practices.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat)
        ]

    # Options for best_practices code-generated header
    genOpts['best_practices.h'] = [
          BestPracticesOutputGenerator,
          BestPracticesOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'best_practices.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat)
        ]

# Create an API generator and corresponding generator options based on
# the requested target and command line options.
    # Helper file generator options for synchronization_validation_types.h
    genOpts['synchronization_validation_types.h'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'synchronization_validation_types.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'synchronization_helper_header',
            valid_usage_path  = args.scripts)
        ]

    genOpts['synchronization_validation_types.cpp'] = [
          HelperFileOutputGenerator,
          HelperFileOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'synchronization_validation_types.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            helper_file_type  = 'synchronization_helper_source',
            valid_usage_path  = args.scripts)
        ]

    # Options for spirv_validation_helper code-generated header
    genOpts['spirv_validation_helper.cpp'] = [
          SpirvValidationHelperOutputGenerator,
          SpirvValidationHelperOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'spirv_validation_helper.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            emitSpirv         = emitSpirvPat)
        ]

    # Options for spirv_grammar_helper code-generated source
    # Only uses spirv grammar and not the vk.xml
    genOpts['spirv_grammar_helper.cpp'] = [
          SpirvGrammarHelperOutputGenerator,
          SpirvGrammarHelperOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'spirv_grammar_helper.cpp',
            directory         = directory,
            grammar           = args.grammar)
        ]

    # Options for spirv_grammar_helper code-generated header
    # Only uses spirv grammar and not the vk.xml
    genOpts['spirv_grammar_helper.h'] = [
          SpirvGrammarHelperOutputGenerator,
          SpirvGrammarHelperOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'spirv_grammar_helper.h',
            directory         = directory,
            grammar           = args.grammar)
        ]

    # Options for command_validation code-generated header
    genOpts['command_validation.cpp'] = [
          CommandValidationOutputGenerator,
          CommandValidationOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'command_validation.cpp',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            valid_usage_path  = args.scripts)
        ]

    # generator for command_validation.h
    genOpts['command_validation.h'] = [
          CommandValidationOutputGenerator,
          CommandValidationOutputGeneratorOptions(
            conventions       = conventions,
            filename          = 'command_validation.h',
            directory         = directory,
            versions          = featuresPat,
            emitversions      = featuresPat,
            addExtensions     = addExtensionsPat,
            removeExtensions  = removeExtensionsPat,
            emitExtensions    = emitExtensionsPat,
            valid_usage_path  = args.scripts)
        ]