Commit f3bf3068 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winevulkan: Support output dynamic array conversion.

parent 121ca10f
...@@ -1310,12 +1310,12 @@ class VkMember(VkVariable): ...@@ -1310,12 +1310,12 @@ class VkMember(VkVariable):
win_type = "win32" if conv else "win64" win_type = "win32" if conv else "win64"
if self.needs_conversion(conv, unwrap, direction, False): if self.needs_conversion(conv, unwrap, direction, False):
if self.is_dynamic_array(): 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: 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: 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) 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(): elif self.is_static_array():
count = self.array_len count = self.array_len
...@@ -1902,12 +1902,6 @@ class VkStruct(Sequence): ...@@ -1902,12 +1902,6 @@ class VkStruct(Sequence):
if self.name in ["VkSparseImageMemoryRequirements", "VkSparseImageMemoryRequirements2"]: if self.name in ["VkSparseImageMemoryRequirements", "VkSparseImageMemoryRequirements2"]:
return False 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 # pFixedRateFlags field is missing const, but it doesn't need output conversion
if direction == Direction.OUTPUT and self.name == "VkImageCompressionControlEXT": if direction == Direction.OUTPUT and self.name == "VkImageCompressionControlEXT":
return False return False
......
...@@ -5803,6 +5803,17 @@ static inline void convert_VkDeviceFaultAddressInfoEXT_win32_to_host(const VkDev ...@@ -5803,6 +5803,17 @@ static inline void convert_VkDeviceFaultAddressInfoEXT_win32_to_host(const VkDev
#endif /* USE_STRUCT_CONVERSION */ #endif /* USE_STRUCT_CONVERSION */
#if defined(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) static inline VkDeviceFaultAddressInfoEXT_host *convert_VkDeviceFaultAddressInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkDeviceFaultAddressInfoEXT *in, uint32_t count)
{ {
VkDeviceFaultAddressInfoEXT_host *out; VkDeviceFaultAddressInfoEXT_host *out;
...@@ -5821,6 +5832,20 @@ static inline VkDeviceFaultAddressInfoEXT_host *convert_VkDeviceFaultAddressInfo ...@@ -5821,6 +5832,20 @@ static inline VkDeviceFaultAddressInfoEXT_host *convert_VkDeviceFaultAddressInfo
#endif /* USE_STRUCT_CONVERSION */ #endif /* USE_STRUCT_CONVERSION */
#if defined(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) static inline void convert_VkDeviceFaultVendorInfoEXT_win32_to_host(const VkDeviceFaultVendorInfoEXT *in, VkDeviceFaultVendorInfoEXT_host *out)
{ {
if (!in) return; if (!in) return;
...@@ -5832,6 +5857,17 @@ static inline void convert_VkDeviceFaultVendorInfoEXT_win32_to_host(const VkDevi ...@@ -5832,6 +5857,17 @@ static inline void convert_VkDeviceFaultVendorInfoEXT_win32_to_host(const VkDevi
#endif /* USE_STRUCT_CONVERSION */ #endif /* USE_STRUCT_CONVERSION */
#if defined(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) static inline VkDeviceFaultVendorInfoEXT_host *convert_VkDeviceFaultVendorInfoEXT_array_win32_to_host(struct conversion_context *ctx, const VkDeviceFaultVendorInfoEXT *in, uint32_t count)
{ {
VkDeviceFaultVendorInfoEXT_host *out; VkDeviceFaultVendorInfoEXT_host *out;
...@@ -5850,6 +5886,20 @@ static inline VkDeviceFaultVendorInfoEXT_host *convert_VkDeviceFaultVendorInfoEX ...@@ -5850,6 +5886,20 @@ static inline VkDeviceFaultVendorInfoEXT_host *convert_VkDeviceFaultVendorInfoEX
#endif /* USE_STRUCT_CONVERSION */ #endif /* USE_STRUCT_CONVERSION */
#if defined(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) static inline void convert_VkDeviceFaultInfoEXT_win32_to_host(struct conversion_context *ctx, const VkDeviceFaultInfoEXT *in, VkDeviceFaultInfoEXT_host *out)
{ {
if (!in) return; if (!in) return;
...@@ -5864,6 +5914,18 @@ static inline void convert_VkDeviceFaultInfoEXT_win32_to_host(struct conversion_ ...@@ -5864,6 +5914,18 @@ static inline void convert_VkDeviceFaultInfoEXT_win32_to_host(struct conversion_
#endif /* USE_STRUCT_CONVERSION */ #endif /* USE_STRUCT_CONVERSION */
#if defined(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) static inline void convert_VkDeviceMemoryOpaqueCaptureAddressInfo_win32_to_host(const VkDeviceMemoryOpaqueCaptureAddressInfo *in, VkDeviceMemoryOpaqueCaptureAddressInfo_host *out)
{ {
if (!in) return; if (!in) return;
...@@ -16938,6 +17000,7 @@ static NTSTATUS thunk32_vkGetDeviceFaultInfoEXT(void *args) ...@@ -16938,6 +17000,7 @@ static NTSTATUS thunk32_vkGetDeviceFaultInfoEXT(void *args)
convert_VkDeviceFaultInfoEXT_win32_to_host(&ctx, params->pFaultInfo, &pFaultInfo_host); 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); 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_VkDeviceFaultCountsEXT_host_to_win32(&pFaultCounts_host, params->pFaultCounts);
convert_VkDeviceFaultInfoEXT_host_to_win32(&pFaultInfo_host, params->pFaultInfo);
free_conversion_context(&ctx); free_conversion_context(&ctx);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
......
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