summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Schuchardt <mikes@lunarg.com>2022-11-01 16:37:47 -0700
committerMike Schuchardt <mikes@lunarg.com>2022-11-02 14:33:35 -0700
commit0bb32875d2e66c356ca42c9c93f3b103dd5ceac6 (patch)
tree52fffb494cdc8cfcccbe17a6d451becdf20e0b0b
parent292e6ed02141b015950d03390c6e8576b0673ef6 (diff)
downloadVulkan-Tools-0bb32875d2e66c356ca42c9c93f3b103dd5ceac6.tar.gz
Vulkan-Tools-0bb32875d2e66c356ca42c9c93f3b103dd5ceac6.tar.bz2
Vulkan-Tools-0bb32875d2e66c356ca42c9c93f3b103dd5ceac6.zip
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.
-rw-r--r--scripts/vulkaninfo_generator.py13
-rw-r--r--vulkaninfo/generated/vulkaninfo.hpp2
2 files changed, 10 insertions, 5 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
diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp
index 13bab86c..58162b88 100644
--- a/vulkaninfo/generated/vulkaninfo.hpp
+++ b/vulkaninfo/generated/vulkaninfo.hpp
@@ -986,8 +986,6 @@ std::vector<const char *> VkShaderStageFlagBitsGetStrings(VkShaderStageFlagBits
if (VK_SHADER_STAGE_GEOMETRY_BIT & value) strings.push_back("SHADER_STAGE_GEOMETRY_BIT");
if (VK_SHADER_STAGE_FRAGMENT_BIT & value) strings.push_back("SHADER_STAGE_FRAGMENT_BIT");
if (VK_SHADER_STAGE_COMPUTE_BIT & value) strings.push_back("SHADER_STAGE_COMPUTE_BIT");
- if (VK_SHADER_STAGE_ALL_GRAPHICS & value) strings.push_back("SHADER_STAGE_ALL_GRAPHICS");
- if (VK_SHADER_STAGE_ALL & value) strings.push_back("SHADER_STAGE_ALL");
if (VK_SHADER_STAGE_RAYGEN_BIT_KHR & value) strings.push_back("SHADER_STAGE_RAYGEN_BIT_KHR");
if (VK_SHADER_STAGE_ANY_HIT_BIT_KHR & value) strings.push_back("SHADER_STAGE_ANY_HIT_BIT_KHR");
if (VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR & value) strings.push_back("SHADER_STAGE_CLOSEST_HIT_BIT_KHR");