We shouldn't do that according to the Vulkan xml maintainer. https://github.com/KhronosGroup/Vulkan-Docs/pull/1379
Signed-off-by: Georg Lehmann dadschoorse@gmail.com --- dlls/winevulkan/make_vulkan | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index a07c1d77bf5..bc9462fb9c7 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -2737,21 +2737,16 @@ class VkRegistry(object):
def _match_object_types(self): """ Matches each handle with the correct object type. """ - for handle in self.handles: - if not handle.is_required() or handle.is_alias(): - continue - for value in self.enums["VkObjectType"].values: - if value.comment == handle.name: - handle.object_type = value.name - break - else: - LOGGER.warning("No object type found for {}".format(handle.name)) + # Use upper case comparison for simplicity. + object_types = {} + for value in self.enums["VkObjectType"].values: + object_name = "VK" + value.name[len("VK_OBJECT_TYPE"):].replace("_", "") + object_types[object_name] = value.name
for handle in self.handles: - if not handle.is_required() or not handle.is_alias(): + if not handle.is_required(): continue - # Use the object type of the alias - handle.object_type = handle.alias.object_type + handle.object_type = object_types.get(handle.name.upper()) if not handle.object_type: LOGGER.warning("No object type found for {}".format(handle.name))
Signed-off-by: Georg Lehmann dadschoorse@gmail.com --- dlls/winevulkan/make_vulkan | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index bc9462fb9c7..c15afa3ebe4 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -380,21 +380,20 @@ class VkEnum(object): # Value is either a value or a bitpos, only one can exist. value = v.attrib.get("value") alias_name = v.attrib.get("alias") - comment = v.attrib.get("comment") if alias_name: alias = next(x for x in values if x.name == alias_name) - values.append(VkEnumValue(v.attrib.get("name"), value=alias.value, hex=alias.hex, comment=comment)) + 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"), value=int(value, 0), hex=True, comment=comment)) + values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0), hex=True)) else: - values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0), comment=comment)) + 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=value, hex=True, comment=comment)) + 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 @@ -445,12 +444,11 @@ class VkEnum(object):
class VkEnumValue(object): - def __init__(self, name, value=None, hex=False, alias=None, comment=None): + def __init__(self, name, value=None, hex=False, alias=None): self.name = name self.value = value self.hex = hex self.alias = alias - self.comment = comment
def __repr__(self): if self.is_alias(): @@ -2843,12 +2841,10 @@ class VkRegistry(object): if only_aliased and not aliased: return
- comment = enum_elem.attrib.get("comment") - 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"], value=(1 << int(enum_elem.attrib["bitpos"])), hex=True, comment=comment)) + 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 @@ -2865,12 +2861,12 @@ class VkRegistry(object): if direction is not None: value = -value
- enum.add(VkEnumValue(enum_elem.attrib["name"], value=value, comment=comment)) + enum.add(VkEnumValue(enum_elem.attrib["name"], value=value))
elif "value" in enum_elem.keys(): - enum.add(VkEnumValue(enum_elem.attrib["name"], value=int(enum_elem.attrib["value"]), comment=comment)) + 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"], comment=comment)) + enum.add(VkEnumValue(enum_elem.attrib["name"], alias=enum_elem.attrib["alias"]))
elif "value" in enum_elem.keys(): # Constants are not aliased, no need to add them here, they'll get added later on.
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com
On 10/27/20 2:02 PM, Georg Lehmann wrote:
Signed-off-by: Georg Lehmann dadschoorse@gmail.com
dlls/winevulkan/make_vulkan | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index bc9462fb9c7..c15afa3ebe4 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -380,21 +380,20 @@ class VkEnum(object): # Value is either a value or a bitpos, only one can exist. value = v.attrib.get("value") alias_name = v.attrib.get("alias")
comment = v.attrib.get("comment") if alias_name: alias = next(x for x in values if x.name == alias_name)
values.append(VkEnumValue(v.attrib.get("name"), value=alias.value, hex=alias.hex, comment=comment))
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"), value=int(value, 0), hex=True, comment=comment))
values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0), hex=True)) else:
values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0), comment=comment))
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=value, hex=True, comment=comment))
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
@@ -445,12 +444,11 @@ class VkEnum(object):
class VkEnumValue(object):
- def __init__(self, name, value=None, hex=False, alias=None, comment=None):
- def __init__(self, name, value=None, hex=False, alias=None): self.name = name self.value = value self.hex = hex self.alias = alias
self.comment = comment def __repr__(self): if self.is_alias():
@@ -2843,12 +2841,10 @@ class VkRegistry(object): if only_aliased and not aliased: return
comment = enum_elem.attrib.get("comment")
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"], value=(1 << int(enum_elem.attrib["bitpos"])), hex=True, comment=comment))
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
@@ -2865,12 +2861,12 @@ class VkRegistry(object): if direction is not None: value = -value
enum.add(VkEnumValue(enum_elem.attrib["name"], value=value, comment=comment))
enum.add(VkEnumValue(enum_elem.attrib["name"], value=value)) elif "value" in enum_elem.keys():
enum.add(VkEnumValue(enum_elem.attrib["name"], value=int(enum_elem.attrib["value"]), comment=comment))
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"], comment=comment))
enum.add(VkEnumValue(enum_elem.attrib["name"], alias=enum_elem.attrib["alias"])) elif "value" in enum_elem.keys(): # Constants are not aliased, no need to add them here, they'll get added later on.
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com
On 10/27/20 2:02 PM, Georg Lehmann wrote:
We shouldn't do that according to the Vulkan xml maintainer. https://github.com/KhronosGroup/Vulkan-Docs/pull/1379
Signed-off-by: Georg Lehmann dadschoorse@gmail.com
dlls/winevulkan/make_vulkan | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index a07c1d77bf5..bc9462fb9c7 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -2737,21 +2737,16 @@ class VkRegistry(object):
def _match_object_types(self): """ Matches each handle with the correct object type. """
for handle in self.handles:
if not handle.is_required() or handle.is_alias():
continue
for value in self.enums["VkObjectType"].values:
if value.comment == handle.name:
handle.object_type = value.name
break
else:
LOGGER.warning("No object type found for {}".format(handle.name))
# Use upper case comparison for simplicity.
object_types = {}
for value in self.enums["VkObjectType"].values:
object_name = "VK" + value.name[len("VK_OBJECT_TYPE"):].replace("_", "")
object_types[object_name] = value.name for handle in self.handles:
if not handle.is_required() or not handle.is_alias():
if not handle.is_required(): continue
# Use the object type of the alias
handle.object_type = handle.alias.object_type
handle.object_type = object_types.get(handle.name.upper()) if not handle.object_type: LOGGER.warning("No object type found for {}".format(handle.name))