winevulkan: Forward declare required structs for function pointer.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Signed-off-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Georg Lehmann 2020-09-22 16:31:49 +02:00 committed by Alexandre Julliard
parent 51b3191cd3
commit d4b162509f
1 changed files with 13 additions and 3 deletions

View File

@ -805,11 +805,12 @@ class VkFunction(object):
class VkFunctionPointer(object):
def __init__(self, _type, name, members):
def __init__(self, _type, name, members, forward_decls):
self.name = name
self.members = members
self.type = _type
self.required = False
self.forward_decls = forward_decls
@staticmethod
def from_xml(funcpointer):
@ -846,10 +847,19 @@ class VkFunctionPointer(object):
_type = funcpointer.text
name = funcpointer.find("name").text
return VkFunctionPointer(_type, name, members)
if "requires" in funcpointer.attrib:
forward_decls = funcpointer.attrib.get("requires").split(",")
else:
forward_decls = []
return VkFunctionPointer(_type, name, members, forward_decls)
def definition(self):
text = "{0} {1})(\n".format(self.type, self.name)
text = ""
# forward declare required structs
for decl in self.forward_decls:
text += "typedef struct {0} {0};\n".format(decl)
text += "{0} {1})(\n".format(self.type, self.name)
first = True
if len(self.members) > 0: