mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 04:34:48 +00:00
winevulkan: Always convert 32-bit pointer arrays.
This commit is contained in:
parent
3eccac388d
commit
46f84ea226
|
@ -1306,10 +1306,6 @@ class VkVariable(object):
|
||||||
if not conv or not self.needs_ptr32_type() or (not self.is_pointer() and self.type == "size_t"):
|
if not conv or not self.needs_ptr32_type() or (not self.is_pointer() and self.type == "size_t"):
|
||||||
return prefix + self.name
|
return prefix + self.name
|
||||||
|
|
||||||
# FIXME: Use conversion instead
|
|
||||||
if self.name in ["ppUsageCounts", "ppEnabledLayerNames", "ppEnabledExtensionNames"]:
|
|
||||||
return "UlongToPtr({0}{1})".format(prefix, self.name)
|
|
||||||
|
|
||||||
cast_type = ""
|
cast_type = ""
|
||||||
if self.const:
|
if self.const:
|
||||||
cast_type += "const "
|
cast_type += "const "
|
||||||
|
@ -1533,6 +1529,9 @@ class VkMember(VkVariable):
|
||||||
# returnedonly members don't needs input conversions
|
# returnedonly members don't needs input conversions
|
||||||
if not self.is_pointer() and self.returnedonly:
|
if not self.is_pointer() and self.returnedonly:
|
||||||
return False
|
return False
|
||||||
|
# pointer arrays always need input conversion
|
||||||
|
if conv and self.is_dynamic_array() and self.pointer_array:
|
||||||
|
return True
|
||||||
|
|
||||||
if self.is_handle():
|
if self.is_handle():
|
||||||
if unwrap and self.handle.is_wrapped():
|
if unwrap and self.handle.is_wrapped():
|
||||||
|
@ -2457,21 +2456,21 @@ class ArrayConversionFunction(object):
|
||||||
body += " convert_{0}_{1}({2}&in[i], &out[i]);\n".format(
|
body += " convert_{0}_{1}({2}&in[i], &out[i]);\n".format(
|
||||||
struct.name, conv_suffix, ctx_part)
|
struct.name, conv_suffix, ctx_part)
|
||||||
else:
|
else:
|
||||||
body += " if (in[i])\n"
|
|
||||||
body += " {\n"
|
|
||||||
body += " out[i] = conversion_context_alloc(ctx, sizeof(*out[i]));\n"
|
|
||||||
if struct.needs_conversion(self.conv, self.unwrap, self.direction, False):
|
if struct.needs_conversion(self.conv, self.unwrap, self.direction, False):
|
||||||
|
body += " if (in[i])\n"
|
||||||
|
body += " {\n"
|
||||||
|
body += " out[i] = conversion_context_alloc(ctx, sizeof(*out[i]));\n"
|
||||||
if self.conv:
|
if self.conv:
|
||||||
in_param = "({0} *)UlongToPtr(in[i])".format(win_type)
|
in_param = "({0} *)UlongToPtr(in[i])".format(win_type)
|
||||||
else:
|
else:
|
||||||
in_param = "in[i]"
|
in_param = "in[i]"
|
||||||
body += " convert_{0}_{1}({2}{3}, out[i]);\n".format(
|
body += " convert_{0}_{1}({2}{3}, out[i]);\n".format(
|
||||||
struct.name, conv_suffix, ctx_part, in_param)
|
struct.name, conv_suffix, ctx_part, in_param)
|
||||||
|
body += " }\n"
|
||||||
|
body += " else\n"
|
||||||
|
body += " out[i] = NULL;\n"
|
||||||
else:
|
else:
|
||||||
body += " *out[i] = *in[i];\n".format(win_type)
|
body += " out[i] = UlongToPtr(in[i]);\n".format(win_type)
|
||||||
body += " }\n"
|
|
||||||
body += " else\n"
|
|
||||||
body += " out[i] = NULL;\n"
|
|
||||||
elif self.array.is_handle():
|
elif self.array.is_handle():
|
||||||
if self.array.pointer_array:
|
if self.array.pointer_array:
|
||||||
LOGGER.error("Unhandled handle pointer arrays")
|
LOGGER.error("Unhandled handle pointer arrays")
|
||||||
|
@ -2489,6 +2488,8 @@ class ArrayConversionFunction(object):
|
||||||
body += " out[i] = " + handle.driver_handle(input) + ";\n"
|
body += " out[i] = " + handle.driver_handle(input) + ";\n"
|
||||||
else:
|
else:
|
||||||
LOGGER.warning("Unhandled handle output conversion")
|
LOGGER.warning("Unhandled handle output conversion")
|
||||||
|
elif self.array.pointer_array:
|
||||||
|
body += " out[i] = UlongToPtr(in[i]);\n"
|
||||||
else:
|
else:
|
||||||
body += " out[i] = in[i];\n"
|
body += " out[i] = in[i];\n"
|
||||||
|
|
||||||
|
|
|
@ -6485,7 +6485,25 @@ static inline const VkAccelerationStructureBuildGeometryInfoKHR *convert_VkAccel
|
||||||
#endif /* USE_STRUCT_CONVERSION */
|
#endif /* USE_STRUCT_CONVERSION */
|
||||||
|
|
||||||
#if defined(USE_STRUCT_CONVERSION)
|
#if defined(USE_STRUCT_CONVERSION)
|
||||||
static inline void convert_VkMicromapBuildInfoEXT_win32_to_host(const VkMicromapBuildInfoEXT32 *in, VkMicromapBuildInfoEXT *out)
|
static inline const VkMicromapUsageEXT * const*convert_VkMicromapUsageEXT_pointer_array_win32_to_host(struct conversion_context *ctx, const PTR32 *in, uint32_t count)
|
||||||
|
{
|
||||||
|
VkMicromapUsageEXT **out;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if (!in || !count) return NULL;
|
||||||
|
|
||||||
|
out = conversion_context_alloc(ctx, count * sizeof(*out));
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
out[i] = UlongToPtr(in[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (void *)out;
|
||||||
|
}
|
||||||
|
#endif /* USE_STRUCT_CONVERSION */
|
||||||
|
|
||||||
|
#if defined(USE_STRUCT_CONVERSION)
|
||||||
|
static inline void convert_VkMicromapBuildInfoEXT_win32_to_host(struct conversion_context *ctx, const VkMicromapBuildInfoEXT32 *in, VkMicromapBuildInfoEXT *out)
|
||||||
{
|
{
|
||||||
if (!in) return;
|
if (!in) return;
|
||||||
|
|
||||||
|
@ -6497,7 +6515,7 @@ static inline void convert_VkMicromapBuildInfoEXT_win32_to_host(const VkMicromap
|
||||||
out->dstMicromap = in->dstMicromap;
|
out->dstMicromap = in->dstMicromap;
|
||||||
out->usageCountsCount = in->usageCountsCount;
|
out->usageCountsCount = in->usageCountsCount;
|
||||||
out->pUsageCounts = (const VkMicromapUsageEXT *)UlongToPtr(in->pUsageCounts);
|
out->pUsageCounts = (const VkMicromapUsageEXT *)UlongToPtr(in->pUsageCounts);
|
||||||
out->ppUsageCounts = UlongToPtr(in->ppUsageCounts);
|
out->ppUsageCounts = convert_VkMicromapUsageEXT_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppUsageCounts), in->usageCountsCount);
|
||||||
out->data = in->data;
|
out->data = in->data;
|
||||||
out->scratchData = in->scratchData;
|
out->scratchData = in->scratchData;
|
||||||
out->triangleArray = in->triangleArray;
|
out->triangleArray = in->triangleArray;
|
||||||
|
@ -6516,7 +6534,7 @@ static inline const VkMicromapBuildInfoEXT *convert_VkMicromapBuildInfoEXT_array
|
||||||
out = conversion_context_alloc(ctx, count * sizeof(*out));
|
out = conversion_context_alloc(ctx, count * sizeof(*out));
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
convert_VkMicromapBuildInfoEXT_win32_to_host(&in[i], &out[i]);
|
convert_VkMicromapBuildInfoEXT_win32_to_host(ctx, &in[i], &out[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
@ -9156,6 +9174,24 @@ static inline const VkDeviceQueueCreateInfo *convert_VkDeviceQueueCreateInfo_arr
|
||||||
}
|
}
|
||||||
#endif /* USE_STRUCT_CONVERSION */
|
#endif /* USE_STRUCT_CONVERSION */
|
||||||
|
|
||||||
|
#if defined(USE_STRUCT_CONVERSION)
|
||||||
|
static inline const char * const*convert_char_pointer_array_win32_to_host(struct conversion_context *ctx, const PTR32 *in, uint32_t count)
|
||||||
|
{
|
||||||
|
char **out;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if (!in || !count) return NULL;
|
||||||
|
|
||||||
|
out = conversion_context_alloc(ctx, count * sizeof(*out));
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
out[i] = UlongToPtr(in[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (void *)out;
|
||||||
|
}
|
||||||
|
#endif /* USE_STRUCT_CONVERSION */
|
||||||
|
|
||||||
#if !defined(USE_STRUCT_CONVERSION)
|
#if !defined(USE_STRUCT_CONVERSION)
|
||||||
static inline void convert_VkDeviceCreateInfo_win64_to_host(struct conversion_context *ctx, const VkDeviceCreateInfo *in, VkDeviceCreateInfo *out)
|
static inline void convert_VkDeviceCreateInfo_win64_to_host(struct conversion_context *ctx, const VkDeviceCreateInfo *in, VkDeviceCreateInfo *out)
|
||||||
{
|
{
|
||||||
|
@ -10985,9 +11021,9 @@ static inline void convert_VkDeviceCreateInfo_win32_to_host(struct conversion_co
|
||||||
out->queueCreateInfoCount = in->queueCreateInfoCount;
|
out->queueCreateInfoCount = in->queueCreateInfoCount;
|
||||||
out->pQueueCreateInfos = convert_VkDeviceQueueCreateInfo_array_win32_to_host(ctx, (const VkDeviceQueueCreateInfo32 *)UlongToPtr(in->pQueueCreateInfos), in->queueCreateInfoCount);
|
out->pQueueCreateInfos = convert_VkDeviceQueueCreateInfo_array_win32_to_host(ctx, (const VkDeviceQueueCreateInfo32 *)UlongToPtr(in->pQueueCreateInfos), in->queueCreateInfoCount);
|
||||||
out->enabledLayerCount = in->enabledLayerCount;
|
out->enabledLayerCount = in->enabledLayerCount;
|
||||||
out->ppEnabledLayerNames = UlongToPtr(in->ppEnabledLayerNames);
|
out->ppEnabledLayerNames = convert_char_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppEnabledLayerNames), in->enabledLayerCount);
|
||||||
out->enabledExtensionCount = in->enabledExtensionCount;
|
out->enabledExtensionCount = in->enabledExtensionCount;
|
||||||
out->ppEnabledExtensionNames = UlongToPtr(in->ppEnabledExtensionNames);
|
out->ppEnabledExtensionNames = convert_char_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppEnabledExtensionNames), in->enabledExtensionCount);
|
||||||
out->pEnabledFeatures = (const VkPhysicalDeviceFeatures *)UlongToPtr(in->pEnabledFeatures);
|
out->pEnabledFeatures = (const VkPhysicalDeviceFeatures *)UlongToPtr(in->pEnabledFeatures);
|
||||||
|
|
||||||
for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext))
|
for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext))
|
||||||
|
@ -14519,9 +14555,9 @@ static inline void convert_VkInstanceCreateInfo_win32_to_host(struct conversion_
|
||||||
out->flags = in->flags;
|
out->flags = in->flags;
|
||||||
out->pApplicationInfo = convert_VkApplicationInfo_array_win32_to_host(ctx, (const VkApplicationInfo32 *)UlongToPtr(in->pApplicationInfo), 1);
|
out->pApplicationInfo = convert_VkApplicationInfo_array_win32_to_host(ctx, (const VkApplicationInfo32 *)UlongToPtr(in->pApplicationInfo), 1);
|
||||||
out->enabledLayerCount = in->enabledLayerCount;
|
out->enabledLayerCount = in->enabledLayerCount;
|
||||||
out->ppEnabledLayerNames = UlongToPtr(in->ppEnabledLayerNames);
|
out->ppEnabledLayerNames = convert_char_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppEnabledLayerNames), in->enabledLayerCount);
|
||||||
out->enabledExtensionCount = in->enabledExtensionCount;
|
out->enabledExtensionCount = in->enabledExtensionCount;
|
||||||
out->ppEnabledExtensionNames = UlongToPtr(in->ppEnabledExtensionNames);
|
out->ppEnabledExtensionNames = convert_char_pointer_array_win32_to_host(ctx, (const PTR32 *)UlongToPtr(in->ppEnabledExtensionNames), in->enabledExtensionCount);
|
||||||
|
|
||||||
for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext))
|
for (in_header = UlongToPtr(in->pNext); in_header; in_header = UlongToPtr(in_header->pNext))
|
||||||
{
|
{
|
||||||
|
@ -38175,13 +38211,16 @@ static NTSTATUS thunk32_vkGetMicromapBuildSizesEXT(void *args)
|
||||||
} *params = args;
|
} *params = args;
|
||||||
VkMicromapBuildInfoEXT pBuildInfo_host;
|
VkMicromapBuildInfoEXT pBuildInfo_host;
|
||||||
VkMicromapBuildSizesInfoEXT pSizeInfo_host;
|
VkMicromapBuildSizesInfoEXT pSizeInfo_host;
|
||||||
|
struct conversion_context ctx;
|
||||||
|
|
||||||
TRACE("%#x, %#x, %#x, %#x\n", params->device, params->buildType, params->pBuildInfo, params->pSizeInfo);
|
TRACE("%#x, %#x, %#x, %#x\n", params->device, params->buildType, params->pBuildInfo, params->pSizeInfo);
|
||||||
|
|
||||||
convert_VkMicromapBuildInfoEXT_win32_to_host((const VkMicromapBuildInfoEXT32 *)UlongToPtr(params->pBuildInfo), &pBuildInfo_host);
|
init_conversion_context(&ctx);
|
||||||
|
convert_VkMicromapBuildInfoEXT_win32_to_host(&ctx, (const VkMicromapBuildInfoEXT32 *)UlongToPtr(params->pBuildInfo), &pBuildInfo_host);
|
||||||
convert_VkMicromapBuildSizesInfoEXT_win32_to_host((VkMicromapBuildSizesInfoEXT32 *)UlongToPtr(params->pSizeInfo), &pSizeInfo_host);
|
convert_VkMicromapBuildSizesInfoEXT_win32_to_host((VkMicromapBuildSizesInfoEXT32 *)UlongToPtr(params->pSizeInfo), &pSizeInfo_host);
|
||||||
wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetMicromapBuildSizesEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->device, params->buildType, &pBuildInfo_host, &pSizeInfo_host);
|
wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetMicromapBuildSizesEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->device, params->buildType, &pBuildInfo_host, &pSizeInfo_host);
|
||||||
convert_VkMicromapBuildSizesInfoEXT_host_to_win32(&pSizeInfo_host, (VkMicromapBuildSizesInfoEXT32 *)UlongToPtr(params->pSizeInfo));
|
convert_VkMicromapBuildSizesInfoEXT_host_to_win32(&pSizeInfo_host, (VkMicromapBuildSizesInfoEXT32 *)UlongToPtr(params->pSizeInfo));
|
||||||
|
free_conversion_context(&ctx);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue