Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com Signed-off-by: Piers Daniell pdaniell@nvidia.com --- dlls/winevulkan/make_vulkan | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index a2e3eeb955..18fb4ebbf5 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -335,11 +335,15 @@ class VkEnum(object): self.values = values self.required = False self.alias = alias + self.aliased_by = []
@staticmethod def from_alias(enum, alias): name = enum.attrib.get("name") - return VkEnum(name, alias.values, alias=alias) + aliasee = VkEnum(name, alias.values, alias=alias) + + alias.add_aliased_by(aliasee) + return aliasee
@staticmethod def from_xml(enum): @@ -386,18 +390,29 @@ class VkEnum(object): self.values.append(value)
def definition(self): + if self.is_alias(): + return "" + text = "typedef enum {0}\n{{\n".format(self.name)
# Print values sorted, values can have been added in a random order. values = sorted(self.values, key=lambda value: value.value) for value in values: text += " {0},\n".format(value.definition()) - text += "}} {0};\n\n".format(self.name) + text += "}} {0};\n".format(self.name) + + for aliasee in self.aliased_by: + text += "typedef {0} {1};\n".format(self.name, aliasee.name) + + text += "\n" return text
def is_alias(self): return bool(self.alias)
+ def add_aliased_by(self, aliasee): + self.aliased_by.append(aliasee) +
class VkEnumValue(object): def __init__(self, name, value, hex=False):
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com Signed-off-by: Piers Daniell pdaniell@nvidia.com --- dlls/winevulkan/make_vulkan | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 18fb4ebbf5..c0dfbd976b 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -356,24 +356,24 @@ class VkEnum(object): alias_name = v.attrib.get("alias") if alias_name: alias = next(x for x in values if x.name == alias_name) - values.append(VkEnumValue(v.attrib.get("name"), alias.value, alias.hex)) + values.append(VkEnumValue(v.attrib.get("name"), value=alias.value, hex=alias.hex)) elif value: # Some values are in hex form. We want to preserve the hex representation # at least when we convert back to a string. Internally we want to use int. if "0x" in value: - values.append(VkEnumValue(v.attrib.get("name"), int(value, 0), hex=True)) + values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0), hex=True)) else: - values.append(VkEnumValue(v.attrib.get("name"), int(value, 0))) + values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0))) else: # bitmask value = 1 << int(v.attrib.get("bitpos")) - values.append(VkEnumValue(v.attrib.get("name"), value, hex=True)) + values.append(VkEnumValue(v.attrib.get("name"), value=value, hex=True))
# vulkan.h contains a *_MAX_ENUM value set to 32-bit at the time of writing, # which is to prepare for extensions as they can add values and hence affect # the size definition. max_name = re.sub(r'([0-9a-z_])([A-Z0-9])',r'\1_\2', name).upper() + "_MAX_ENUM" - values.append(VkEnumValue(max_name, 0x7fffffff, hex=True)) + values.append(VkEnumValue(max_name, value=0x7fffffff, hex=True))
return VkEnum(name, values)
@@ -415,16 +415,21 @@ class VkEnum(object):
class VkEnumValue(object): - def __init__(self, name, value, hex=False): + def __init__(self, name, value=None, hex=False, alias=None): self.name = name self.value = value self.hex = hex + self.alias = alias
def __repr__(self): + if self.is_alias(): + return "{0}={1}".format(self.name, self.alias) return "{0}={1}".format(self.name, self.value)
def definition(self): """ Convert to text definition e.g. VK_FOO = 1 """ + if self.is_alias(): + return "{0} = {1}".format(self.name, self.alias)
# Hex is commonly used for FlagBits and sometimes within # a non-FlagBits enum for a bitmask value as well. @@ -433,6 +438,9 @@ class VkEnumValue(object): else: return "{0} = {1}".format(self.name, self.value)
+ def is_alias(self): + return self.alias is not None +
class VkFunction(object): def __init__(self, _type=None, name=None, params=[], extensions=[], alias=None): @@ -2714,7 +2722,7 @@ class VkRegistry(object): if "bitpos" in enum_elem.keys(): # We need to add an extra value to an existing enum type. # E.g. VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG to VkFormatFeatureFlagBits. - enum.add(VkEnumValue(enum_elem.attrib["name"], 1 << int(enum_elem.attrib["bitpos"]), hex=True)) + enum.add(VkEnumValue(enum_elem.attrib["name"], value=(1 << int(enum_elem.attrib["bitpos"])), hex=True))
elif "offset" in enum_elem.keys(): # Extensions promoted to Core, have the extension number as part
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com Signed-off-by: Piers Daniell pdaniell@nvidia.com --- dlls/winevulkan/make_vulkan | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index c0dfbd976b..4383046cee 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -382,9 +382,10 @@ class VkEnum(object):
# Extensions can add new enum values. When an extension is promoted to Core # the registry defines the value twice once for old extension and once for - # new Core features. Ignore the duplicate entry. + # new Core features. Add the duplicate if it's explicitly marked as an + # alias, otherwise ignore it. for v in self.values: - if v.value == value.value: + if not value.is_alias() and v.value == value.value: LOGGER.debug("Adding duplicate enum value {0} to {1}".format(v, self.name)) return self.values.append(value) @@ -396,7 +397,7 @@ class VkEnum(object): text = "typedef enum {0}\n{{\n".format(self.name)
# Print values sorted, values can have been added in a random order. - values = sorted(self.values, key=lambda value: value.value) + values = sorted(self.values, key=lambda value: value.value if value.value is not None else 0x7ffffffe) for value in values: text += " {0},\n".format(value.definition()) text += "}} {0};\n".format(self.name) @@ -2739,10 +2740,12 @@ class VkRegistry(object): if direction is not None: value = -value
- enum.add(VkEnumValue(enum_elem.attrib["name"], value)) + enum.add(VkEnumValue(enum_elem.attrib["name"], value=value))
elif "value" in enum_elem.keys(): - enum.add(VkEnumValue(enum_elem.attrib["name"], int(enum_elem.attrib["value"]))) + enum.add(VkEnumValue(enum_elem.attrib["name"], value=int(enum_elem.attrib["value"]))) + elif "alias" in enum_elem.keys(): + enum.add(VkEnumValue(enum_elem.attrib["name"], alias=enum_elem.attrib["alias"]))
elif "value" in enum_elem.keys(): self.consts.append(VkConstant(enum_elem.attrib["name"], enum_elem.attrib["value"]))
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com Signed-off-by: Piers Daniell pdaniell@nvidia.com --- dlls/winevulkan/make_vulkan | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 4383046cee..a4ebb2c7e9 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -64,8 +64,8 @@ from enum import Enum LOGGER = logging.Logger("vulkan") LOGGER.addHandler(logging.StreamHandler())
-VK_XML_VERSION = "1.1.130" -WINE_VK_VERSION = (1, 1) +VK_XML_VERSION = "1.2.134" +WINE_VK_VERSION = (1, 2)
# Filenames to create. WINE_VULKAN_H = "../../include/wine/vulkan.h"