diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2017-07-24 16:14:16 -0600 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2017-07-25 10:04:50 -0600 |
| commit | a6c0e3a293a98a94a2d75820e5ce979171e87abb (patch) | |
| tree | 6c7f81ceab43ba32628be980892d6848d006f9d2 /scripts | |
| parent | 87bf8bb455d56e9833b33a94384388232e8c6b4e (diff) | |
| download | usermoji-a6c0e3a293a98a94a2d75820e5ce979171e87abb.tar.xz | |
scripts: Add PDevFeature index print helper
In the Enum string helper header, tack on a routine to convert an
index into a VkPhysicalDeviceFeatures structure into its
corresponding feature string.
Change-Id: I8fbfb6fcbfa63361a851ffc93ffd832696050d51
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/helper_file_generator.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/helper_file_generator.py b/scripts/helper_file_generator.py index 7d00e6d6..f486a8d7 100644 --- a/scripts/helper_file_generator.py +++ b/scripts/helper_file_generator.py @@ -364,6 +364,23 @@ class HelperFileOutputGenerator(OutputGenerator): outstring += '}\n' return outstring # + # Tack on a helper which, given an index into a VkPhysicalDeviceFeatures structure, will print the corresponding feature name + def DeIndexPhysDevFeatures(self): + pdev_members = None + for name, members, ifdef in self.structMembers: + if name == 'VkPhysicalDeviceFeatures': + pdev_members = members + break + deindex = '\n' + deindex += 'static const char * GetPhysDevFeatureString(uint32_t index) {\n' + deindex += ' const char * IndexToPhysDevFeatureString[] = {\n' + for feature in pdev_members: + deindex += ' "%s",\n' % feature.name + deindex += ' };\n\n' + deindex += ' return IndexToPhysDevFeatureString[index];\n' + deindex += '}\n' + return deindex + # # Combine enum string helper header file preamble with body text and return def GenerateEnumStringHelperHeader(self): enum_string_helper_header = '\n' @@ -375,6 +392,7 @@ class HelperFileOutputGenerator(OutputGenerator): enum_string_helper_header += '#include <vulkan/vulkan.h>\n' enum_string_helper_header += '\n' enum_string_helper_header += self.enum_output + enum_string_helper_header += self.DeIndexPhysDevFeatures() return enum_string_helper_header # # struct_size_header: build function prototypes for header file |
