diff options
| author | Charles Giessen <charles@lunarg.com> | 2019-11-18 15:11:37 -0700 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2019-11-19 09:09:34 -0700 |
| commit | 73d9cfa91968bf8a6d792718e3aad76ea9ac1cb8 (patch) | |
| tree | 01577248a3f8f396fbf710a0d7ac5328a40944ea /scripts | |
| parent | 99b986c82b14fc75c261feae2fac4fb7bd8ee364 (diff) | |
| download | usermoji-73d9cfa91968bf8a6d792718e3aad76ea9ac1cb8.tar.xz | |
vulkaninfo: check that extensions aren't disabled
Previous versions of vulkainfo's autogen code didn't check if enums and
bitmasks from extensions were disabled, possibly letting them leak into
the generated code. This commit checks and skips any fields which aren't
supported.
File changed:
scripts/vulkaninfo_generator.py
Change-Id: I0e6fd9872d9377a17797cfcf6c2fbcee649e3657
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/vulkaninfo_generator.py | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index 3846e345..eda3ec62 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -187,7 +187,6 @@ class VulkanInfoGenerator(OutputGenerator): self.extFuncs = OrderedDict() self.extTypes = OrderedDict() - self.extensions = set() def beginFile(self, genOpts): gen.OutputGenerator.beginFile(self, genOpts) @@ -201,7 +200,6 @@ class VulkanInfoGenerator(OutputGenerator): for node in root.find('extensions').findall('extension'): ext = VulkanExtension(node) - self.extensions.add(ext) for item in ext.vktypes: self.extTypes[item] = ext for item in ext.vkfuncs: @@ -312,9 +310,9 @@ class VulkanInfoGenerator(OutputGenerator): return if groupinfo.elem.get('type') == 'bitmask': - self.bitmasks.add(VulkanBitmask(groupinfo.elem, self.extensions)) + self.bitmasks.add(VulkanBitmask(groupinfo.elem)) elif groupinfo.elem.get('type') == 'enum': - self.enums.add(VulkanEnum(groupinfo.elem, self.extensions)) + self.enums.add(VulkanEnum(groupinfo.elem)) def genType(self, typeinfo, name, alias): gen.OutputGenerator.genType(self, typeinfo, name, alias) @@ -697,11 +695,11 @@ class VulkanEnum: 'optMultiValue': self.multiValue, } - def __init__(self, rootNode, extensions): + def __init__(self, rootNode): self.name = rootNode.get('name') self.type = rootNode.get('type') self.options = [] - self.ext = None + for child in rootNode: childName = child.get('name') childValue = child.get('value') @@ -710,6 +708,9 @@ class VulkanEnum: childExtends = child.get('extends') childOffset = child.get('offset') childExtNum = child.get('extnumber') + support = child.get('supported') + if(support == "disabled"): + continue if childName is None: continue @@ -735,20 +736,12 @@ class VulkanEnum: self.options.append(VulkanEnum.Option( childName, childValue, childBitpos, childComment)) - for ext in extensions: - if self.name in ext.enumValues: - self.ext = ext - childName, childValue = ext.enumValues[self.name] - self.options.append(VulkanEnum.Option( - childName, childValue, None, None)) - class VulkanBitmask: - def __init__(self, rootNode, extensions): + def __init__(self, rootNode): self.name = rootNode.get('name') self.type = rootNode.get('type') - self.ext = None # Read each value that the enum contains self.options = [] @@ -757,19 +750,15 @@ class VulkanBitmask: childValue = child.get('value') childBitpos = child.get('bitpos') childComment = child.get('comment') + support = child.get('supported') if childName is None or (childValue is None and childBitpos is None): continue + if(support == "disabled"): + continue self.options.append(VulkanEnum.Option( childName, childValue, childBitpos, childComment)) - for ext in extensions: - if self.name in ext.enumValues: - self.ext = ext - childName, childValue = ext.enumValues[self.name] - self.options.append(VulkanEnum.Option( - childName, childValue, None, None)) - class VulkanFlags: |
