winevulkan: Support output dynamic array conversion.

This commit is contained in:
Jacek Caban 2022-11-06 19:17:27 +01:00 committed by Alexandre Julliard
parent 121ca10f5d
commit f3bf30688c
2 changed files with 67 additions and 10 deletions

View file

@ -1310,12 +1310,12 @@ class VkMember(VkVariable):
win_type = "win32" if conv else "win64"
if self.needs_conversion(conv, unwrap, direction, False):
if self.is_dynamic_array():
# Array length is either a variable name (string) or an int.
count = self.dyn_array_len if isinstance(self.dyn_array_len, int) else "{0}{1}".format(input, self.dyn_array_len)
host_part = "host" if unwrap else "unwrapped_host"
if direction == Direction.OUTPUT:
LOGGER.warn("TODO: implement copying of returnedonly dynamic array for {0}.{1}".format(self.type, self.name))
return "convert_{2}_array_{6}_to_{5}({3}{1}, {0}{1}, {4});\n".format(output, self.name, self.type, input, count, win_type, host_part)
else:
# Array length is either a variable name (string) or an int.
count = self.dyn_array_len if isinstance(self.dyn_array_len, int) else "{0}{1}".format(input, self.dyn_array_len)
host_part = "host" if unwrap else "unwrapped_host"
return "{0}{1} = convert_{2}_array_{5}_to_{6}(ctx, {3}{1}, {4});\n".format(output, self.name, self.type, input, count, win_type, host_part)
elif self.is_static_array():
count = self.array_len
@ -1902,12 +1902,6 @@ class VkStruct(Sequence):
if self.name in ["VkSparseImageMemoryRequirements", "VkSparseImageMemoryRequirements2"]:
return False
# FIXME: we can't handle output dynamic arrays yet, remove once we can handle it
if direction == Direction.OUTPUT and self.name in ["VkDeviceFaultInfoEXT",
"VkDeviceFaultAddressInfoEXT",
"VkDeviceFaultVendorInfoEXT"]:
return False
# pFixedRateFlags field is missing const, but it doesn't need output conversion
if direction == Direction.OUTPUT and self.name == "VkImageCompressionControlEXT":
return False

View file

@ -5802,6 +5802,17 @@ static inline void convert_VkDeviceFaultAddressInfoEXT_win32_to_host(const VkDev
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkDeviceFaultAddressInfoEXT_host_to_win32(const VkDeviceFaultAddressInfoEXT_host *in, VkDeviceFaultAddressInfoEXT *out)
{
if (!in) return;
out->addressType = in->addressType;
out->reportedAddress = in->reportedAddress;
out->addressPrecision = in->addressPrecision;
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline VkDeviceFaultAddressInfoEXT_host *convert_VkDeviceFaultAddressInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkDeviceFaultAddressInfoEXT *in, uint32_t count)
{
@ -5820,6 +5831,20 @@ static inline VkDeviceFaultAddressInfoEXT_host *convert_VkDeviceFaultAddressInfo
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkDeviceFaultAddressInfoEXT_array_host_to_win32(const VkDeviceFaultAddressInfoEXT_host *in, VkDeviceFaultAddressInfoEXT *out, uint32_t count)
{
unsigned int i;
if (!in) return;
for (i = 0; i < count; i++)
{
convert_VkDeviceFaultAddressInfoEXT_host_to_win32(&in[i], &out[i]);
}
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkDeviceFaultVendorInfoEXT_win32_to_host(const VkDeviceFaultVendorInfoEXT *in, VkDeviceFaultVendorInfoEXT_host *out)
{
@ -5831,6 +5856,17 @@ static inline void convert_VkDeviceFaultVendorInfoEXT_win32_to_host(const VkDevi
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkDeviceFaultVendorInfoEXT_host_to_win32(const VkDeviceFaultVendorInfoEXT_host *in, VkDeviceFaultVendorInfoEXT *out)
{
if (!in) return;
memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char));
out->vendorFaultCode = in->vendorFaultCode;
out->vendorFaultData = in->vendorFaultData;
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline VkDeviceFaultVendorInfoEXT_host *convert_VkDeviceFaultVendorInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkDeviceFaultVendorInfoEXT *in, uint32_t count)
{
@ -5849,6 +5885,20 @@ static inline VkDeviceFaultVendorInfoEXT_host *convert_VkDeviceFaultVendorInfoEX
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkDeviceFaultVendorInfoEXT_array_host_to_win32(const VkDeviceFaultVendorInfoEXT_host *in, VkDeviceFaultVendorInfoEXT *out, uint32_t count)
{
unsigned int i;
if (!in) return;
for (i = 0; i < count; i++)
{
convert_VkDeviceFaultVendorInfoEXT_host_to_win32(&in[i], &out[i]);
}
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkDeviceFaultInfoEXT_win32_to_host(struct conversion_context *ctx, const VkDeviceFaultInfoEXT *in, VkDeviceFaultInfoEXT_host *out)
{
@ -5863,6 +5913,18 @@ static inline void convert_VkDeviceFaultInfoEXT_win32_to_host(struct conversion_
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkDeviceFaultInfoEXT_host_to_win32(const VkDeviceFaultInfoEXT_host *in, VkDeviceFaultInfoEXT *out)
{
if (!in) return;
memcpy(out->description, in->description, VK_MAX_DESCRIPTION_SIZE * sizeof(char));
convert_VkDeviceFaultAddressInfoEXT_array_host_to_win32(in->pAddressInfos, out->pAddressInfos, 1);
convert_VkDeviceFaultVendorInfoEXT_array_host_to_win32(in->pVendorInfos, out->pVendorInfos, 1);
out->pVendorBinaryData = in->pVendorBinaryData;
}
#endif /* USE_STRUCT_CONVERSION */
#if defined(USE_STRUCT_CONVERSION)
static inline void convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win32_to_host(const VkDeviceMemoryOpaqueCaptureAddressInfo *in, VkDeviceMemoryOpaqueCaptureAddressInfo_host *out)
{
@ -16938,6 +17000,7 @@ static NTSTATUS thunk32_vkGetDeviceFaultInfoEXT(void *args)
convert_VkDeviceFaultInfoEXT_win32_to_host(&ctx, params->pFaultInfo, &pFaultInfo_host);
params->result = wine_device_from_handle(params->device)->funcs.p_vkGetDeviceFaultInfoEXT(wine_device_from_handle(params->device)->device, &pFaultCounts_host, &pFaultInfo_host);
convert_VkDeviceFaultCountsEXT_host_to_win32(&pFaultCounts_host, params->pFaultCounts);
convert_VkDeviceFaultInfoEXT_host_to_win32(&pFaultInfo_host, params->pFaultInfo);
free_conversion_context(&ctx);
return STATUS_SUCCESS;
}