Commit 961d611b authored by Derek Lesho's avatar Derek Lesho Committed by Alexandre Julliard

winevulkan: Use automatically-generated thunk for vkQueueSubmit.

parent 8f2f1f83
......@@ -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},
......
......@@ -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)
{
......
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment