mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 22:30:11 +01:00
Vulkan: Properly filter structs in vk_cmd_queue_gen
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
a9c4423ed3
commit
ef3e75d7f3
1 changed files with 19 additions and 4 deletions
|
|
@ -33,7 +33,8 @@ from mako.template import Template
|
|||
|
||||
# Mesa-local imports must be declared in meson variable
|
||||
# '{file_without_suffix}_depend_files'.
|
||||
from vk_entrypoints import get_entrypoints_from_xml, EntrypointParam
|
||||
from vk_entrypoints import EntrypointParam, get_entrypoints_from_xml
|
||||
from vk_extensions import filter_api, get_all_required
|
||||
|
||||
# These have hand-typed implementations in vk_cmd_enqueue.c
|
||||
MANUAL_COMMANDS = [
|
||||
|
|
@ -527,16 +528,26 @@ def get_types_defines(doc):
|
|||
|
||||
return types_to_defines
|
||||
|
||||
def get_types(doc, types_to_defines):
|
||||
def get_types(doc, api, types_to_defines):
|
||||
"""Extract the types from the registry."""
|
||||
types = {}
|
||||
|
||||
required = get_all_required(doc, 'type', api)
|
||||
|
||||
for _type in doc.findall('./types/type'):
|
||||
if _type.attrib.get('category') != 'struct':
|
||||
continue
|
||||
if not filter_api(_type, api):
|
||||
continue
|
||||
if _type.attrib['name'] not in required:
|
||||
continue
|
||||
|
||||
members = []
|
||||
type_enum = None
|
||||
for p in _type.findall('./member'):
|
||||
if not filter_api(p, api):
|
||||
continue
|
||||
|
||||
mem_type = p.find('./type').text
|
||||
mem_name = p.find('./name').text
|
||||
mem_decl = ''.join(p.itertext())
|
||||
|
|
@ -557,6 +568,10 @@ def get_types(doc, types_to_defines):
|
|||
for _type in doc.findall('./types/type'):
|
||||
if _type.attrib.get('category') != 'struct':
|
||||
continue
|
||||
if not filter_api(_type, api):
|
||||
continue
|
||||
if _type.attrib['name'] not in required:
|
||||
continue
|
||||
if _type.attrib.get('structextends') is None:
|
||||
continue
|
||||
for extended in _type.attrib.get('structextends').split(','):
|
||||
|
|
@ -564,12 +579,12 @@ def get_types(doc, types_to_defines):
|
|||
|
||||
return types
|
||||
|
||||
def get_types_from_xml(xml_files):
|
||||
def get_types_from_xml(xml_files, api='vulkan'):
|
||||
types = {}
|
||||
|
||||
for filename in xml_files:
|
||||
doc = et.parse(filename)
|
||||
types.update(get_types(doc, get_types_defines(doc)))
|
||||
types.update(get_types(doc, api, get_types_defines(doc)))
|
||||
|
||||
return types
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue