diff options
| author | mizhen <ming.zheng@amd.com> | 2017-03-31 09:08:16 -0600 |
|---|---|---|
| committer | ardaLunarG <arda@lunarg.com> | 2017-04-03 11:20:51 -0600 |
| commit | 5720c8fdc83bfbae082db9fecde482b2c1f53a48 (patch) | |
| tree | f6a445bdd19b02e5c71b6c25c7d263f2b2ec5756 | |
| parent | 3d4c146fdd1adf8048f11b3c43e8ade2f457b412 (diff) | |
| download | usermoji-5720c8fdc83bfbae082db9fecde482b2c1f53a48.tar.xz | |
scripts: Add ceiling function to vk_struct_size_helper
Change-Id: Ia377c52e43442fec17b823c888df6685eff0aca5
| -rw-r--r-- | scripts/helper_file_generator.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/helper_file_generator.py b/scripts/helper_file_generator.py index 2e7c7b2d..0d35b837 100644 --- a/scripts/helper_file_generator.py +++ b/scripts/helper_file_generator.py @@ -209,7 +209,15 @@ class HelperFileOutputGenerator(OutputGenerator): if not match or match.group(1) != match.group(4): raise 'Unrecognized latexmath expression' name = match.group(2) - decoratedName = '{}/{}'.format(*match.group(2, 3)) + # 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*(\w+)\s*\\over\s*(\d+)\s*\]', source) @@ -437,7 +445,7 @@ class HelperFileOutputGenerator(OutputGenerator): checked_type = member.type if checked_type == 'void': checked_type = 'void*' - struct_size_body += ' struct_size += struct_ptr->%s * sizeof(%s);\n' % (member.len, checked_type) + struct_size_body += ' struct_size += (struct_ptr->%s ) * sizeof(%s);\n' % (member.len, checked_type) struct_size_body += ' }\n' struct_size_body += ' return struct_size;\n' struct_size_body += '}\n' |
