Mesa (main): zink/codegen: split commands into three groups
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 10 20:32:44 UTC 2021
Module: Mesa
Branch: main
Commit: 94fba09432a8ca01166793c0e26bef9f387498fc
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=94fba09432a8ca01166793c0e26bef9f387498fc
Author: Hoe Hao Cheng <haochengho12907 at gmail.com>
Date: Sun May 30 18:02:56 2021 +0800
zink/codegen: split commands into three groups
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11036>
---
src/gallium/drivers/zink/zink_extensions.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/gallium/drivers/zink/zink_extensions.py b/src/gallium/drivers/zink/zink_extensions.py
index a9dc54439fc..64fea666735 100644
--- a/src/gallium/drivers/zink/zink_extensions.py
+++ b/src/gallium/drivers/zink/zink_extensions.py
@@ -152,6 +152,9 @@ class ExtensionRegistryEntry:
promoted_in : Version = None
# functions added by the extension are referred to as "commands" in the registry
commands : List[str] = None
+ device_commands : List[str] = None
+ pdevice_commands : List[str] = None
+ instance_commands : List[str] = None
constants : List[str] = None
features_struct : str = None
properties_struct : str = None
@@ -163,6 +166,20 @@ class ExtensionRegistry:
def __init__(self, vkxml_path: str):
vkxml = ElementTree.parse(vkxml_path)
+ commands_type = dict()
+ 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")
+
+ for (cmd, alias) in aliases.items():
+ commands_type[cmd] = commands_type[alias]
+
for ext in vkxml.findall("extensions/extension"):
# Reserved extensions are marked with `supported="disabled"`
if ext.get("supported") == "disabled":
@@ -175,11 +192,22 @@ class ExtensionRegistry:
entry.promoted_in = self.parse_promotedto(ext.get("promotedto"))
entry.commands = []
+ entry.device_commands = []
+ entry.pdevice_commands = []
+ entry.instance_commands = []
+
for cmd in ext.findall("require/command"):
cmd_name = cmd.get("name")
if cmd_name:
entry.commands.append(cmd_name)
+ if commands_type[cmd_name] in ("VkDevice", "VkCommandBuffer", "VkQueue"):
+ entry.device_commands.append(cmd_name)
+ elif commands_type[cmd_name] in ("VkPhysicalDevice"):
+ entry.pdevice_commands.append(cmd_name)
+ else:
+ entry.instance_commands.append(cmd_name)
+
entry.constants = []
for enum in ext.findall("require/enum"):
enum_name = enum.get("name")
More information about the mesa-commit
mailing list