diff options
| author | Mike Schuchardt <mikes@lunarg.com> | 2021-08-10 12:43:16 -0700 |
|---|---|---|
| committer | Mike Schuchardt <mikes@lunarg.com> | 2021-08-10 15:35:45 -0700 |
| commit | b1c6563544f3537353eaa450cba7969c1c6fd8f9 (patch) | |
| tree | 7f0db13f19deb17c558355c45608a4013bb88fd5 /scripts | |
| parent | 8dca1fa770824124d0240032c58254d1b0e4b8ff (diff) | |
| download | usermoji-b1c6563544f3537353eaa450cba7969c1c6fd8f9.tar.xz | |
scripts: Use altlen instead of parsing latexmath
KhronosGroup/Vulkan-ValidationLayers switched to this method a while ago
and this syncs the KhronosGroup/Vulkan-Tools version of
helper_file_generator.py to match.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/vulkan_tools_helper_file_generator.py | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/scripts/vulkan_tools_helper_file_generator.py b/scripts/vulkan_tools_helper_file_generator.py index 02170273..1b24a5e4 100644 --- a/scripts/vulkan_tools_helper_file_generator.py +++ b/scripts/vulkan_tools_helper_file_generator.py @@ -263,32 +263,6 @@ class HelperFileOutputGenerator(OutputGenerator): elif elem.tag == 'name': name = noneStr(elem.text) return (type, name) - # Extract length values from latexmath. Currently an inflexible solution that looks for specific - # patterns that are found in vk.xml. Will need to be updated when new patterns are introduced. - def parseLateXMath(self, source): - name = 'ERROR' - decoratedName = 'ERROR' - if 'mathit' in source: - # Matches expressions similar to 'latexmath:[\lceil{\mathit{rasterizationSamples} \over 32}\rceil]' - match = re.match(r'latexmath\s*\:\s*\[\s*\\l(\w+)\s*\{\s*\\mathit\s*\{\s*(\w+)\s*\}\s*\\over\s*(\d+)\s*\}\s*\\r(\w+)\s*\]', source) - if not match or match.group(1) != match.group(4): - raise 'Unrecognized latexmath expression' - name = match.group(2) - # Need to add 1 for ceiling function; otherwise, the allocated packet - # size will be less than needed during capture for some title which use - # this in VkPipelineMultisampleStateCreateInfo. based on ceiling function - # definition,it is '{0}%{1}?{0}/{1} + 1:{0}/{1}'.format(*match.group(2, 3)), - # its value <= '{}/{} + 1'. - if match.group(1) == 'ceil': - decoratedName = '{}/{} + 1'.format(*match.group(2, 3)) - else: - decoratedName = '{}/{}'.format(*match.group(2, 3)) - else: - # Matches expressions similar to 'latexmath : [dataSize \over 4]' - match = re.match(r'latexmath\s*\:\s*\[\s*(\\textrm\{)?(\w+)\}?\s*\\over\s*(\d+)\s*\]', source) - name = match.group(2) - decoratedName = '{}/{}'.format(*match.group(2, 3)) - return name, decoratedName # # Retrieve the value of the len tag def getLen(self, param): @@ -302,9 +276,10 @@ class HelperFileOutputGenerator(OutputGenerator): result = len.split(',')[0] else: result = len - if 'latexmath' in len: - param_type, param_name = self.getTypeNameTuple(param) - len_name, result = self.parseLateXMath(len) + if 'altlen' in param.attrib: + # Elements with latexmath 'len' also contain a C equivalent 'altlen' attribute + # Use indexing operator instead of get() so we fail if the attribute is missing + result = param.attrib['altlen'] # Spec has now notation for len attributes, using :: instead of platform specific pointer symbol result = str(result).replace('::', '->') return result |
