aboutsummaryrefslogtreecommitdiff
path: root/scripts/parameter_validation_generator.py
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2017-07-25 14:29:42 -0600
committerMark Lobodzinski <mark@lunarg.com>2017-07-26 14:30:46 -0600
commit650d7f609bef99a617093a33d86e4cfef948a31c (patch)
treea8ab04f8c69bf45b92dffede40700aca24861085 /scripts/parameter_validation_generator.py
parent060d2988377d91c9ded54d6526360b975d8abc8c (diff)
downloadusermoji-650d7f609bef99a617093a33d86e4cfef948a31c.tar.xz
scripts: Generate param_validation valid enum lists
Change-Id: I0dd6bf95bf54baa9a71f41a482bc52527944aea8
Diffstat (limited to 'scripts/parameter_validation_generator.py')
-rw-r--r--scripts/parameter_validation_generator.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/parameter_validation_generator.py b/scripts/parameter_validation_generator.py
index f1dfba1f..92102a17 100644
--- a/scripts/parameter_validation_generator.py
+++ b/scripts/parameter_validation_generator.py
@@ -155,6 +155,7 @@ class ParamCheckerOutputGenerator(OutputGenerator):
self.structMembers = [] # List of StructMemberData records for all Vulkan structs
self.validatedStructs = dict() # Map of structs type names to generated validation code for that struct type
self.enumRanges = dict() # Map of enum name to BEGIN/END range values
+ self.enumValueLists = '' # String containing enumerated type map definitions
self.flags = set() # Map of flags typenames
self.flagBits = dict() # Map of flag bits typename to list of values
self.newFlags = set() # Map of flags typenames /defined in the current feature/
@@ -250,6 +251,8 @@ class ParamCheckerOutputGenerator(OutputGenerator):
def endFile(self):
# C-specific
self.newline()
+ write(self.enumValueLists, file=self.outFile)
+ self.newline()
commands_text = '\n'.join(self.validation)
write(commands_text, file=self.outFile)
self.newline()
@@ -427,8 +430,7 @@ class ParamCheckerOutputGenerator(OutputGenerator):
cdecl=cdecl))
self.structMembers.append(self.StructMemberData(name=typeName, members=membersInfo))
#
- # Capture group (e.g. C "enum" type) info to be used for
- # param check code generation.
+ # Capture group (e.g. C "enum" type) info to be used for param check code generation.
# These are concatenated together with other types.
def genGroup(self, groupinfo, groupName):
OutputGenerator.genGroup(self, groupinfo, groupName)
@@ -457,9 +459,16 @@ class ParamCheckerOutputGenerator(OutputGenerator):
isEnum = ('FLAG_BITS' not in expandPrefix)
if isEnum:
self.enumRanges[groupName] = (expandPrefix + '_BEGIN_RANGE' + expandSuffix, expandPrefix + '_END_RANGE' + expandSuffix)
+ # Create definition for a list containing valid enum values for this enumerated type
+ enum_entry = 'const std::vector<%s> All%sEnums = {' % (groupName, groupName)
+ for enum in groupElem:
+ name = enum.get('name')
+ if name is not None:
+ enum_entry += '%s, ' % enum.get('name')
+ enum_entry += '};\n'
+ self.enumValueLists += enum_entry
#
- # Capture command parameter info to be used for param
- # check code generation.
+ # Capture command parameter info to be used for param check code generation.
def genCmd(self, cmdinfo, name):
OutputGenerator.genCmd(self, cmdinfo, name)
interface_functions = [