diff options
| author | Mike Schuchardt <mikes@lunarg.com> | 2022-11-01 16:37:47 -0700 |
|---|---|---|
| committer | Mike Schuchardt <mikes@lunarg.com> | 2022-11-02 14:33:35 -0700 |
| commit | 0bb32875d2e66c356ca42c9c93f3b103dd5ceac6 (patch) | |
| tree | 52fffb494cdc8cfcccbe17a6d451becdf20e0b0b /scripts | |
| parent | 292e6ed02141b015950d03390c6e8576b0673ef6 (diff) | |
| download | usermoji-0bb32875d2e66c356ca42c9c93f3b103dd5ceac6.tar.xz | |
vulkaninfo: Fix VkShaderStageFlagBits expansion
Fix bug where SHADER_STAGE_ALL_GRAPHICS and SHADER_STAGE_ALL were
showing up in the list of set bits for
VkPhysicalDeviceSubgroupProperties::supportedStages. When expanding a
FlagBits value we should only consider the single-bit options.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/vulkaninfo_generator.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index 4fac2cfa..0834a2ae 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -441,10 +441,12 @@ def PrintGetFlagStrings(name, bitmask): out += f" std::vector<const char *> 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": + 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("{v.name[3:]}");\n' + # only check single-bit flags + if (v.value & (v.value - 1)) == 0: + out += f' if ({v.name} & value) strings.push_back("{v.name[3:]}");\n' out += f" return strings;\n}}\n" return out @@ -787,8 +789,13 @@ class VulkanEnum: self.name = name self.comment = comment - if value == 0 or value is None: + if bitpos is not None: value = 1 << int(bitpos) + elif type(value) is str: + if value.lower().startswith('0x'): + value = int(value, 16) + else: + value = int(value) self.value = value |
