diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index aa0f14f5ac8..26a4f986c49 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -1697,6 +1697,8 @@ class VkParam(VkVariable): if unwrap and self.handle.is_wrapped(): return True + if conv and self.handle.is_dispatchable(): + return True return False @@ -2373,12 +2375,11 @@ class ArrayConversionFunction(object): body += " }\n" body += " else\n" body += " out[i] = NULL;\n" - elif self.array.is_handle() and self.direction == Direction.INPUT: + elif self.array.is_handle() and self.direction == Direction.INPUT and self.unwrap: if self.array.pointer_array: LOGGER.error("Unhandled handle pointer arrays") body += " out[i] = " + self.array.handle.driver_handle("in[i]") + ";\n" else: - LOGGER.warning("Unhandled conversion operand type") body += " out[i] = in[i];\n" body += " }\n" diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index bc14e4e26de..25cfc4bed82 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -5873,6 +5873,24 @@ static inline void convert_VkCommandBufferAllocateInfo_win32_to_unwrapped_host(c } #endif /* USE_STRUCT_CONVERSION */ +#if defined(USE_STRUCT_CONVERSION) +static inline VkCommandBuffer *convert_VkCommandBuffer_array_win32_to_unwrapped_host(struct conversion_context *ctx, const VkCommandBuffer *in, uint32_t count) +{ + VkCommandBuffer *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] = in[i]; + } + + return out; +} +#endif /* USE_STRUCT_CONVERSION */ + #if defined(USE_STRUCT_CONVERSION) static inline void convert_VkDescriptorSetAllocateInfo_win32_to_host(struct conversion_context *ctx, const VkDescriptorSetAllocateInfo32 *in, VkDescriptorSetAllocateInfo *out) { @@ -16162,6 +16180,20 @@ static inline void convert_VkPerformanceCounterDescriptionKHR_array_host_to_win3 } #endif /* USE_STRUCT_CONVERSION */ +#if defined(USE_STRUCT_CONVERSION) +static inline void convert_VkPhysicalDevice_array_unwrapped_host_to_win32(const VkPhysicalDevice *in, VkPhysicalDevice *out, uint32_t count) +{ + unsigned int i; + + if (!in) return; + + for (i = 0; i < count; i++) + { + out[i] = in[i]; + } +} +#endif /* USE_STRUCT_CONVERSION */ + #if defined(USE_STRUCT_CONVERSION) static inline void convert_VkMappedMemoryRange_win32_to_host(const VkMappedMemoryRange32 *in, VkMappedMemoryRange *out) { @@ -24680,11 +24712,16 @@ static NTSTATUS thunk32_vkAllocateCommandBuffers(void *args) VkResult result; } *params = args; VkCommandBufferAllocateInfo pAllocateInfo_host; + VkCommandBuffer *pCommandBuffers_host; + struct conversion_context ctx; TRACE("%p, %p, %p\n", params->device, params->pAllocateInfo, params->pCommandBuffers); + init_conversion_context(&ctx); convert_VkCommandBufferAllocateInfo_win32_to_unwrapped_host(params->pAllocateInfo, &pAllocateInfo_host); - params->result = wine_vkAllocateCommandBuffers(params->device, &pAllocateInfo_host, params->pCommandBuffers); + pCommandBuffers_host = convert_VkCommandBuffer_array_win32_to_unwrapped_host(&ctx, params->pCommandBuffers, params->pAllocateInfo->commandBufferCount); + params->result = wine_vkAllocateCommandBuffers(params->device, &pAllocateInfo_host, pCommandBuffers_host); + free_conversion_context(&ctx); return STATUS_SUCCESS; } @@ -36023,10 +36060,16 @@ static NTSTATUS thunk32_vkEnumeratePhysicalDevices(void *args) VkPhysicalDevice *pPhysicalDevices; VkResult result; } *params = args; + VkPhysicalDevice *pPhysicalDevices_host; + struct conversion_context ctx; TRACE("%p, %p, %p\n", params->instance, params->pPhysicalDeviceCount, params->pPhysicalDevices); - params->result = wine_vkEnumeratePhysicalDevices(params->instance, params->pPhysicalDeviceCount, params->pPhysicalDevices); + init_conversion_context(&ctx); + pPhysicalDevices_host = (params->pPhysicalDevices && *params->pPhysicalDeviceCount) ? conversion_context_alloc(&ctx, sizeof(*pPhysicalDevices_host) * *params->pPhysicalDeviceCount) : NULL; + params->result = wine_vkEnumeratePhysicalDevices(params->instance, params->pPhysicalDeviceCount, pPhysicalDevices_host); + convert_VkPhysicalDevice_array_unwrapped_host_to_win32(pPhysicalDevices_host, params->pPhysicalDevices, *params->pPhysicalDeviceCount); + free_conversion_context(&ctx); return STATUS_SUCCESS; } @@ -36092,10 +36135,15 @@ static NTSTATUS thunk32_vkFreeCommandBuffers(void *args) uint32_t commandBufferCount; const VkCommandBuffer *pCommandBuffers; } *params = args; + const VkCommandBuffer *pCommandBuffers_host; + struct conversion_context ctx; TRACE("%p, 0x%s, %u, %p\n", params->device, wine_dbgstr_longlong(params->commandPool), params->commandBufferCount, params->pCommandBuffers); - wine_vkFreeCommandBuffers(params->device, params->commandPool, params->commandBufferCount, params->pCommandBuffers); + init_conversion_context(&ctx); + pCommandBuffers_host = convert_VkCommandBuffer_array_win32_to_unwrapped_host(&ctx, params->pCommandBuffers, params->commandBufferCount); + wine_vkFreeCommandBuffers(params->device, params->commandPool, params->commandBufferCount, pCommandBuffers_host); + free_conversion_context(&ctx); return STATUS_SUCCESS; }