Module: wine
Branch: master
Commit: a6cd7ee257f7dfbbf499828e96e90db8dccb29c1
URL: https://gitlab.winehq.org/wine/wine/-/commit/a6cd7ee257f7dfbbf499828e96e90d…
Author: Jacek Caban <jacek(a)codeweavers.com>
Date: Wed Nov 2 20:44:18 2022 +0100
winevulkan: Remove unneeded needs_conversion() calls.
---
dlls/winevulkan/make_vulkan | 36 ++++--------------------------------
1 file changed, 4 insertions(+), 32 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index dbe10a1b6d3..10e5a03f11b 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -654,19 +654,6 @@ class VkFunction(object):
def returns_longlong(self):
return self.type in ["uint64_t", "VkDeviceAddress"]
- def needs_conversion(self):
- """ Check if the function needs any input/output type conversion.
- Functions need input/output conversion if struct parameters have
- alignment differences between Win32 and Linux 32-bit.
- """
-
- for p in self.params:
- if p.needs_conversion():
- LOGGER.debug("Parameter {0} to {1} requires conversion".format(p.name, self.name))
- return True
-
- return False
-
def needs_unwrapping(self):
""" Check if the function needs any input/output type unwrapping.
Functions need input/output unwrapping if struct parameters have
@@ -1098,9 +1085,6 @@ class VkHandle(object):
def is_wrapped(self):
return self.native_handle("test") is not None
- def needs_conversion(self):
- return False
-
def needs_unwrapping(self):
return self.is_wrapped()
@@ -1384,20 +1368,17 @@ class VkMember(VkVariable):
def get_conversions(self, func=None):
""" Return any conversion description for this member and its children when conversion is needed. """
- # Check if we need conversion either for this member itself or for any child members
- # in case member represents a struct.
- if not self.needs_conversion() and not self.needs_unwrapping():
- return None
-
conversions = []
# Collect any conversion for any member structs.
if self.is_struct():
struct = self.type_info["data"]
for m in struct:
+ if m.type == struct.name:
+ continue
+
m.needs_struct_extensions_conversion()
- if m.needs_conversion() or m.needs_unwrapping():
- conversions.extend(m.get_conversions(func))
+ conversions.extend(m.get_conversions(func))
struct.needs_struct_extensions_conversion()
direction = Direction.OUTPUT if struct.returnedonly else Direction.INPUT
@@ -1640,9 +1621,6 @@ class VkParam(VkVariable):
elif not self.is_handle():
return None
- if not self.needs_conversion() and not self.needs_unwrapping():
- return None
-
conversions = []
# Collect any member conversions first, so we can guarantee
@@ -1653,9 +1631,6 @@ class VkParam(VkVariable):
if not m.is_struct():
continue
- if not m.needs_conversion() and not m.needs_unwrapping():
- continue
-
conversions.extend(m.get_conversions(func))
# Conversion requirements for the 'parent' parameter.
@@ -2334,9 +2309,6 @@ class VkGenerator(object):
if not func.is_required():
continue
- if not func.needs_conversion() and not func.needs_unwrapping():
- continue
-
conversions = func.get_conversions()
for conv in conversions:
# Append if we don't already have this conversion.
Module: wine
Branch: master
Commit: 844f1b1705fa5ba94772c90b08938e3a6ed0b869
URL: https://gitlab.winehq.org/wine/wine/-/commit/844f1b1705fa5ba94772c90b08938e…
Author: Jacek Caban <jacek(a)codeweavers.com>
Date: Wed Nov 2 19:58:27 2022 +0100
winevulkan: Introduce needs_host_type helper function.
---
dlls/winevulkan/make_vulkan | 43 ++++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index 2a369f5b3c4..dbe10a1b6d3 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -711,7 +711,7 @@ class VkFunction(object):
pfn += param.const + " "
pfn += param.type
- if conv and param.needs_conversion():
+ if conv and param.needs_host_type():
pfn += "_host"
if param.is_pointer():
@@ -780,7 +780,7 @@ class VkFunction(object):
# Declare any tmp parameters for conversion.
for p in self.params:
- if p.needs_conversion() and conv:
+ if p.needs_host_type() and conv:
if p.is_dynamic_array():
body += " {0}_host *{1}_host;\n".format(p.type, p.name)
else:
@@ -1206,6 +1206,10 @@ class VkVariable(object):
return self.is_struct() and self.struct.needs_alloc(conv, unwrap)
+ def needs_host_type(self):
+ return self.is_struct() and self.struct.needs_host_type()
+
+
class VkMember(VkVariable):
def __init__(self, const=False, struct_fwd_decl=False,_type=None, pointer=None, name=None, array_len=None,
dyn_array_len=None, optional=False, values=None, object_type=None, bit_width=None):
@@ -1580,7 +1584,7 @@ class VkParam(VkVariable):
proto += self.type
name = self.name
- if is_thunk and self.needs_conversion():
+ if is_thunk and self.needs_host_type():
proto += "_host"
if is_member and self.needs_alignment():
@@ -1687,13 +1691,6 @@ class VkParam(VkVariable):
if not self.is_struct():
return False
- # VkSparseImageMemoryRequirements(2) is used by vkGetImageSparseMemoryRequirements(2).
- # This function is tricky to wrap, because how to wrap depends on whether
- # pSparseMemoryRequirements is NULL or not. Luckily for VkSparseImageMemoryRequirements(2)
- # the alignment works out in such a way that no conversion is needed between win32 and Linux.
- if self.type in ["VkSparseImageMemoryRequirements", "VkSparseImageMemoryRequirements2"]:
- return False
-
# If a structure needs alignment changes, it means we need to
# perform parameter conversion between win32 and host.
if self.struct.needs_conversion():
@@ -1956,6 +1953,13 @@ class VkStruct(Sequence):
or if they include other structures which need alignment.
"""
+ # VkSparseImageMemoryRequirements(2) is used by vkGetImageSparseMemoryRequirements(2).
+ # This function is tricky to wrap, because how to wrap depends on whether
+ # pSparseMemoryRequirements is NULL or not. Luckily for VkSparseImageMemoryRequirements(2)
+ # the alignment works out in such a way that no conversion is needed between win32 and Linux.
+ if self.name in ["VkSparseImageMemoryRequirements", "VkSparseImageMemoryRequirements2"]:
+ return False
+
if self.needs_alignment():
return True
@@ -1987,6 +1991,19 @@ class VkStruct(Sequence):
return False
+ def needs_host_type(self):
+ # FIXME: Remove once we don't need need it
+ if self.name in ["VkSparseImageMemoryRequirements", "VkSparseImageMemoryRequirements2"]:
+ return False
+
+ for m in self.members:
+ if self.name == m.type:
+ continue
+ if m.needs_alignment():
+ return True
+ if m.is_struct() and m.struct.needs_host_type():
+ return True
+
def needs_struct_extensions_conversion(self):
""" Checks if structure extensions in pNext chain need conversion. """
ret = False
@@ -2037,7 +2054,7 @@ class ConversionFunction(object):
else:
body += "#if !defined(USE_STRUCT_CONVERSION)\n"
- if self.conv and self.operand.needs_conversion():
+ if self.conv and isinstance(self.operand, VkStruct) and self.operand.needs_host_type():
host_type = "{0}_host".format(self.type)
else:
host_type = self.type
@@ -2549,7 +2566,7 @@ class VkGenerator(object):
LOGGER.debug("skipping {0} in vulkan_device_funcs".format(vk_func.name))
continue
- f.write(" {0};\n".format(vk_func.pfn(conv=vk_func.needs_conversion())))
+ f.write(" {0};\n".format(vk_func.pfn(conv=True)))
f.write("};\n\n")
f.write("/* For use by vkInstance and children */\n")
@@ -2562,7 +2579,7 @@ class VkGenerator(object):
LOGGER.debug("skipping {0} in vulkan_instance_funcs".format(vk_func.name))
continue
- f.write(" {0};\n".format(vk_func.pfn(conv=vk_func.needs_conversion())))
+ f.write(" {0};\n".format(vk_func.pfn(conv=True)))
f.write("};\n\n")
f.write("#define ALL_VK_DEVICE_FUNCS() \\\n")