def makeGenOpts(extensions=[], removeExtensions=[], protect=True, directory='.'): global genOpts genOpts = {} # Descriptive names for various regexp patterns used to select # versions and extensions allVersions = allExtensions = '.*' noVersions = noExtensions = None addExtensions = makeREstring(extensions) removeExtensions = makeREstring(removeExtensions) # 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) protectFile = protect protectFeature = protect protectProto = protect # # LoaderAndValidationLayer Generators # Options for threading layer genOpts['thread_check.h'] = [ ThreadOutputGenerator, ThreadGeneratorOptions(filename='thread_check.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # Options for parameter validation layer genOpts['parameter_validation.cpp'] = [ ParameterValidationOutputGenerator, ParameterValidationGeneratorOptions( filename='parameter_validation.cpp', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # Options for unique objects layer genOpts['unique_objects_wrappers.h'] = [ UniqueObjectsOutputGenerator, UniqueObjectsGeneratorOptions(filename='unique_objects_wrappers.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # Options for object_tracker layer genOpts['object_tracker.cpp'] = [ ObjectTrackerOutputGenerator, ObjectTrackerGeneratorOptions(filename='object_tracker.cpp', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # Options for dispatch table helper generator genOpts['vk_dispatch_table_helper.h'] = [ DispatchTableHelperOutputGenerator, DispatchTableHelperOutputGeneratorOptions( filename='vk_dispatch_table_helper.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # Options for Layer dispatch table generator genOpts['vk_layer_dispatch_table.h'] = [ LoaderExtensionOutputGenerator, LoaderExtensionGeneratorOptions(filename='vk_layer_dispatch_table.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # Options for loader extension source generator genOpts['vk_loader_extensions.h'] = [ LoaderExtensionOutputGenerator, LoaderExtensionGeneratorOptions(filename='vk_loader_extensions.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # Options for loader extension source generator genOpts['vk_loader_extensions.c'] = [ LoaderExtensionOutputGenerator, LoaderExtensionGeneratorOptions(filename='vk_loader_extensions.c', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # Helper file generator options for vk_enum_string_helper.h genOpts['vk_enum_string_helper.h'] = [ HelperFileOutputGenerator, HelperFileOutputGeneratorOptions(filename='vk_enum_string_helper.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, helper_file_type='enum_string_header') ] # Helper file generator options for vk_struct_size_helper.h genOpts['vk_struct_size_helper.h'] = [ HelperFileOutputGenerator, HelperFileOutputGeneratorOptions(filename='vk_struct_size_helper.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, 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'] = [ HelperFileOutputGenerator, HelperFileOutputGeneratorOptions(filename='vk_struct_size_helper.c', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, helper_file_type='struct_size_source') ] # Helper file generator options for vk_safe_struct.h genOpts['vk_safe_struct.h'] = [ HelperFileOutputGenerator, HelperFileOutputGeneratorOptions(filename='vk_safe_struct.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, helper_file_type='safe_struct_header') ] # Helper file generator options for vk_safe_struct.cpp genOpts['vk_safe_struct.cpp'] = [ HelperFileOutputGenerator, HelperFileOutputGeneratorOptions(filename='vk_safe_struct.cpp', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, helper_file_type='safe_struct_source') ] # Helper file generator options for vk_object_types.h genOpts['vk_object_types.h'] = [ HelperFileOutputGenerator, HelperFileOutputGeneratorOptions( filename='vk_object_types.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, helper_file_type='object_types_header') ] # Helper file generator options for extension_helper.h genOpts['vk_extension_helper.h'] = [ HelperFileOutputGenerator, HelperFileOutputGeneratorOptions( filename='vk_extension_helper.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, helper_file_type='extension_helper_header') ] # Options for mock ICD header genOpts['mock_icd.h'] = [ MockICDOutputGenerator, MockICDGeneratorOptions(filename='mock_icd.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, helper_file_type='mock_icd_header') ] # Options for mock ICD cpp genOpts['mock_icd.cpp'] = [ MockICDOutputGenerator, MockICDGeneratorOptions(filename='mock_icd.cpp', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, helper_file_type='mock_icd_source') ] # API dump generator options for api_dump.cpp genOpts['api_dump.cpp'] = [ ApiDumpOutputGenerator, ApiDumpGeneratorOptions(input=COMMON_CODEGEN, filename='api_dump.cpp', apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=None, removeExtensions=None, prefixText=prefixStrings + vkPrefixStrings, genFuncPointers=True, protectFile=protectFile, protectFeature=False, protectProto=None, protectProtoStr='VK_NO_PROTOTYPES', apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # API dump generator options for api_dump_text.h genOpts['api_dump_text.h'] = [ ApiDumpOutputGenerator, ApiDumpGeneratorOptions(input=TEXT_CODEGEN, filename='api_dump_text.h', apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=None, removeExtensions=None, prefixText=prefixStrings + vkPrefixStrings, genFuncPointers=True, protectFile=protectFile, protectFeature=False, protectProto=None, protectProtoStr='VK_NO_PROTOTYPES', apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # API dump generator options for api_dump_html.h genOpts['api_dump_html.h'] = [ ApiDumpOutputGenerator, ApiDumpGeneratorOptions(input=HTML_CODEGEN, filename='api_dump_html.h', apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=None, removeExtensions=None, prefixText=prefixStrings + vkPrefixStrings, genFuncPointers=True, protectFile=protectFile, protectFeature=False, protectProto=None, protectProtoStr='VK_NO_PROTOTYPES', apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48) ] # VkTrace file generator options for vkreplay_vk_objmapper.h genOpts['vkreplay_vk_objmapper.h'] = [ VkTraceFileOutputGenerator, VkTraceFileOutputGeneratorOptions( filename='vkreplay_vk_objmapper.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, vktrace_file_type='vkreplay_objmapper_header') ] # VkTrace file generator options for vkreplay_vk_func_ptrs.h genOpts['vkreplay_vk_func_ptrs.h'] = [ VkTraceFileOutputGenerator, VkTraceFileOutputGeneratorOptions( filename='vkreplay_vk_func_ptrs.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, vktrace_file_type='vkreplay_funcptr_header') ] # VkTrace file generator options for vkreplay_vk_replay_gen.cpp genOpts['vkreplay_vk_replay_gen.cpp'] = [ VkTraceFileOutputGenerator, VkTraceFileOutputGeneratorOptions( filename='vkreplay_vk_replay_gen.cpp', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, vktrace_file_type='vkreplay_replay_gen_source') ] # VkTrace file generator options for vktrace_vk_packet_id.h genOpts['vktrace_vk_packet_id.h'] = [ VkTraceFileOutputGenerator, VkTraceFileOutputGeneratorOptions( filename='vktrace_vk_packet_id.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, vktrace_file_type='vktrace_packet_id_header') ] # VkTrace file generator options for vktrace_vk_vk.h genOpts['vktrace_vk_vk.h'] = [ VkTraceFileOutputGenerator, VkTraceFileOutputGeneratorOptions( filename='vktrace_vk_vk.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, vktrace_file_type='vktrace_vk_header') ] # VkTrace file generator options for vktrace_vk_vk.cpp genOpts['vktrace_vk_vk.cpp'] = [ VkTraceFileOutputGenerator, VkTraceFileOutputGeneratorOptions( filename='vktrace_vk_vk.cpp', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, vktrace_file_type='vktrace_vk_source') ] # VkTrace file generator options for vktrace_vk_vk_packets.h genOpts['vktrace_vk_vk_packets.h'] = [ VkTraceFileOutputGenerator, VkTraceFileOutputGeneratorOptions( filename='vktrace_vk_vk_packets.h', directory=directory, apiname='vulkan', profile=None, versions=allVersions, emitversions=allVersions, defaultExtensions='vulkan', addExtensions=addExtensions, removeExtensions=removeExtensions, prefixText=prefixStrings + vkPrefixStrings, protectFeature=False, apicall='VKAPI_ATTR ', apientry='VKAPI_CALL ', apientryp='VKAPI_PTR *', alignFuncParam=48, vktrace_file_type='vktrace_vk_packets_header') ]
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) ]
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) ]