=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: winevulkan: Use WINE_VK_VERSION to limit supported features.

Alexandre Julliard julliard at winehq.org
Fri Jul 13 15:01:46 CDT 2018


Module: wine
Branch: master
Commit: 8bd787c3b3ed8665b3a13eaaec406e63b5cfbad0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8bd787c3b3ed8665b3a13eaaec406e63b5cfbad0

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Fri Jul 13 10:55:38 2018 +0200

winevulkan: Use WINE_VK_VERSION to limit supported features.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winevulkan/make_vulkan | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index fbb8528..76ea95f 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -2306,6 +2306,15 @@ class VkRegistry(object):
         self.funcs = {}
         self.types = {}
 
+        self.version_regex = re.compile(
+            r'^'
+            r'VK_VERSION_'
+            r'(?P<major>[0-9])'
+            r'_'
+            r'(?P<minor>[0-9])'
+            r'$'
+        )
+
         # Overall strategy for parsing the registry is to first
         # parse all type / function definitions. Then parse
         # features and extensions to decide which types / functions
@@ -2323,6 +2332,14 @@ class VkRegistry(object):
 
         self.copyright = root.find('./comment').text
 
+    def _is_feature_supported(self, feature):
+        version = self.version_regex.match(feature)
+        if not version:
+            return True
+
+        version = tuple(map(int, version.group('major', 'minor')))
+        return version <= WINE_VK_VERSION
+
     def _mark_command_required(self, command):
         """ Helper function to mark a certain command and the datatypes it needs as required."""
         def mark_bitmask_dependencies(bitmask, types):
@@ -2542,7 +2559,7 @@ class VkRegistry(object):
                     type_info.required = True
 
                 feature = require.attrib.get("feature")
-                if feature == "VK_VERSION_1_1":
+                if feature and not self._is_feature_supported(feature):
                     continue
 
                 # Pull in any commands we need. We infer types to pull in from the command
@@ -2569,8 +2586,7 @@ class VkRegistry(object):
                     if tag.tag == "comment":
                         continue
                     elif tag.tag == "command":
-                        # For now limit to 1.0 features as various 1.1 features need more work.
-                        if feature_name == "VK_VERSION_1_1":
+                        if not self._is_feature_supported(feature_name):
                             continue
                         name = tag.attrib["name"]
                         self._mark_command_required(name)




More information about the wine-cvs mailing list