From 69ca5159155de674a7ee379c0aa9a787d97a8e83 Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Sun, 3 Jun 2018 15:52:11 -0700 Subject: [PATCH] winevulkan: Parse forward declared struct members. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roderick Colenbrander Signed-off-by: Józef Kucia Signed-off-by: Alexandre Julliard --- dlls/winevulkan/make_vulkan | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 81148ef0bda..5fae8dc63b9 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -780,9 +780,10 @@ class VkHandle(object): class VkMember(object): - def __init__(self, const=False, _type=None, pointer=None, name=None, array_len=None, dyn_array_len=None, optional=False, - extension_structs=None): + def __init__(self, const=False, struct_fwd_decl=False,_type=None, pointer=None, name=None, array_len=None, + dyn_array_len=None, optional=False, extension_structs=None): self.const = const + self.struct_fwd_decl = struct_fwd_decl self.name = name self.pointer = pointer self.type = _type @@ -805,8 +806,8 @@ class VkMember(object): return False def __repr__(self): - return "{0} {1} {2} {3} {4} {5}".format(self.const, self.type, self.pointer, self.name, self.array_len, - self.dyn_array_len) + return "{0} {1} {2} {3} {4} {5} {6}".format(self.const, self.struct_fwd_decl, self.type, self.pointer, + self.name, self.array_len, self.dyn_array_len) @staticmethod def from_xml(member): @@ -815,11 +816,22 @@ class VkMember(object): name_elem = member.find("name") 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 pointer = 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: member_type = type_elem.text if type_elem.tail is not None: @@ -855,8 +867,8 @@ class VkMember(object): # Remove brackets around length array_len = name_elem.tail.strip("[]") - return VkMember(const=const, _type=member_type, pointer=pointer, name=name_elem.text, array_len=array_len, - dyn_array_len=dyn_array_len, optional=optional, extension_structs=extension_structs) + return VkMember(const=const, struct_fwd_decl=struct_fwd_decl, _type=member_type, pointer=pointer, name=name_elem.text, + array_len=array_len, dyn_array_len=dyn_array_len, optional=optional, extension_structs=extension_structs) def copy(self, input, output, direction): """ Helper method for use by conversion logic to generate a C-code statement to copy this member. """ @@ -900,6 +912,9 @@ class VkMember(object): if self.is_const(): text += "const " + if self.is_struct_forward_declaration(): + text += "struct " + if conv and self.is_struct(): text += "{0}_host".format(self.type) else: @@ -974,6 +989,9 @@ class VkMember(object): def is_struct(self): return self.type_info["category"] == "struct" + def is_struct_forward_declaration(self): + return self.struct_fwd_decl + def is_union(self): return self.type_info["category"] == "union"