Mesa (main): zink/codegen: clean the constructor of Extension up
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 10 20:32:44 UTC 2021
Module: Mesa
Branch: main
Commit: 8343cb923d228cfa23e13d95c84b9041a0af5668
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8343cb923d228cfa23e13d95c84b9041a0af5668
Author: Hoe Hao Cheng <haochengho12907 at gmail.com>
Date: Tue Jun 1 16:58:52 2021 +0800
zink/codegen: clean the constructor of Extension up
the `functions` parameter is now unused, also rewrote some comments
since they are now outdated
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 | 11 ++---------
src/gallium/drivers/zink/zink_instance.py | 26 ++++++--------------------
2 files changed, 8 insertions(+), 29 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_extensions.py b/src/gallium/drivers/zink/zink_extensions.py
index 2a084a9881f..bbc3b5a4b83 100644
--- a/src/gallium/drivers/zink/zink_extensions.py
+++ b/src/gallium/drivers/zink/zink_extensions.py
@@ -64,19 +64,16 @@ class Extension:
is_required : bool = False
is_nonstandard : bool = False
enable_conds : List[str] = None
+ core_since : Version = None
# these are specific to zink_device_info.py:
has_properties : bool = False
has_features : bool = False
guard : bool = False
- # these are specific to zink_instance.py:
- core_since : Version = None
- instance_funcs : List[str] = None
-
def __init__(self, name, alias="", required=False, nonstandard=False,
properties=False, features=False, conditions=None, guard=False,
- core_since=None, functions=None):
+ core_since=None):
self.name = name
self.alias = alias
self.is_required = required
@@ -86,7 +83,6 @@ class Extension:
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")
@@ -190,7 +186,6 @@ class ExtensionRegistry:
entry.ext_type = ext.attrib["type"]
entry.promoted_in = self.parse_promotedto(ext.get("promotedto"))
- entry.commands = []
entry.device_commands = []
entry.pdevice_commands = []
entry.instance_commands = []
@@ -198,8 +193,6 @@ class ExtensionRegistry:
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"):
diff --git a/src/gallium/drivers/zink/zink_instance.py b/src/gallium/drivers/zink/zink_instance.py
index 299a680907f..5d5a683a849 100644
--- a/src/gallium/drivers/zink/zink_instance.py
+++ b/src/gallium/drivers/zink/zink_instance.py
@@ -29,29 +29,21 @@ from xml.etree import ElementTree
from zink_extensions import Extension,Layer,ExtensionRegistry,Version
import sys
-# constructor: Extension(name, core_since=None, functions=[])
+# constructor: Extension(name, conditions=[], nonstandard=False)
# The attributes:
-# - core_since: the Vulkan version where this extension is promoted to core.
-# When instance_info->loader_version is greater than or equal to this
-# instance_info.have_{name} is set to true unconditionally. This
-# is done because loading extensions that are promoted to core is
-# considered to be an error.
-#
-# - functions: functions which are added by the extension. The function names
-# should not include the "vk" prefix and the vendor suffix - these
-# will be added by the codegen accordingly.
+# - conditions: If the extension is provided by the Vulkan implementation, then
+# these are the extra conditions needed to enable the extension.
+# - nonstandard: Disables validation (cross-checking with vk.xml) if True.
EXTENSIONS = [
Extension("VK_EXT_debug_utils"),
- Extension("VK_KHR_get_physical_device_properties2",
- functions=["GetPhysicalDeviceFeatures2", "GetPhysicalDeviceProperties2",
- "GetPhysicalDeviceFormatProperties2", "GetPhysicalDeviceImageFormatProperties2",
- "GetPhysicalDeviceMemoryProperties2"]),
+ Extension("VK_KHR_get_physical_device_properties2"),
Extension("VK_MVK_moltenvk",
nonstandard=True),
Extension("VK_KHR_surface"),
]
# constructor: Layer(name, conditions=[])
+# - conditions: See documentation of EXTENSIONS.
LAYERS = [
# if we have debug_util, allow a validation layer to be added.
Layer("VK_LAYER_KHRONOS_validation",
@@ -298,12 +290,6 @@ if __name__ == "__main__":
print("The extension {} is {} extension - expected an instance extension.".format(ext.name, entry.ext_type))
continue
- if entry.commands and ext.instance_funcs:
- for func in map(lambda f: "vk" + f + ext.vendor(), ext.instance_funcs):
- if func not in entry.commands:
- error_count += 1
- print("The instance function {} is not added by the extension {}.".format(func, ext.name))
-
if entry.promoted_in:
ext.core_since = Version((*entry.promoted_in, 0))
More information about the mesa-commit
mailing list