Mesa (master): zink/codegen: add some new attributes to Extension

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jan 17 15:31:08 UTC 2021


Module: Mesa
Branch: master
Commit: d0125fc487de47fedacd7be95dcc1da3cc0ab9d5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0125fc487de47fedacd7be95dcc1da3cc0ab9d5

Author: Hoe Hao Cheng <haochengho12907 at gmail.com>
Date:   Fri Jan 15 02:04:50 2021 +0800

zink/codegen: add some new attributes to Extension

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8521>

---

 src/gallium/drivers/zink/zink_extensions.py | 75 ++++++++++++++++-------------
 1 file changed, 42 insertions(+), 33 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_extensions.py b/src/gallium/drivers/zink/zink_extensions.py
index 1880ce2f832..06a04fddc5f 100644
--- a/src/gallium/drivers/zink/zink_extensions.py
+++ b/src/gallium/drivers/zink/zink_extensions.py
@@ -1,13 +1,51 @@
+class Version:
+    driver_version  : (1,0,0)
+    struct_version  : (1,0)
+
+    def __init__(self, version, struct):
+        self.device_version = version
+        self.struct_version = struct
+
+    # e.g. "VM_MAKE_VERSION(1,2,0)"
+    def version(self):
+        return ("VK_MAKE_VERSION("
+               + str(self.device_version[0])
+               + ","
+               + str(self.device_version[1])
+               + ","
+               + str(self.device_version[2])
+               + ")")
+
+    # e.g. "10"
+    def struct(self):
+        return (str(self.struct_version[0])+str(self.struct_version[1]))
+
+    # the sType of the extension's struct
+    # e.g. VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT
+    # for VK_EXT_transform_feedback and struct="FEATURES"
+    def stype(self, struct: str):
+        return ("VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_"
+                + str(self.struct_version[0]) + "_" + str(self.struct_version[1])
+                + '_' + struct)
+
 class Extension:
     name           : str   = None
     alias          : str   = None
     is_required    : bool  = False
+    enable_conds   : [str] = None
+
+    # these are specific to zink_device_info.py:
     has_properties : bool  = False
     has_features   : bool  = False
-    enable_conds   : [str] = None
     guard          : bool  = False
 
-    def __init__(self, name, alias="", required=False, properties=False, features=False, conditions=None, guard=False):
+    # these are specific to zink_instance.py:
+    core_since     : Version = None
+    instance_funcs : [str]   = None
+
+    def __init__(self, name, alias="", required=False, properties=False,
+                 features=False, conditions=None, guard=False, core_since=None,
+                 functions=None):
         self.name = name
         self.alias = alias
         self.is_required = required
@@ -15,6 +53,8 @@ class Extension:
         self.has_features = features
         self.enable_conds = conditions
         self.guard = guard
+        self.core_since = core_since
+        self.instance_funcs = functions
 
         if alias == "" and (properties == True or features == True):
             raise RuntimeError("alias must be available when properties and/or features are used")
@@ -61,36 +101,5 @@ class Extension:
     def vendor(self):
         return self.name.split('_')[1]
 
-
-class Version:
-    driver_version  : (1,0,0)
-    struct_version  : (1,0)
-
-    def __init__(self, version, struct):
-        self.device_version = version
-        self.struct_version = struct
-
-    # e.g. "VM_MAKE_VERSION(1,2,0)"
-    def version(self):
-        return ("VK_MAKE_VERSION("
-               + str(self.device_version[0])
-               + ","
-               + str(self.device_version[1])
-               + ","
-               + str(self.device_version[2])
-               + ")")
-
-    # e.g. "10"
-    def struct(self):
-        return (str(self.struct_version[0])+str(self.struct_version[1]))
-
-    # the sType of the extension's struct
-    # e.g. VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT
-    # for VK_EXT_transform_feedback and struct="FEATURES"
-    def stype(self, struct: str):
-        return ("VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_"
-                + str(self.struct_version[0]) + "_" + str(self.struct_version[1])
-                + '_' + struct)
-
 # Type aliases
 Layer = Extension



More information about the mesa-commit mailing list