Commit 69ca5159 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

winevulkan: Parse forward declared struct members.

parent 04951e78
...@@ -780,9 +780,10 @@ class VkHandle(object): ...@@ -780,9 +780,10 @@ class VkHandle(object):
class VkMember(object): class VkMember(object):
def __init__(self, const=False, _type=None, pointer=None, name=None, array_len=None, dyn_array_len=None, optional=False, def __init__(self, const=False, struct_fwd_decl=False,_type=None, pointer=None, name=None, array_len=None,
extension_structs=None): dyn_array_len=None, optional=False, extension_structs=None):
self.const = const self.const = const
self.struct_fwd_decl = struct_fwd_decl
self.name = name self.name = name
self.pointer = pointer self.pointer = pointer
self.type = _type self.type = _type
...@@ -805,8 +806,8 @@ class VkMember(object): ...@@ -805,8 +806,8 @@ class VkMember(object):
return False return False
def __repr__(self): def __repr__(self):
return "{0} {1} {2} {3} {4} {5}".format(self.const, self.type, self.pointer, self.name, self.array_len, return "{0} {1} {2} {3} {4} {5} {6}".format(self.const, self.struct_fwd_decl, self.type, self.pointer,
self.dyn_array_len) self.name, self.array_len, self.dyn_array_len)
@staticmethod @staticmethod
def from_xml(member): def from_xml(member):
...@@ -815,11 +816,22 @@ class VkMember(object): ...@@ -815,11 +816,22 @@ class VkMember(object):
name_elem = member.find("name") name_elem = member.find("name")
type_elem = member.find("type") type_elem = member.find("type")
const = True if member.text and "const" in member.text else False const = False
struct_fwd_decl = False
member_type = None member_type = None
pointer = None pointer = None
array_len = None array_len = None
if member.text:
if "const" in member.text:
const = True
# Some members contain forward declarations:
# - VkBaseInstructure has a member "const struct VkBaseInStructure *pNext"
# - VkWaylandSurfaceCreateInfoKHR has a member "struct wl_display *display"
if "struct" in member.text:
struct_fwd_decl = True
if type_elem is not None: if type_elem is not None:
member_type = type_elem.text member_type = type_elem.text
if type_elem.tail is not None: if type_elem.tail is not None:
...@@ -855,8 +867,8 @@ class VkMember(object): ...@@ -855,8 +867,8 @@ class VkMember(object):
# Remove brackets around length # Remove brackets around length
array_len = name_elem.tail.strip("[]") array_len = name_elem.tail.strip("[]")
return VkMember(const=const, _type=member_type, pointer=pointer, name=name_elem.text, array_len=array_len, return VkMember(const=const, struct_fwd_decl=struct_fwd_decl, _type=member_type, pointer=pointer, name=name_elem.text,
dyn_array_len=dyn_array_len, optional=optional, extension_structs=extension_structs) array_len=array_len, dyn_array_len=dyn_array_len, optional=optional, extension_structs=extension_structs)
def copy(self, input, output, direction): def copy(self, input, output, direction):
""" Helper method for use by conversion logic to generate a C-code statement to copy this member. """ """ Helper method for use by conversion logic to generate a C-code statement to copy this member. """
...@@ -900,6 +912,9 @@ class VkMember(object): ...@@ -900,6 +912,9 @@ class VkMember(object):
if self.is_const(): if self.is_const():
text += "const " text += "const "
if self.is_struct_forward_declaration():
text += "struct "
if conv and self.is_struct(): if conv and self.is_struct():
text += "{0}_host".format(self.type) text += "{0}_host".format(self.type)
else: else:
...@@ -974,6 +989,9 @@ class VkMember(object): ...@@ -974,6 +989,9 @@ class VkMember(object):
def is_struct(self): def is_struct(self):
return self.type_info["category"] == "struct" return self.type_info["category"] == "struct"
def is_struct_forward_declaration(self):
return self.struct_fwd_decl
def is_union(self): def is_union(self):
return self.type_info["category"] == "union" return self.type_info["category"] == "union"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment