core_since = None
# these are specific to zink_device_info.py:
- has_properties = False
- has_features = False
- guard = False
+ has_properties = False
+ has_features = False
+ guard = False
+ features_promoted = False
+ properties_promoted = False
+
# these are specific to zink_instance.py:
platform_guard = None
instance_commands = None
constants = None
features_struct = None
+ features_fields = None
+ features_promoted = False
properties_struct = None
+ properties_fields = None
+ properties_promoted = False
# some instance extensions are locked behind certain platforms
platform_guard = ""
vkxml = ElementTree.parse(vkxml_path)
commands_type = dict()
- aliases = dict()
+ command_aliases = dict()
platform_guards = dict()
+ struct_aliases = dict()
for cmd in vkxml.findall("commands/command"):
name = cmd.find("./proto/name")
if name is not None and name.text:
commands_type[name.text] = cmd.find("./param/type").text
elif cmd.get("name") is not None:
- aliases[cmd.get("name")] = cmd.get("alias")
+ command_aliases[cmd.get("name")] = cmd.get("alias")
+
+ for typ in vkxml.findall("types/type"):
+ if typ.get("category") != "struct":
+ continue
- for (cmd, alias) in aliases.items():
+ name = typ.get("name")
+ alias = typ.get("alias")
+
+ if name and alias:
+ struct_aliases[name] = alias
+
+ for (cmd, alias) in command_aliases.items():
commands_type[cmd] = commands_type[alias]
for platform in vkxml.findall("platforms/platform"):
entry.device_commands = []
entry.pdevice_commands = []
entry.instance_commands = []
+ entry.features_fields = []
+ entry.properties_fields = []
for cmd in ext.findall("require/command"):
cmd_name = cmd.get("name")
if (self.is_features_struct(ty_name) and
entry.features_struct is None):
entry.features_struct = ty_name
+
elif (self.is_properties_struct(ty_name) and
entry.properties_struct is None):
entry.properties_struct = ty_name
+ if entry.features_struct:
+ struct_name = entry.features_struct
+ if entry.features_struct in struct_aliases:
+ struct_name = struct_aliases[entry.features_struct]
+ entry.features_promoted = True
+
+ elif entry.promoted_in is not None:
+ # if the extension is promoted but a core-Vulkan alias is not
+ # available for the features, then consider the features struct
+ # non-core-promoted
+ entry.features_promoted = False
+
+ for field in vkxml.findall("./types/type[@name='{}']/member".format(struct_name)):
+ field_name = field.find("name").text
+
+ # we ignore sType and pNext since they are irrelevant
+ if field_name not in ["sType", "pNext"]:
+ entry.features_fields.append(field_name)
+
+ if entry.properties_struct:
+ struct_name = entry.properties_struct
+ if entry.properties_struct in struct_aliases:
+ struct_name = struct_aliases[entry.properties_struct]
+ entry.properties_promoted = True
+
+ elif entry.promoted_in is not None:
+ # if the extension is promoted but a core-Vulkan alias is not
+ # available for the properties, then it is not promoted to core
+ entry.properties_promoted = False
+
+ for field in vkxml.findall("./types/type[@name='{}']/member".format(struct_name)):
+ field_name = field.find("name").text
+
+ # we ignore sType and pNext since they are irrelevant
+ if field_name not in ["sType", "pNext"]:
+ entry.properties_fields.append(field_name)
+
if ext.get("platform") is not None:
entry.platform_guard = platform_guards[ext.get("platform")]