winevulkan: Use automatically-generated thunk for vkCmdExecuteCommands.

Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Derek Lesho 2021-05-13 12:18:45 -04:00 committed by Alexandre Julliard
parent fb8ab5e9d0
commit 8f2f1f83c3
4 changed files with 34 additions and 32 deletions

View File

@ -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},

View File

@ -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)

View File

@ -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)

View File

@ -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;