Update for Vulkan-Docs 1.2.180

This commit is contained in:
Jon Leech
2021-06-06 23:10:19 -07:00
committed by Jon Leech
parent 7fe877c90a
commit 07c4a37bcf
6 changed files with 24073 additions and 22976 deletions

View File

@@ -391,45 +391,12 @@ class COutputGenerator(OutputGenerator):
self.appendSection(section, "\n" + body)
def genEnum(self, enuminfo, name, alias):
"""Generate enumerants.
"""Generate the C declaration for a constant (a single <enum> value)."""
<enum> tags may specify their values in several ways, but are usually
just integers."""
OutputGenerator.genEnum(self, enuminfo, name, alias)
(_, strVal) = self.enumToValue(enuminfo.elem, False)
if self.misracppstyle() and enuminfo.elem.get('type') and not alias:
# Generate e.g.: static constexpr uint32_t x = ~static_cast<uint32_t>(1U);
# This appeases MISRA "underlying type" rules.
typeStr = enuminfo.elem.get('type');
invert = '~' in strVal
number = strVal.strip("()~UL")
if typeStr != "float":
number += 'U'
strVal = "~" if invert else ""
strVal += "static_cast<" + typeStr + ">(" + number + ")"
body = 'static constexpr ' + typeStr.ljust(9) + name.ljust(33) + ' {' + strVal + '};'
self.appendSection('enum', body)
elif enuminfo.elem.get('type') and not alias:
# Generate e.g.: #define x (~0ULL)
typeStr = enuminfo.elem.get('type');
invert = '~' in strVal
paren = '(' in strVal
number = strVal.strip("()~UL")
if typeStr != "float":
if typeStr == "uint64_t":
number += 'ULL'
else:
number += 'U'
strVal = "~" if invert else ""
strVal += number
if paren:
strVal = "(" + strVal + ")";
body = '#define ' + name.ljust(33) + ' ' + strVal;
self.appendSection('enum', body)
else:
body = '#define ' + name.ljust(33) + ' ' + strVal
self.appendSection('enum', body)
body = self.buildConstantCDecl(enuminfo, name, alias)
self.appendSection('enum', body)
def genCmd(self, cmdinfo, name, alias):
"Command generation"