These have come up from time to time in some enums. They've never been
a problem in the past because we just haven't cared about enum_to_str on
those.
---
src/vulkan/util/gen_enum_to_str.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/vulkan/util/gen_enum_to_str.py
b/src/vulkan/util/gen_enum_to_str.py
index bf883d5cb8f..a01e4a66604 100644
--- a/src/vulkan/util/gen_enum_to_str.py
+++ b/src/vulkan/util/gen_enum_to_str.py
@@ -118,6 +118,11 @@ FOREIGN_ENUM_VALUES = [
"VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID",
]
+def num_from_str(num_str):
+ if num_str.lower().startswith('0x'):
+ return int(num_str, base=16)
+ else:
+ return int(num_str)
class NamedFactory(object):
"""Factory for creating enums."""
@@ -172,7 +177,7 @@ class VkEnum(object):
def add_value_from_xml(self, elem, extension=None):
if 'value' in elem.attrib:
self.add_value(elem.attrib['name'],
- value=int(elem.attrib['value']))
+ value=num_from_str(elem.attrib['value']))
elif 'alias' in elem.attrib:
self.add_value(elem.attrib['name'],
value=self.name_to_value[elem.attrib['alias']])
--
2.17.1
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev