diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 3f2f4a20748..cc79b0a58cd 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -192,7 +192,6 @@ FUNCTION_OVERRIDES = { "vkGetDeviceProcAddr" : {"dispatch" : False, "driver" : True, "thunk" : ThunkType.NONE, "loader_thunk" : ThunkType.NONE}, "vkGetDeviceQueue" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.NONE}, "vkGetDeviceQueue2" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.NONE}, - "vkQueueSubmit" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.NONE}, # VK_KHR_surface "vkDestroySurfaceKHR" : {"dispatch" : True, "driver" : True, "thunk" : ThunkType.NONE}, diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 8f6c0ba9a2c..9f181d92bc5 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1067,61 +1067,6 @@ void WINAPI wine_vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *in *queue = wine_vk_device_find_queue(device, info); } -VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t count, - const VkSubmitInfo *submits, VkFence fence) -{ - VkSubmitInfo *submits_host; - VkResult res; - VkCommandBuffer *command_buffers; - unsigned int i, j, num_command_buffers; - - TRACE("%p %u %p 0x%s\n", queue, count, submits, wine_dbgstr_longlong(fence)); - - if (count == 0) - { - return queue->device->funcs.p_vkQueueSubmit(queue->queue, 0, NULL, fence); - } - - submits_host = calloc(count, sizeof(*submits_host)); - if (!submits_host) - { - ERR("Unable to allocate memory for submit buffers!\n"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - - for (i = 0; i < count; i++) - { - memcpy(&submits_host[i], &submits[i], sizeof(*submits_host)); - - num_command_buffers = submits[i].commandBufferCount; - command_buffers = calloc(num_command_buffers, sizeof(*command_buffers)); - if (!command_buffers) - { - ERR("Unable to allocate memory for command buffers!\n"); - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto done; - } - - for (j = 0; j < num_command_buffers; j++) - { - command_buffers[j] = submits[i].pCommandBuffers[j]->command_buffer; - } - submits_host[i].pCommandBuffers = command_buffers; - } - - res = queue->device->funcs.p_vkQueueSubmit(queue->queue, count, submits_host, fence); - -done: - for (i = 0; i < count; i++) - { - free((void *)submits_host[i].pCommandBuffers); - } - free(submits_host); - - TRACE("Returning %d\n", res); - return res; -} - VkResult WINAPI wine_vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *info, const VkAllocationCallbacks *allocator, VkCommandPool *command_pool) { diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index e2a8764538e..c0dbbe2b8b8 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -2317,6 +2317,43 @@ static inline void free_VkBindSparseInfo_array(VkBindSparseInfo_host *in, uint32 } #endif /* USE_STRUCT_CONVERSION */ +static inline VkSubmitInfo *convert_VkSubmitInfo_array_win_to_host(const VkSubmitInfo *in, uint32_t count) +{ + VkSubmitInfo *out; + unsigned int i; + + if (!in) return NULL; + + out = malloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].waitSemaphoreCount = in[i].waitSemaphoreCount; + out[i].pWaitSemaphores = in[i].pWaitSemaphores; + out[i].pWaitDstStageMask = in[i].pWaitDstStageMask; + out[i].commandBufferCount = in[i].commandBufferCount; + out[i].pCommandBuffers = convert_VkCommandBuffer_array_win_to_host(in[i].pCommandBuffers, in[i].commandBufferCount); + out[i].signalSemaphoreCount = in[i].signalSemaphoreCount; + out[i].pSignalSemaphores = in[i].pSignalSemaphores; + } + + return out; +} + +static inline void free_VkSubmitInfo_array(VkSubmitInfo *in, uint32_t count) +{ + unsigned int i; + + if (!in) return; + + for (i = 0; i < count; i++) + { + free_VkCommandBuffer_array((VkCommandBuffer *)in[i].pCommandBuffers, in[i].commandBufferCount); + } + free(in); +} + #if defined(USE_STRUCT_CONVERSION) static inline VkSemaphoreSubmitInfoKHR_host *convert_VkSemaphoreSubmitInfoKHR_array_win_to_host(const VkSemaphoreSubmitInfoKHR *in, uint32_t count) { @@ -7462,6 +7499,19 @@ static VkResult WINAPI wine_vkQueueSetPerformanceConfigurationINTEL(VkQueue queu return queue->device->funcs.p_vkQueueSetPerformanceConfigurationINTEL(queue->queue, configuration); } +VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) +{ + VkResult result; + VkSubmitInfo *pSubmits_host; + TRACE("%p, %u, %p, 0x%s\n", queue, submitCount, pSubmits, wine_dbgstr_longlong(fence)); + + pSubmits_host = convert_VkSubmitInfo_array_win_to_host(pSubmits, submitCount); + result = queue->device->funcs.p_vkQueueSubmit(queue->queue, submitCount, pSubmits_host, fence); + + free_VkSubmitInfo_array(pSubmits_host, submitCount); + return result; +} + static VkResult WINAPI wine_vkQueueSubmit2KHR(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2KHR *pSubmits, VkFence fence) { #if defined(USE_STRUCT_CONVERSION) diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index bfa392021df..34442762859 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -57,7 +57,6 @@ VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevi VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities); VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities); void WINAPI wine_vkGetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t *pData) DECLSPEC_HIDDEN; -VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence); VkResult WINAPI wine_vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkSetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t data) DECLSPEC_HIDDEN;