aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2021-11-29 22:44:05 -0700
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2022-02-02 16:22:12 -0700
commitcc0a0325deac7a20532766840edbed5167c2b183 (patch)
tree5d26f18d6ee82e3f6351c0c07ad48120f2b93869 /scripts
parent7a132ba4df38473423a2e1c0d212df2134bebc77 (diff)
downloadusermoji-cc0a0325deac7a20532766840edbed5167c2b183.tar.xz
vulkaninfo: bitmask printers check for 0 value
Only generate the early exit if there doesn't exist an bitmask which has a value of 0. For example, VK_RESOLVE_MODE_NONE has a value of 0, but it would never be printed without this special case.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vulkaninfo_generator.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py
index 50bfcfb0..e7381e8b 100644
--- a/scripts/vulkaninfo_generator.py
+++ b/scripts/vulkaninfo_generator.py
@@ -430,9 +430,12 @@ def PrintEnum(enum, gen):
def PrintGetFlagStrings(name, bitmask):
out = ''
- out += f"std::vector<const char *>{name}GetStrings({name} value) {{\n"
+ out += f"std::vector<const char *> {name}GetStrings({name} value) {{\n"
out += f" std::vector<const char *> strings;\n"
- out += f" if (value == 0) {{ strings.push_back(\"None\"); return strings; }}\n"
+ # If a bitmask contains a field whose value is zero, we want to support printing the correct bitflag
+ # Otherwise, use "None" for when there are not bits set in the bitmask
+ if bitmask.options[0].value != "0":
+ out += f" if (value == 0) {{ strings.push_back(\"None\"); return strings; }}\n"
for v in bitmask.options:
out += f" if ({v.name} & value) strings.push_back(\"{str(v.name[3:])}\");\n"
out += f" return strings;\n}}\n"