Commit 5ac5e287 authored by Georg Lehmann's avatar Georg Lehmann Committed by Alexandre Julliard

winevulkan: Fixup 64bit enum aliases later to avoid using not yet defined values.

parent 5412401a
......@@ -435,12 +435,6 @@ class VkEnum(object):
def create_alias(self, name, alias_name):
""" Create an aliased value for this enum """
# Older GCC versions need a literal to initialize a static const uint64_t
# which is what we use for 64bit bitmasks.
if self.bitwidth == 64:
alias = next(x for x in self.values if x.name == alias_name)
self.add(VkEnumValue(name, self.bitwidth, value=alias.value, hex=alias.hex, alias=alias_name))
else:
self.add(VkEnumValue(name, self.bitwidth, alias=alias_name))
def create_value(self, name, value):
......@@ -469,6 +463,19 @@ class VkEnum(object):
if not any(x.name == value.name for x in self.values):
self.values.append(value)
def fixup_64bit_aliases(self):
""" Replace 64bit aliases with literal values """
# Older GCC versions need a literal to initialize a static const uint64_t
# which is what we use for 64bit bitmasks.
if self.bitwidth != 64:
return
for value in self.values:
if not value.is_alias():
continue
alias = next(x for x in self.values if x.name == value.alias)
value.hex = alias.hex
value.value = alias.value
def definition(self):
if self.is_alias():
return ""
......@@ -3310,6 +3317,9 @@ class VkRegistry(object):
self._parse_features(root)
self._parse_extensions(root)
for enum in self.enums.values():
enum.fixup_64bit_aliases()
self._match_object_types()
self.copyright = root.find('./comment').text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment