From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winevulkan/make_vulkan | 4 + dlls/winevulkan/vulkan.c | 41 +++ dlls/winevulkan/vulkan_private.h | 17 ++ dlls/winevulkan/vulkan_thunks.c | 502 ++++++++++++++++++++++++++----- dlls/winevulkan/vulkan_thunks.h | 2 + 5 files changed, 495 insertions(+), 71 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index e4a734c284b..e901a986609 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -225,6 +225,7 @@ MANUAL_UNIX_THUNKS = { "vkCreateDevice", "vkCreateImage", "vkCreateInstance", + "vkCreateSwapchainKHR", "vkCreateWin32SurfaceKHR", "vkDestroyCommandPool", "vkDestroyDebugReportCallbackEXT", @@ -233,6 +234,7 @@ MANUAL_UNIX_THUNKS = { "vkDestroyDevice", "vkDestroyInstance", "vkDestroySurfaceKHR", + "vkDestroySwapchainKHR", "vkEnumerateDeviceExtensionProperties", "vkEnumerateDeviceLayerProperties", "vkEnumerateInstanceExtensionProperties", @@ -1183,6 +1185,8 @@ class VkHandle(object): return "wine_queue_from_handle({0})->host_queue".format(name) if self.name == "VkSurfaceKHR": return "wine_surface_from_handle({0})->host_surface".format(name) + if self.name == "VkSwapchainKHR": + return "wine_swapchain_from_handle({0})->host_swapchain".format(name) if self.is_dispatchable(): LOGGER.error("Unhandled host handle for: {0}".format(self.name)) return None diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 240ba3e8618..25d78f02347 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1493,6 +1493,47 @@ void wine_vkDestroySurfaceKHR(VkInstance handle, VkSurfaceKHR surface, free(object); }
+VkResult wine_vkCreateSwapchainKHR(VkDevice device_handle, const VkSwapchainCreateInfoKHR *create_info, + const VkAllocationCallbacks *allocator, VkSwapchainKHR *swapchain_handle) +{ + struct wine_swapchain *object, *old_swapchain = wine_swapchain_from_handle(create_info->oldSwapchain); + struct wine_surface *surface = wine_surface_from_handle(create_info->surface); + struct wine_device *device = wine_device_from_handle(device_handle); + VkSwapchainCreateInfoKHR create_info_host = *create_info; + VkResult res; + + if (surface) create_info_host.surface = surface->driver_surface; + if (old_swapchain) create_info_host.oldSwapchain = old_swapchain->host_swapchain; + + if (!(object = calloc(1, sizeof(*object)))) return VK_ERROR_OUT_OF_HOST_MEMORY; + res = device->funcs.p_vkCreateSwapchainKHR(device->host_device, &create_info_host, NULL, &object->host_swapchain); + if (res != VK_SUCCESS) + { + free(object); + return res; + } + + WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, object, object->host_swapchain, object); + *swapchain_handle = wine_swapchain_to_handle(object); + + return res; +} + +void wine_vkDestroySwapchainKHR(VkDevice device_handle, VkSwapchainKHR swapchain_handle, + const VkAllocationCallbacks *allocator) +{ + struct wine_device *device = wine_device_from_handle(device_handle); + struct wine_swapchain *swapchain = wine_swapchain_from_handle(swapchain_handle); + + if (allocator) FIXME("Support for allocation callbacks not implemented yet\n"); + if (!swapchain) return; + + device->funcs.p_vkDestroySwapchainKHR(device->host_device, swapchain->host_swapchain, NULL); + WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, swapchain); + + free(swapchain); +} + VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *alloc_info, const VkAllocationCallbacks *allocator, VkDeviceMemory *ret) { diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 6b01e99262e..4e4d665299f 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -238,6 +238,23 @@ static inline VkSurfaceKHR wine_surface_to_handle(struct wine_surface *surface) return (VkSurfaceKHR)(uintptr_t)surface; }
+struct wine_swapchain +{ + VkSwapchainKHR host_swapchain; + + struct wine_vk_mapping mapping; +}; + +static inline struct wine_swapchain *wine_swapchain_from_handle(VkSwapchainKHR handle) +{ + return (struct wine_swapchain *)(uintptr_t)handle; +} + +static inline VkSwapchainKHR wine_swapchain_to_handle(struct wine_swapchain *surface) +{ + return (VkSwapchainKHR)(uintptr_t)surface; +} + BOOL wine_vk_device_extension_supported(const char *name); BOOL wine_vk_instance_extension_supported(const char *name);
diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 9cb270c9dea..0d417aab8a3 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -6848,18 +6848,35 @@ static uint64_t wine_vk_unwrap_handle(uint32_t type, uint64_t handle) return (uint64_t) (uintptr_t) wine_queue_from_handle(((VkQueue) (uintptr_t) handle))->host_queue; case VK_OBJECT_TYPE_SURFACE_KHR: return (uint64_t) wine_surface_from_handle(handle)->host_surface; + case VK_OBJECT_TYPE_SWAPCHAIN_KHR: + return (uint64_t) wine_swapchain_from_handle(handle)->host_swapchain; default: return handle; } }
+#ifdef _WIN64 +static inline void convert_VkAcquireNextImageInfoKHR_win64_to_host(const VkAcquireNextImageInfoKHR *in, VkAcquireNextImageInfoKHR *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->swapchain = wine_swapchain_from_handle(in->swapchain)->host_swapchain; + out->timeout = in->timeout; + out->semaphore = in->semaphore; + out->fence = in->fence; + out->deviceMask = in->deviceMask; +} +#endif /* _WIN64 */ + static inline void convert_VkAcquireNextImageInfoKHR_win32_to_host(const VkAcquireNextImageInfoKHR32 *in, VkAcquireNextImageInfoKHR *out) { if (!in) return;
out->sType = in->sType; out->pNext = NULL; - out->swapchain = in->swapchain; + out->swapchain = wine_swapchain_from_handle(in->swapchain)->host_swapchain; out->timeout = in->timeout; out->semaphore = in->semaphore; out->fence = in->fence; @@ -7389,15 +7406,65 @@ static inline const VkBindBufferMemoryInfo *convert_VkBindBufferMemoryInfo_array }
#ifdef _WIN64 -static inline void convert_VkBindImageMemoryInfo_win64_to_host(const VkBindImageMemoryInfo *in, VkBindImageMemoryInfo *out) +static inline void convert_VkBindImageMemoryInfo_win64_to_host(struct conversion_context *ctx, const VkBindImageMemoryInfo *in, VkBindImageMemoryInfo *out) { + const VkBaseInStructure *in_header; + VkBaseOutStructure *out_header = (void *)out; + if (!in) return;
out->sType = in->sType; - out->pNext = in->pNext; + out->pNext = NULL; out->image = in->image; out->memory = wine_device_memory_from_handle(in->memory)->host_memory; out->memoryOffset = in->memoryOffset; + + for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) + { + switch (in_header->sType) + { + case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO: + { + VkBindImageMemoryDeviceGroupInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkBindImageMemoryDeviceGroupInfo *in_ext = (const VkBindImageMemoryDeviceGroupInfo *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO; + out_ext->pNext = NULL; + out_ext->deviceIndexCount = in_ext->deviceIndexCount; + out_ext->pDeviceIndices = in_ext->pDeviceIndices; + out_ext->splitInstanceBindRegionCount = in_ext->splitInstanceBindRegionCount; + out_ext->pSplitInstanceBindRegions = in_ext->pSplitInstanceBindRegions; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR: + { + VkBindImageMemorySwapchainInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkBindImageMemorySwapchainInfoKHR *in_ext = (const VkBindImageMemorySwapchainInfoKHR *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR; + out_ext->pNext = NULL; + out_ext->swapchain = wine_swapchain_from_handle(in_ext->swapchain)->host_swapchain; + out_ext->imageIndex = in_ext->imageIndex; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO: + { + VkBindImagePlaneMemoryInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkBindImagePlaneMemoryInfo *in_ext = (const VkBindImagePlaneMemoryInfo *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO; + out_ext->pNext = NULL; + out_ext->planeAspect = in_ext->planeAspect; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + default: + FIXME("Unhandled sType %u.\n", in_header->sType); + break; + } + } } #endif /* _WIN64 */
@@ -7438,7 +7505,7 @@ static inline void convert_VkBindImageMemoryInfo_win32_to_host(struct conversion const VkBindImageMemorySwapchainInfoKHR32 *in_ext = (const VkBindImageMemorySwapchainInfoKHR32 *)in_header; out_ext->sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR; out_ext->pNext = NULL; - out_ext->swapchain = in_ext->swapchain; + out_ext->swapchain = wine_swapchain_from_handle(in_ext->swapchain)->host_swapchain; out_ext->imageIndex = in_ext->imageIndex; out_header->pNext = (void *)out_ext; out_header = (void *)out_ext; @@ -7473,7 +7540,7 @@ static inline const VkBindImageMemoryInfo *convert_VkBindImageMemoryInfo_array_w out = conversion_context_alloc(ctx, count * sizeof(*out)); for (i = 0; i < count; i++) { - convert_VkBindImageMemoryInfo_win64_to_host(&in[i], &out[i]); + convert_VkBindImageMemoryInfo_win64_to_host(ctx, &in[i], &out[i]); }
return out; @@ -16341,6 +16408,133 @@ static inline void convert_VkGraphicsPipelineCreateInfo_array_host_to_win32(cons } }
+#ifdef _WIN64 +static inline void convert_VkImageCreateInfo_win64_to_host(struct conversion_context *ctx, const VkImageCreateInfo *in, VkImageCreateInfo *out) +{ + const VkBaseInStructure *in_header; + VkBaseOutStructure *out_header = (void *)out; + + if (!in) return; + + out->sType = in->sType; + out->pNext = NULL; + out->flags = in->flags; + out->imageType = in->imageType; + out->format = in->format; + out->extent = in->extent; + out->mipLevels = in->mipLevels; + out->arrayLayers = in->arrayLayers; + out->samples = in->samples; + out->tiling = in->tiling; + out->usage = in->usage; + out->sharingMode = in->sharingMode; + out->queueFamilyIndexCount = in->queueFamilyIndexCount; + out->pQueueFamilyIndices = in->pQueueFamilyIndices; + out->initialLayout = in->initialLayout; + + for (in_header = (void *)in->pNext; in_header; in_header = (void *)in_header->pNext) + { + switch (in_header->sType) + { + case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV: + { + VkDedicatedAllocationImageCreateInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkDedicatedAllocationImageCreateInfoNV *in_ext = (const VkDedicatedAllocationImageCreateInfoNV *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV; + out_ext->pNext = NULL; + out_ext->dedicatedAllocation = in_ext->dedicatedAllocation; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO: + { + VkExternalMemoryImageCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkExternalMemoryImageCreateInfo *in_ext = (const VkExternalMemoryImageCreateInfo *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO; + out_ext->pNext = NULL; + out_ext->handleTypes = in_ext->handleTypes; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR: + { + VkImageSwapchainCreateInfoKHR *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkImageSwapchainCreateInfoKHR *in_ext = (const VkImageSwapchainCreateInfoKHR *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR; + out_ext->pNext = NULL; + out_ext->swapchain = in_ext->swapchain ? wine_swapchain_from_handle(in_ext->swapchain)->host_swapchain : 0; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO: + { + VkImageFormatListCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkImageFormatListCreateInfo *in_ext = (const VkImageFormatListCreateInfo *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO; + out_ext->pNext = NULL; + out_ext->viewFormatCount = in_ext->viewFormatCount; + out_ext->pViewFormats = in_ext->pViewFormats; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO: + { + VkImageStencilUsageCreateInfo *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkImageStencilUsageCreateInfo *in_ext = (const VkImageStencilUsageCreateInfo *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO; + out_ext->pNext = NULL; + out_ext->stencilUsage = in_ext->stencilUsage; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT: + { + VkOpaqueCaptureDescriptorDataCreateInfoEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkOpaqueCaptureDescriptorDataCreateInfoEXT *in_ext = (const VkOpaqueCaptureDescriptorDataCreateInfoEXT *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT; + out_ext->pNext = NULL; + out_ext->opaqueCaptureDescriptorData = in_ext->opaqueCaptureDescriptorData; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT: + { + VkImageCompressionControlEXT *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkImageCompressionControlEXT *in_ext = (const VkImageCompressionControlEXT *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT; + out_ext->pNext = NULL; + out_ext->flags = in_ext->flags; + out_ext->compressionControlPlaneCount = in_ext->compressionControlPlaneCount; + out_ext->pFixedRateFlags = in_ext->pFixedRateFlags; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + case VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV: + { + VkOpticalFlowImageFormatInfoNV *out_ext = conversion_context_alloc(ctx, sizeof(*out_ext)); + const VkOpticalFlowImageFormatInfoNV *in_ext = (const VkOpticalFlowImageFormatInfoNV *)in_header; + out_ext->sType = VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV; + out_ext->pNext = NULL; + out_ext->usage = in_ext->usage; + out_header->pNext = (void *)out_ext; + out_header = (void *)out_ext; + break; + } + default: + FIXME("Unhandled sType %u.\n", in_header->sType); + break; + } + } +} +#endif /* _WIN64 */ + static inline void convert_VkImageCreateInfo_win32_to_host(struct conversion_context *ctx, const VkImageCreateInfo32 *in, VkImageCreateInfo *out) { const VkBaseInStructure32 *in_header; @@ -16396,7 +16590,7 @@ static inline void convert_VkImageCreateInfo_win32_to_host(struct conversion_con const VkImageSwapchainCreateInfoKHR32 *in_ext = (const VkImageSwapchainCreateInfoKHR32 *)in_header; out_ext->sType = VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR; out_ext->pNext = NULL; - out_ext->swapchain = in_ext->swapchain; + out_ext->swapchain = in_ext->swapchain ? wine_swapchain_from_handle(in_ext->swapchain)->host_swapchain : 0; out_header->pNext = (void *)out_ext; out_header = (void *)out_ext; break; @@ -18204,33 +18398,7 @@ static inline const VkShaderCreateInfoEXT *convert_VkShaderCreateInfoEXT_array_w return out; }
-#ifdef _WIN64 -static inline void convert_VkSwapchainCreateInfoKHR_win64_to_driver(const VkSwapchainCreateInfoKHR *in, VkSwapchainCreateInfoKHR *out) -{ - if (!in) return; - - out->sType = in->sType; - out->pNext = in->pNext; - out->flags = in->flags; - out->surface = wine_surface_from_handle(in->surface)->driver_surface; - out->minImageCount = in->minImageCount; - out->imageFormat = in->imageFormat; - out->imageColorSpace = in->imageColorSpace; - out->imageExtent = in->imageExtent; - out->imageArrayLayers = in->imageArrayLayers; - out->imageUsage = in->imageUsage; - out->imageSharingMode = in->imageSharingMode; - out->queueFamilyIndexCount = in->queueFamilyIndexCount; - out->pQueueFamilyIndices = in->pQueueFamilyIndices; - out->preTransform = in->preTransform; - out->compositeAlpha = in->compositeAlpha; - out->presentMode = in->presentMode; - out->clipped = in->clipped; - out->oldSwapchain = in->oldSwapchain; -} -#endif /* _WIN64 */ - -static inline void convert_VkSwapchainCreateInfoKHR_win32_to_driver(struct conversion_context *ctx, const VkSwapchainCreateInfoKHR32 *in, VkSwapchainCreateInfoKHR *out) +static inline void convert_VkSwapchainCreateInfoKHR_win32_to_unwrapped_host(struct conversion_context *ctx, const VkSwapchainCreateInfoKHR32 *in, VkSwapchainCreateInfoKHR *out) { const VkBaseInStructure32 *in_header; VkBaseOutStructure *out_header = (void *)out; @@ -18240,7 +18408,7 @@ static inline void convert_VkSwapchainCreateInfoKHR_win32_to_driver(struct conve out->sType = in->sType; out->pNext = NULL; out->flags = in->flags; - out->surface = wine_surface_from_handle(in->surface)->driver_surface; + out->surface = in->surface; out->minImageCount = in->minImageCount; out->imageFormat = in->imageFormat; out->imageColorSpace = in->imageColorSpace; @@ -19200,6 +19368,24 @@ static inline void convert_VkDeviceGroupPresentCapabilitiesKHR_host_to_win32(con out->modes = in->modes; }
+#ifdef _WIN64 +static inline const VkImageCreateInfo *convert_VkImageCreateInfo_array_win64_to_host(struct conversion_context *ctx, const VkImageCreateInfo *in, uint32_t count) +{ + VkImageCreateInfo *out; + unsigned int i; + + if (!in || !count) return NULL; + + out = conversion_context_alloc(ctx, count * sizeof(*out)); + for (i = 0; i < count; i++) + { + convert_VkImageCreateInfo_win64_to_host(ctx, &in[i], &out[i]); + } + + return out; +} +#endif /* _WIN64 */ + static inline const VkImageCreateInfo *convert_VkImageCreateInfo_array_win32_to_host(struct conversion_context *ctx, const VkImageCreateInfo32 *in, uint32_t count) { VkImageCreateInfo *out; @@ -19216,6 +19402,18 @@ static inline const VkImageCreateInfo *convert_VkImageCreateInfo_array_win32_to_ return out; }
+#ifdef _WIN64 +static inline void convert_VkDeviceImageMemoryRequirements_win64_to_host(struct conversion_context *ctx, const VkDeviceImageMemoryRequirements *in, VkDeviceImageMemoryRequirements *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->pCreateInfo = convert_VkImageCreateInfo_array_win64_to_host(ctx, in->pCreateInfo, 1); + out->planeAspect = in->planeAspect; +} +#endif /* _WIN64 */ + static inline void convert_VkDeviceImageMemoryRequirements_win32_to_host(struct conversion_context *ctx, const VkDeviceImageMemoryRequirements32 *in, VkDeviceImageMemoryRequirements *out) { if (!in) return; @@ -19311,6 +19509,18 @@ static inline const VkImageSubresource2KHR *convert_VkImageSubresource2KHR_array return out; }
+#ifdef _WIN64 +static inline void convert_VkDeviceImageSubresourceInfoKHR_win64_to_host(struct conversion_context *ctx, const VkDeviceImageSubresourceInfoKHR *in, VkDeviceImageSubresourceInfoKHR *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->pCreateInfo = convert_VkImageCreateInfo_array_win64_to_host(ctx, in->pCreateInfo, 1); + out->pSubresource = in->pSubresource; +} +#endif /* _WIN64 */ + static inline void convert_VkDeviceImageSubresourceInfoKHR_win32_to_host(struct conversion_context *ctx, const VkDeviceImageSubresourceInfoKHR32 *in, VkDeviceImageSubresourceInfoKHR *out) { if (!in) return; @@ -27842,7 +28052,57 @@ static inline const VkPresentRegionKHR *convert_VkPresentRegionKHR_array_win32_t return out; }
-static inline void convert_VkPresentInfoKHR_win32_to_host(struct conversion_context *ctx, const VkPresentInfoKHR32 *in, VkPresentInfoKHR *out) +#ifdef _WIN64 +static inline const VkSwapchainKHR *convert_VkSwapchainKHR_array_win64_to_driver(struct conversion_context *ctx, const VkSwapchainKHR *in, uint32_t count) +{ + VkSwapchainKHR *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] = wine_swapchain_from_handle(in[i])->host_swapchain; + } + + return out; +} +#endif /* _WIN64 */ + +static inline const VkSwapchainKHR *convert_VkSwapchainKHR_array_win32_to_driver(struct conversion_context *ctx, const VkSwapchainKHR *in, uint32_t count) +{ + VkSwapchainKHR *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] = wine_swapchain_from_handle(in[i])->host_swapchain; + } + + return out; +} + +#ifdef _WIN64 +static inline void convert_VkPresentInfoKHR_win64_to_driver(struct conversion_context *ctx, const VkPresentInfoKHR *in, VkPresentInfoKHR *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->waitSemaphoreCount = in->waitSemaphoreCount; + out->pWaitSemaphores = in->pWaitSemaphores; + out->swapchainCount = in->swapchainCount; + out->pSwapchains = convert_VkSwapchainKHR_array_win64_to_driver(ctx, in->pSwapchains, in->swapchainCount); + out->pImageIndices = in->pImageIndices; + out->pResults = in->pResults; +} +#endif /* _WIN64 */ + +static inline void convert_VkPresentInfoKHR_win32_to_driver(struct conversion_context *ctx, const VkPresentInfoKHR32 *in, VkPresentInfoKHR *out) { const VkBaseInStructure32 *in_header; VkBaseOutStructure *out_header = (void *)out; @@ -27854,7 +28114,7 @@ static inline void convert_VkPresentInfoKHR_win32_to_host(struct conversion_cont out->waitSemaphoreCount = in->waitSemaphoreCount; out->pWaitSemaphores = (const VkSemaphore *)UlongToPtr(in->pWaitSemaphores); out->swapchainCount = in->swapchainCount; - out->pSwapchains = (const VkSwapchainKHR *)UlongToPtr(in->pSwapchains); + out->pSwapchains = convert_VkSwapchainKHR_array_win32_to_driver(ctx, (const VkSwapchainKHR *)UlongToPtr(in->pSwapchains), in->swapchainCount); out->pImageIndices = (const uint32_t *)UlongToPtr(in->pImageIndices); out->pResults = (VkResult *)UlongToPtr(in->pResults);
@@ -28318,13 +28578,26 @@ static inline const VkSubmitInfo2 *convert_VkSubmitInfo2_array_win32_to_host(str return out; }
+#ifdef _WIN64 +static inline void convert_VkReleaseSwapchainImagesInfoEXT_win64_to_host(const VkReleaseSwapchainImagesInfoEXT *in, VkReleaseSwapchainImagesInfoEXT *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->swapchain = wine_swapchain_from_handle(in->swapchain)->host_swapchain; + out->imageIndexCount = in->imageIndexCount; + out->pImageIndices = in->pImageIndices; +} +#endif /* _WIN64 */ + static inline void convert_VkReleaseSwapchainImagesInfoEXT_win32_to_host(const VkReleaseSwapchainImagesInfoEXT32 *in, VkReleaseSwapchainImagesInfoEXT *out) { if (!in) return;
out->sType = in->sType; out->pNext = NULL; - out->swapchain = in->swapchain; + out->swapchain = wine_swapchain_from_handle(in->swapchain)->host_swapchain; out->imageIndexCount = in->imageIndexCount; out->pImageIndices = (const uint32_t *)UlongToPtr(in->pImageIndices); if (in->pNext) @@ -28387,6 +28660,40 @@ static inline void convert_VkDebugUtilsObjectTagInfoEXT_win32_to_host(const VkDe FIXME("Unexpected pNext\n"); }
+#ifdef _WIN64 +static inline const VkSwapchainKHR *convert_VkSwapchainKHR_array_win64_to_host(struct conversion_context *ctx, const VkSwapchainKHR *in, uint32_t count) +{ + VkSwapchainKHR *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] = wine_swapchain_from_handle(in[i])->host_swapchain; + } + + return out; +} +#endif /* _WIN64 */ + +static inline const VkSwapchainKHR *convert_VkSwapchainKHR_array_win32_to_host(struct conversion_context *ctx, const VkSwapchainKHR *in, uint32_t count) +{ + VkSwapchainKHR *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] = wine_swapchain_from_handle(in[i])->host_swapchain; + } + + return out; +} + static inline void convert_VkHdrMetadataEXT_win32_to_host(const VkHdrMetadataEXT32 *in, VkHdrMetadataEXT *out) { if (!in) return; @@ -28666,10 +28973,12 @@ static inline void convert_VkSemaphoreWaitInfo_win32_to_host(const VkSemaphoreWa static NTSTATUS thunk64_vkAcquireNextImage2KHR(void *args) { struct vkAcquireNextImage2KHR_params *params = args; + VkAcquireNextImageInfoKHR pAcquireInfo_host;
TRACE("%p, %p, %p\n", params->device, params->pAcquireInfo, params->pImageIndex);
- params->result = wine_device_from_handle(params->device)->funcs.p_vkAcquireNextImage2KHR(wine_device_from_handle(params->device)->host_device, params->pAcquireInfo, params->pImageIndex); + convert_VkAcquireNextImageInfoKHR_win64_to_host(params->pAcquireInfo, &pAcquireInfo_host); + params->result = wine_device_from_handle(params->device)->funcs.p_vkAcquireNextImage2KHR(wine_device_from_handle(params->device)->host_device, &pAcquireInfo_host, params->pImageIndex); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -28699,7 +29008,7 @@ static NTSTATUS thunk64_vkAcquireNextImageKHR(void *args)
TRACE("%p, 0x%s, 0x%s, 0x%s, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), wine_dbgstr_longlong(params->timeout), wine_dbgstr_longlong(params->semaphore), wine_dbgstr_longlong(params->fence), params->pImageIndex);
- params->result = wine_device_from_handle(params->device)->funcs.p_vkAcquireNextImageKHR(wine_device_from_handle(params->device)->host_device, params->swapchain, params->timeout, params->semaphore, params->fence, params->pImageIndex); + params->result = wine_device_from_handle(params->device)->funcs.p_vkAcquireNextImageKHR(wine_device_from_handle(params->device)->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, params->timeout, params->semaphore, params->fence, params->pImageIndex); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -28719,7 +29028,7 @@ static NTSTATUS thunk32_vkAcquireNextImageKHR(void *args)
TRACE("%#x, 0x%s, 0x%s, 0x%s, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), wine_dbgstr_longlong(params->timeout), wine_dbgstr_longlong(params->semaphore), wine_dbgstr_longlong(params->fence), params->pImageIndex);
- params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkAcquireNextImageKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, params->timeout, params->semaphore, params->fence, (uint32_t *)UlongToPtr(params->pImageIndex)); + params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkAcquireNextImageKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, params->timeout, params->semaphore, params->fence, (uint32_t *)UlongToPtr(params->pImageIndex)); return STATUS_SUCCESS; }
@@ -35798,10 +36107,16 @@ static NTSTATUS thunk32_vkCreateGraphicsPipelines(void *args) static NTSTATUS thunk64_vkCreateImage(void *args) { struct vkCreateImage_params *params = args; + VkImageCreateInfo pCreateInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pImage);
- params->result = wine_vkCreateImage(params->device, params->pCreateInfo, params->pAllocator, params->pImage); + init_conversion_context(ctx); + convert_VkImageCreateInfo_win64_to_host(ctx, params->pCreateInfo, &pCreateInfo_host); + params->result = wine_vkCreateImage(params->device, &pCreateInfo_host, params->pAllocator, params->pImage); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -36585,12 +36900,10 @@ static NTSTATUS thunk32_vkCreateShadersEXT(void *args) static NTSTATUS thunk64_vkCreateSwapchainKHR(void *args) { struct vkCreateSwapchainKHR_params *params = args; - VkSwapchainCreateInfoKHR pCreateInfo_host;
TRACE("%p, %p, %p, %p\n", params->device, params->pCreateInfo, params->pAllocator, params->pSwapchain);
- convert_VkSwapchainCreateInfoKHR_win64_to_driver(params->pCreateInfo, &pCreateInfo_host); - params->result = wine_device_from_handle(params->device)->funcs.p_vkCreateSwapchainKHR(wine_device_from_handle(params->device)->host_device, &pCreateInfo_host, NULL, params->pSwapchain); + params->result = wine_vkCreateSwapchainKHR(params->device, params->pCreateInfo, params->pAllocator, params->pSwapchain); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -36612,8 +36925,8 @@ static NTSTATUS thunk32_vkCreateSwapchainKHR(void *args) TRACE("%#x, %#x, %#x, %#x\n", params->device, params->pCreateInfo, params->pAllocator, params->pSwapchain);
init_conversion_context(ctx); - convert_VkSwapchainCreateInfoKHR_win32_to_driver(ctx, (const VkSwapchainCreateInfoKHR32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkCreateSwapchainKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, &pCreateInfo_host, NULL, (VkSwapchainKHR *)UlongToPtr(params->pSwapchain)); + convert_VkSwapchainCreateInfoKHR_win32_to_unwrapped_host(ctx, (const VkSwapchainCreateInfoKHR32 *)UlongToPtr(params->pCreateInfo), &pCreateInfo_host); + params->result = wine_vkCreateSwapchainKHR((VkDevice)UlongToPtr(params->device), &pCreateInfo_host, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator), (VkSwapchainKHR *)UlongToPtr(params->pSwapchain)); free_conversion_context(ctx); return STATUS_SUCCESS; } @@ -37898,7 +38211,7 @@ static NTSTATUS thunk64_vkDestroySwapchainKHR(void *args)
TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pAllocator);
- wine_device_from_handle(params->device)->funcs.p_vkDestroySwapchainKHR(wine_device_from_handle(params->device)->host_device, params->swapchain, NULL); + wine_vkDestroySwapchainKHR(params->device, params->swapchain, params->pAllocator); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -37914,7 +38227,7 @@ static NTSTATUS thunk32_vkDestroySwapchainKHR(void *args)
TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pAllocator);
- wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkDestroySwapchainKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, NULL); + wine_vkDestroySwapchainKHR((VkDevice)UlongToPtr(params->device), params->swapchain, (const VkAllocationCallbacks *)UlongToPtr(params->pAllocator)); return STATUS_SUCCESS; }
@@ -39416,10 +39729,16 @@ static NTSTATUS thunk32_vkGetDeviceGroupSurfacePresentModesKHR(void *args) static NTSTATUS thunk64_vkGetDeviceImageMemoryRequirements(void *args) { struct vkGetDeviceImageMemoryRequirements_params *params = args; + VkDeviceImageMemoryRequirements pInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements);
- wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageMemoryRequirements(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); + init_conversion_context(ctx); + convert_VkDeviceImageMemoryRequirements_win64_to_host(ctx, params->pInfo, &pInfo_host); + wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageMemoryRequirements(wine_device_from_handle(params->device)->host_device, &pInfo_host, params->pMemoryRequirements); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -39452,10 +39771,16 @@ static NTSTATUS thunk32_vkGetDeviceImageMemoryRequirements(void *args) static NTSTATUS thunk64_vkGetDeviceImageMemoryRequirementsKHR(void *args) { struct vkGetDeviceImageMemoryRequirementsKHR_params *params = args; + VkDeviceImageMemoryRequirements pInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pMemoryRequirements);
- wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageMemoryRequirementsKHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pMemoryRequirements); + init_conversion_context(ctx); + convert_VkDeviceImageMemoryRequirements_win64_to_host(ctx, params->pInfo, &pInfo_host); + wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageMemoryRequirementsKHR(wine_device_from_handle(params->device)->host_device, &pInfo_host, params->pMemoryRequirements); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -39488,10 +39813,16 @@ static NTSTATUS thunk32_vkGetDeviceImageMemoryRequirementsKHR(void *args) static NTSTATUS thunk64_vkGetDeviceImageSparseMemoryRequirements(void *args) { struct vkGetDeviceImageSparseMemoryRequirements_params *params = args; + VkDeviceImageMemoryRequirements pInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p, %p\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements);
- wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageSparseMemoryRequirements(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); + init_conversion_context(ctx); + convert_VkDeviceImageMemoryRequirements_win64_to_host(ctx, params->pInfo, &pInfo_host); + wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageSparseMemoryRequirements(wine_device_from_handle(params->device)->host_device, &pInfo_host, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -39525,10 +39856,16 @@ static NTSTATUS thunk32_vkGetDeviceImageSparseMemoryRequirements(void *args) static NTSTATUS thunk64_vkGetDeviceImageSparseMemoryRequirementsKHR(void *args) { struct vkGetDeviceImageSparseMemoryRequirementsKHR_params *params = args; + VkDeviceImageMemoryRequirements pInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p, %p\n", params->device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements);
- wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageSparseMemoryRequirementsKHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); + init_conversion_context(ctx); + convert_VkDeviceImageMemoryRequirements_win64_to_host(ctx, params->pInfo, &pInfo_host); + wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageSparseMemoryRequirementsKHR(wine_device_from_handle(params->device)->host_device, &pInfo_host, params->pSparseMemoryRequirementCount, params->pSparseMemoryRequirements); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -39562,10 +39899,16 @@ static NTSTATUS thunk32_vkGetDeviceImageSparseMemoryRequirementsKHR(void *args) static NTSTATUS thunk64_vkGetDeviceImageSubresourceLayoutKHR(void *args) { struct vkGetDeviceImageSubresourceLayoutKHR_params *params = args; + VkDeviceImageSubresourceInfoKHR pInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p, %p\n", params->device, params->pInfo, params->pLayout);
- wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageSubresourceLayoutKHR(wine_device_from_handle(params->device)->host_device, params->pInfo, params->pLayout); + init_conversion_context(ctx); + convert_VkDeviceImageSubresourceInfoKHR_win64_to_host(ctx, params->pInfo, &pInfo_host); + wine_device_from_handle(params->device)->funcs.p_vkGetDeviceImageSubresourceLayoutKHR(wine_device_from_handle(params->device)->host_device, &pInfo_host, params->pLayout); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -40408,7 +40751,7 @@ static NTSTATUS thunk64_vkGetLatencyTimingsNV(void *args)
TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pLatencyMarkerInfo);
- wine_device_from_handle(params->device)->funcs.p_vkGetLatencyTimingsNV(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pLatencyMarkerInfo); + wine_device_from_handle(params->device)->funcs.p_vkGetLatencyTimingsNV(wine_device_from_handle(params->device)->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, params->pLatencyMarkerInfo); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -40429,7 +40772,7 @@ static NTSTATUS thunk32_vkGetLatencyTimingsNV(void *args)
init_conversion_context(ctx); convert_VkGetLatencyMarkerInfoNV_win32_to_host(ctx, (VkGetLatencyMarkerInfoNV32 *)UlongToPtr(params->pLatencyMarkerInfo), &pLatencyMarkerInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetLatencyTimingsNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, &pLatencyMarkerInfo_host); + wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetLatencyTimingsNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, &pLatencyMarkerInfo_host); convert_VkGetLatencyMarkerInfoNV_host_to_win32(&pLatencyMarkerInfo_host, (VkGetLatencyMarkerInfoNV32 *)UlongToPtr(params->pLatencyMarkerInfo)); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -42819,7 +43162,7 @@ static NTSTATUS thunk64_vkGetSwapchainImagesKHR(void *args)
TRACE("%p, 0x%s, %p, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSwapchainImageCount, params->pSwapchainImages);
- params->result = wine_device_from_handle(params->device)->funcs.p_vkGetSwapchainImagesKHR(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pSwapchainImageCount, params->pSwapchainImages); + params->result = wine_device_from_handle(params->device)->funcs.p_vkGetSwapchainImagesKHR(wine_device_from_handle(params->device)->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, params->pSwapchainImageCount, params->pSwapchainImages); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -42837,7 +43180,7 @@ static NTSTATUS thunk32_vkGetSwapchainImagesKHR(void *args)
TRACE("%#x, 0x%s, %#x, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSwapchainImageCount, params->pSwapchainImages);
- params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetSwapchainImagesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, (uint32_t *)UlongToPtr(params->pSwapchainImageCount), (VkImage *)UlongToPtr(params->pSwapchainImages)); + params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkGetSwapchainImagesKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, (uint32_t *)UlongToPtr(params->pSwapchainImageCount), (VkImage *)UlongToPtr(params->pSwapchainImages)); return STATUS_SUCCESS; }
@@ -42949,7 +43292,7 @@ static NTSTATUS thunk64_vkLatencySleepNV(void *args)
TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSleepInfo);
- params->result = wine_device_from_handle(params->device)->funcs.p_vkLatencySleepNV(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pSleepInfo); + params->result = wine_device_from_handle(params->device)->funcs.p_vkLatencySleepNV(wine_device_from_handle(params->device)->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, params->pSleepInfo); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -42968,7 +43311,7 @@ static NTSTATUS thunk32_vkLatencySleepNV(void *args) TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSleepInfo);
convert_VkLatencySleepInfoNV_win32_to_host((const VkLatencySleepInfoNV32 *)UlongToPtr(params->pSleepInfo), &pSleepInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkLatencySleepNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, &pSleepInfo_host); + params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkLatencySleepNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, &pSleepInfo_host); return STATUS_SUCCESS; }
@@ -43245,10 +43588,16 @@ static NTSTATUS thunk32_vkQueueNotifyOutOfBandNV(void *args) static NTSTATUS thunk64_vkQueuePresentKHR(void *args) { struct vkQueuePresentKHR_params *params = args; + VkPresentInfoKHR pPresentInfo_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %p\n", params->queue, params->pPresentInfo);
- params->result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueuePresentKHR(wine_queue_from_handle(params->queue)->host_queue, params->pPresentInfo); + init_conversion_context(ctx); + convert_VkPresentInfoKHR_win64_to_driver(ctx, params->pPresentInfo, &pPresentInfo_host); + params->result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueuePresentKHR(wine_queue_from_handle(params->queue)->host_queue, &pPresentInfo_host); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -43268,7 +43617,7 @@ static NTSTATUS thunk32_vkQueuePresentKHR(void *args) TRACE("%#x, %#x\n", params->queue, params->pPresentInfo);
init_conversion_context(ctx); - convert_VkPresentInfoKHR_win32_to_host(ctx, (const VkPresentInfoKHR32 *)UlongToPtr(params->pPresentInfo), &pPresentInfo_host); + convert_VkPresentInfoKHR_win32_to_driver(ctx, (const VkPresentInfoKHR32 *)UlongToPtr(params->pPresentInfo), &pPresentInfo_host); params->result = wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->device->funcs.p_vkQueuePresentKHR(wine_queue_from_handle((VkQueue)UlongToPtr(params->queue))->host_queue, &pPresentInfo_host); free_conversion_context(ctx); return STATUS_SUCCESS; @@ -43506,10 +43855,12 @@ static NTSTATUS thunk32_vkReleaseProfilingLockKHR(void *args) static NTSTATUS thunk64_vkReleaseSwapchainImagesEXT(void *args) { struct vkReleaseSwapchainImagesEXT_params *params = args; + VkReleaseSwapchainImagesInfoEXT pReleaseInfo_host;
TRACE("%p, %p\n", params->device, params->pReleaseInfo);
- params->result = wine_device_from_handle(params->device)->funcs.p_vkReleaseSwapchainImagesEXT(wine_device_from_handle(params->device)->host_device, params->pReleaseInfo); + convert_VkReleaseSwapchainImagesInfoEXT_win64_to_host(params->pReleaseInfo, &pReleaseInfo_host); + params->result = wine_device_from_handle(params->device)->funcs.p_vkReleaseSwapchainImagesEXT(wine_device_from_handle(params->device)->host_device, &pReleaseInfo_host); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -43845,10 +44196,16 @@ static NTSTATUS thunk32_vkSetEvent(void *args) static NTSTATUS thunk64_vkSetHdrMetadataEXT(void *args) { struct vkSetHdrMetadataEXT_params *params = args; + const VkSwapchainKHR *pSwapchains_host; + struct conversion_context local_ctx; + struct conversion_context *ctx = &local_ctx;
TRACE("%p, %u, %p, %p\n", params->device, params->swapchainCount, params->pSwapchains, params->pMetadata);
- wine_device_from_handle(params->device)->funcs.p_vkSetHdrMetadataEXT(wine_device_from_handle(params->device)->host_device, params->swapchainCount, params->pSwapchains, params->pMetadata); + init_conversion_context(ctx); + pSwapchains_host = convert_VkSwapchainKHR_array_win64_to_host(ctx, params->pSwapchains, params->swapchainCount); + wine_device_from_handle(params->device)->funcs.p_vkSetHdrMetadataEXT(wine_device_from_handle(params->device)->host_device, params->swapchainCount, pSwapchains_host, params->pMetadata); + free_conversion_context(ctx); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -43862,6 +44219,7 @@ static NTSTATUS thunk32_vkSetHdrMetadataEXT(void *args) PTR32 pSwapchains; PTR32 pMetadata; } *params = args; + const VkSwapchainKHR *pSwapchains_host; const VkHdrMetadataEXT *pMetadata_host; struct conversion_context local_ctx; struct conversion_context *ctx = &local_ctx; @@ -43869,8 +44227,9 @@ static NTSTATUS thunk32_vkSetHdrMetadataEXT(void *args) TRACE("%#x, %u, %#x, %#x\n", params->device, params->swapchainCount, params->pSwapchains, params->pMetadata);
init_conversion_context(ctx); + pSwapchains_host = convert_VkSwapchainKHR_array_win32_to_host(ctx, (const VkSwapchainKHR *)UlongToPtr(params->pSwapchains), params->swapchainCount); pMetadata_host = convert_VkHdrMetadataEXT_array_win32_to_host(ctx, (const VkHdrMetadataEXT32 *)UlongToPtr(params->pMetadata), params->swapchainCount); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetHdrMetadataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchainCount, (const VkSwapchainKHR *)UlongToPtr(params->pSwapchains), pMetadata_host); + wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetHdrMetadataEXT(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchainCount, pSwapchains_host, pMetadata_host); free_conversion_context(ctx); return STATUS_SUCCESS; } @@ -43882,7 +44241,7 @@ static NTSTATUS thunk64_vkSetLatencyMarkerNV(void *args)
TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pLatencyMarkerInfo);
- wine_device_from_handle(params->device)->funcs.p_vkSetLatencyMarkerNV(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pLatencyMarkerInfo); + wine_device_from_handle(params->device)->funcs.p_vkSetLatencyMarkerNV(wine_device_from_handle(params->device)->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, params->pLatencyMarkerInfo); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -43900,7 +44259,7 @@ static NTSTATUS thunk32_vkSetLatencyMarkerNV(void *args) TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pLatencyMarkerInfo);
convert_VkSetLatencyMarkerInfoNV_win32_to_host((const VkSetLatencyMarkerInfoNV32 *)UlongToPtr(params->pLatencyMarkerInfo), &pLatencyMarkerInfo_host); - wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetLatencyMarkerNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, &pLatencyMarkerInfo_host); + wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetLatencyMarkerNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, &pLatencyMarkerInfo_host); return STATUS_SUCCESS; }
@@ -43911,7 +44270,7 @@ static NTSTATUS thunk64_vkSetLatencySleepModeNV(void *args)
TRACE("%p, 0x%s, %p\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSleepModeInfo);
- params->result = wine_device_from_handle(params->device)->funcs.p_vkSetLatencySleepModeNV(wine_device_from_handle(params->device)->host_device, params->swapchain, params->pSleepModeInfo); + params->result = wine_device_from_handle(params->device)->funcs.p_vkSetLatencySleepModeNV(wine_device_from_handle(params->device)->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, params->pSleepModeInfo); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -43930,7 +44289,7 @@ static NTSTATUS thunk32_vkSetLatencySleepModeNV(void *args) TRACE("%#x, 0x%s, %#x\n", params->device, wine_dbgstr_longlong(params->swapchain), params->pSleepModeInfo);
convert_VkLatencySleepModeInfoNV_win32_to_host((const VkLatencySleepModeInfoNV32 *)UlongToPtr(params->pSleepModeInfo), &pSleepModeInfo_host); - params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetLatencySleepModeNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, &pSleepModeInfo_host); + params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkSetLatencySleepModeNV(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, &pSleepModeInfo_host); return STATUS_SUCCESS; }
@@ -44378,7 +44737,7 @@ static NTSTATUS thunk64_vkWaitForPresentKHR(void *args)
TRACE("%p, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->swapchain), wine_dbgstr_longlong(params->presentId), wine_dbgstr_longlong(params->timeout));
- params->result = wine_device_from_handle(params->device)->funcs.p_vkWaitForPresentKHR(wine_device_from_handle(params->device)->host_device, params->swapchain, params->presentId, params->timeout); + params->result = wine_device_from_handle(params->device)->funcs.p_vkWaitForPresentKHR(wine_device_from_handle(params->device)->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, params->presentId, params->timeout); return STATUS_SUCCESS; } #endif /* _WIN64 */ @@ -44396,7 +44755,7 @@ static NTSTATUS thunk32_vkWaitForPresentKHR(void *args)
TRACE("%#x, 0x%s, 0x%s, 0x%s\n", params->device, wine_dbgstr_longlong(params->swapchain), wine_dbgstr_longlong(params->presentId), wine_dbgstr_longlong(params->timeout));
- params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkWaitForPresentKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, params->swapchain, params->presentId, params->timeout); + params->result = wine_device_from_handle((VkDevice)UlongToPtr(params->device))->funcs.p_vkWaitForPresentKHR(wine_device_from_handle((VkDevice)UlongToPtr(params->device))->host_device, wine_swapchain_from_handle(params->swapchain)->host_swapchain, params->presentId, params->timeout); return STATUS_SUCCESS; }
@@ -44852,7 +45211,8 @@ BOOL wine_vk_is_type_wrapped(VkObjectType type) type == VK_OBJECT_TYPE_INSTANCE || type == VK_OBJECT_TYPE_PHYSICAL_DEVICE || type == VK_OBJECT_TYPE_QUEUE || - type == VK_OBJECT_TYPE_SURFACE_KHR; + type == VK_OBJECT_TYPE_SURFACE_KHR || + type == VK_OBJECT_TYPE_SWAPCHAIN_KHR; }
#ifdef _WIN64 diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 8b0d43fadf5..6b965893ebf 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -25,6 +25,7 @@ VkResult wine_vkCreateDeferredOperationKHR(VkDevice device, const VkAllocationCa VkResult wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, void *client_ptr); VkResult wine_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage); VkResult wine_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance, void *client_ptr); +VkResult wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain); VkResult wine_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); void wine_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator); void wine_vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator); @@ -33,6 +34,7 @@ void wine_vkDestroyDeferredOperationKHR(VkDevice device, VkDeferredOperationKHR void wine_vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator); void wine_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator); void wine_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator); +void wine_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator); VkResult wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties); VkResult wine_vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties); VkResult wine_vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties);