diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 7abe2740a6d..3f2f4a20748 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -185,7 +185,6 @@ FUNCTION_OVERRIDES = { # Device functions "vkAllocateCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : ThunkType.NONE}, - "vkCmdExecuteCommands" : {"dispatch" : True, "driver" : False, "thunk" : ThunkType.NONE}, "vkCreateCommandPool" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.NONE}, "vkDestroyCommandPool" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.NONE}, "vkDestroyDevice" : {"dispatch" : True, "driver" : False, "thunk" : ThunkType.NONE}, diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 69440c7a374..8f6c0ba9a2c 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -684,36 +684,6 @@ VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, return res; } -void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer buffer, uint32_t count, - const VkCommandBuffer *buffers) -{ - VkCommandBuffer *tmp_buffers; - unsigned int i; - - TRACE("%p %u %p\n", buffer, count, buffers); - - if (!buffers || !count) - return; - - /* Unfortunately we need a temporary buffer as our command buffers are wrapped. - * This call is called often and if a performance concern, we may want to use - * alloca as we shouldn't need much memory and it needs to be cleaned up after - * the call anyway. - */ - if (!(tmp_buffers = malloc(count * sizeof(*tmp_buffers)))) - { - ERR("Failed to allocate memory for temporary command buffers\n"); - return; - } - - for (i = 0; i < count; i++) - tmp_buffers[i] = buffers[i]->command_buffer; - - buffer->device->funcs.p_vkCmdExecuteCommands(buffer->command_buffer, count, tmp_buffers); - - free(tmp_buffers); -} - VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkDevice *device) diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index e92fffe9cf3..e2a8764538e 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -668,6 +668,29 @@ static inline void convert_VkCuLaunchInfoNVX_win_to_host(const VkCuLaunchInfoNVX } #endif /* USE_STRUCT_CONVERSION */ +static inline VkCommandBuffer *convert_VkCommandBuffer_array_win_to_host(const VkCommandBuffer *in, uint32_t count) +{ + VkCommandBuffer *out; + unsigned int i; + + if (!in) return NULL; + + out = malloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i] = in[i]->command_buffer; + } + + return out; +} + +static inline void free_VkCommandBuffer_array(VkCommandBuffer *in, uint32_t count) +{ + if (!in) return; + + free(in); +} + #if defined(USE_STRUCT_CONVERSION) static inline VkIndirectCommandsStreamNV_host *convert_VkIndirectCommandsStreamNV_array_win_to_host(const VkIndirectCommandsStreamNV *in, uint32_t count) { @@ -5114,6 +5137,17 @@ static void WINAPI wine_vkCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuff commandBuffer->device->funcs.p_vkCmdEndTransformFeedbackEXT(commandBuffer->command_buffer, firstCounterBuffer, counterBufferCount, pCounterBuffers, pCounterBufferOffsets); } +void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) +{ + VkCommandBuffer *pCommandBuffers_host; + TRACE("%p, %u, %p\n", commandBuffer, commandBufferCount, pCommandBuffers); + + pCommandBuffers_host = convert_VkCommandBuffer_array_win_to_host(pCommandBuffers, commandBufferCount); + commandBuffer->device->funcs.p_vkCmdExecuteCommands(commandBuffer->command_buffer, commandBufferCount, pCommandBuffers_host); + + free_VkCommandBuffer_array(pCommandBuffers_host, commandBufferCount); +} + static void WINAPI wine_vkCmdExecuteGeneratedCommandsNV(VkCommandBuffer commandBuffer, VkBool32 isPreprocessed, const VkGeneratedCommandsInfoNV *pGeneratedCommandsInfo) { #if defined(USE_STRUCT_CONVERSION) diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 488f559797e..bfa392021df 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -16,7 +16,6 @@ /* Functions for which we have custom implementations outside of the thunks. */ VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers); -void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers); VkResult WINAPI wine_vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool); VkResult WINAPI wine_vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger) DECLSPEC_HIDDEN;