winevulkan: Use WINE_VK_VERSION to limit supported features.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-07-13 10:55:38 +02:00 committed by Alexandre Julliard
parent a45b04273f
commit 8bd787c3b3
1 changed files with 19 additions and 3 deletions

View File

@ -2306,6 +2306,15 @@ class VkRegistry(object):
self.funcs = {} self.funcs = {}
self.types = {} 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 # Overall strategy for parsing the registry is to first
# parse all type / function definitions. Then parse # parse all type / function definitions. Then parse
# features and extensions to decide which types / functions # features and extensions to decide which types / functions
@ -2323,6 +2332,14 @@ class VkRegistry(object):
self.copyright = root.find('./comment').text 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): def _mark_command_required(self, command):
""" Helper function to mark a certain command and the datatypes it needs as required.""" """ Helper function to mark a certain command and the datatypes it needs as required."""
def mark_bitmask_dependencies(bitmask, types): def mark_bitmask_dependencies(bitmask, types):
@ -2542,7 +2559,7 @@ class VkRegistry(object):
type_info.required = True type_info.required = True
feature = require.attrib.get("feature") feature = require.attrib.get("feature")
if feature == "VK_VERSION_1_1": if feature and not self._is_feature_supported(feature):
continue continue
# Pull in any commands we need. We infer types to pull in from the command # 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": if tag.tag == "comment":
continue continue
elif tag.tag == "command": elif tag.tag == "command":
# For now limit to 1.0 features as various 1.1 features need more work. if not self._is_feature_supported(feature_name):
if feature_name == "VK_VERSION_1_1":
continue continue
name = tag.attrib["name"] name = tag.attrib["name"]
self._mark_command_required(name) self._mark_command_required(name)