mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 02:20:11 +01:00
vulkan: Properly filter structs in vk_physical_device_features
This uses get_all_required to filter structs and also filters struct members based on API. Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21225>
This commit is contained in:
parent
5021344fa6
commit
f24f753c8a
2 changed files with 16 additions and 12 deletions
|
|
@ -47,6 +47,7 @@ vk_cmd_queue_gen_depend_files = [
|
|||
vk_entrypoints_depend_files,
|
||||
]
|
||||
vk_physical_device_features_gen_depend_files = [
|
||||
files('vk_extensions.py'),
|
||||
]
|
||||
|
||||
vk_entrypoints_gen = files('vk_entrypoints_gen.py')
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ from collections import OrderedDict, namedtuple
|
|||
import xml.etree.ElementTree as et
|
||||
|
||||
from mako.template import Template
|
||||
from vk_extensions import get_all_required, filter_api
|
||||
|
||||
TEMPLATE_C = Template(COPYRIGHT + """
|
||||
/* This file generated from ${filename}, don't edit directly. */
|
||||
|
|
@ -157,17 +158,16 @@ def get_pdev_features(doc):
|
|||
|
||||
return None
|
||||
|
||||
def get_features(doc):
|
||||
def filter_api(elem, api):
|
||||
if 'api' not in elem.attrib:
|
||||
return True
|
||||
|
||||
return api in elem.attrib['api'].split(',')
|
||||
|
||||
def get_features(doc, api):
|
||||
features = OrderedDict()
|
||||
|
||||
provisional_structs = set()
|
||||
|
||||
# we want to ignore struct types that are part of provisional extensions
|
||||
for _extension in doc.findall('./extensions/extension'):
|
||||
if _extension.attrib.get('provisional') != 'true':
|
||||
continue
|
||||
for p in _extension.findall('./require/type'):
|
||||
provisional_structs.add(p.attrib.get('name'))
|
||||
required = get_all_required(doc, 'type', api)
|
||||
|
||||
# parse all struct types where structextends VkPhysicalDeviceFeatures2
|
||||
for _type in doc.findall('./types/type'):
|
||||
|
|
@ -175,7 +175,7 @@ def get_features(doc):
|
|||
continue
|
||||
if _type.attrib.get('structextends') != 'VkPhysicalDeviceFeatures2,VkDeviceCreateInfo':
|
||||
continue
|
||||
if _type.attrib.get('name') in provisional_structs:
|
||||
if _type.attrib['name'] not in required:
|
||||
continue
|
||||
|
||||
# find Vulkan structure type
|
||||
|
|
@ -187,6 +187,9 @@ def get_features(doc):
|
|||
flags = []
|
||||
|
||||
for p in _type.findall('./member'):
|
||||
if not filter_api(p, api):
|
||||
continue
|
||||
|
||||
m_name = p.find('./name').text
|
||||
if m_name == 'pNext':
|
||||
pass
|
||||
|
|
@ -201,13 +204,13 @@ def get_features(doc):
|
|||
|
||||
return features.values()
|
||||
|
||||
def get_features_from_xml(xml_files):
|
||||
def get_features_from_xml(xml_files, api='vulkan'):
|
||||
pdev_features = None
|
||||
features = []
|
||||
|
||||
for filename in xml_files:
|
||||
doc = et.parse(filename)
|
||||
features += get_features(doc)
|
||||
features += get_features(doc, api)
|
||||
if not pdev_features:
|
||||
pdev_features = get_pdev_features(doc)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue