From 48daa85fa10f281ffa73fb98f6901d63d1d73286 Mon Sep 17 00:00:00 2001 From: Dustin Graves Date: Tue, 10 May 2016 16:44:16 -0600 Subject: layers: Sync XML registry files from Vulkan-Docs Sync the vk.xml and related Python scripts with the latest revisions from Vulkan-Docs: - Update local copy of vk.xml from Vulkan-Docs - Merge minor changes to genvk.py and generator.py from Vulkan-Docs to local copies - Add debug marker function pointers to VkLayerDispatchTable - Update parameter_validation code generation to support use of types across API features; The core API feature needs to be aware of a structure defined by the AMD_rasterization_order feature for the purpose of pNext validation - Modify thread_check code generation to add TODO messages for debug marker support Change-Id: I4d5b98683592f4ef404cb46e5b0f6ad519912382 --- generator.py | 51 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) (limited to 'generator.py') diff --git a/generator.py b/generator.py index 4328ed4d..d9301dfa 100644 --- a/generator.py +++ b/generator.py @@ -1899,11 +1899,14 @@ class ValidityOutputGenerator(OutputGenerator): asciidoc += self.makeParameterName(paramname.text) validextensionstructs = param.attrib.get('validextensionstructs') - if validextensionstructs is None: - asciidoc += ' must: be `NULL`' - else: - extensionstructs = validextensionstructs.split(',') - asciidoc += ' must: point to one of ' + extensionstructs[:-1].join(', ') + ' or ' + extensionstructs[-1] + 'if the extension that introduced them is enabled ' + asciidoc += ' must: be `NULL`' + if validextensionstructs is not None: + extensionstructs = ['slink:' + x for x in validextensionstructs.split(',')] + asciidoc += ', or a pointer to a valid instance of ' + if len(extensionstructs) == 1: + asciidoc += validextensionstructs + else: + asciidoc += (', ').join(extensionstructs[:-1]) + ' or ' + extensionstructs[-1] asciidoc += '\n' @@ -2760,6 +2763,9 @@ class ThreadOutputGenerator(OutputGenerator): if "KHR" in name: self.appendSection('command', '// TODO - not wrapping KHR function ' + name) return + if ("DebugMarker" in name) and ("EXT" in name): + self.appendSection('command', '// TODO - not wrapping EXT function ' + name) + return # Determine first if this function needs to be intercepted startthreadsafety = self.makeThreadUseBlock(cmdinfo.elem, 'start') if startthreadsafety is None: @@ -3033,19 +3039,8 @@ class ParamCheckerOutputGenerator(OutputGenerator): result = re.search(r'VK_STRUCTURE_TYPE_\w+', rawXml) if result: value = result.group(0) - # Make sure value is valid - #if value not in self.stypes: - # print('WARNING: {} is not part of the VkStructureType enumeration [{}]'.format(value, typeName)) else: - value = typeName - # Remove EXT - value = re.sub('EXT', '', value) - # Add underscore between lowercase then uppercase - value = re.sub('([a-z0-9])([A-Z])', r'\1_\2', value) - # Change to uppercase - value = value.upper() - # Add STRUCTURE_TYPE_ - value = re.sub('VK_', 'VK_STRUCTURE_TYPE_', value) + value = self.genVkStructureType(typeName) # Store the required type value self.structTypes[typeName] = self.StructType(name=name, value=value) # @@ -3200,6 +3195,26 @@ class ParamCheckerOutputGenerator(OutputGenerator): return True return False # + # Generate a VkStructureType based on a structure typename + def genVkStructureType(self, typename): + # Add underscore between lowercase then uppercase + value = re.sub('([a-z0-9])([A-Z])', r'\1_\2', typename) + # Change to uppercase + value = value.upper() + # Add STRUCTURE_TYPE_ + return re.sub('VK_', 'VK_STRUCTURE_TYPE_', value) + # + # Get the cached VkStructureType value for the specified struct typename, or generate a VkStructureType + # value assuming the struct is defined by a different feature + def getStructType(self, typename): + value = None + if typename in self.structTypes: + value = self.structTypes[typename].value + else: + value = self.genVkStructureType(typename) + #print('Generating {} for {} structure type that was not defined by the current feature'.format(value, typename)) + return value + # # Retrieve the value of the len tag def getLen(self, param): result = None @@ -3385,7 +3400,7 @@ class ParamCheckerOutputGenerator(OutputGenerator): extStructNames = 'NULL' if value.extstructs: structs = value.extstructs.split(',') - checkExpr.append('const VkStructureType allowedStructs[] = {' + ', '.join([self.structTypes[s].value for s in structs]) + '};\n') + checkExpr.append('const VkStructureType allowedStructs[] = {' + ', '.join([self.getStructType(s) for s in structs]) + '};\n') extStructCount = 'ARRAY_SIZE(allowedStructs)' extStructVar = 'allowedStructs' extStructNames = '"' + ', '.join(structs) + '"' -- cgit v1.2.3