winevulkan: Implement vkQueueSubmit.

Signed-off-by: Roderick Colenbrander <thunderbird2k@gmail.com>
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Roderick Colenbrander 2018-03-14 23:39:34 -07:00 committed by Alexandre Julliard
parent 88a96bbd57
commit 6536dec397
4 changed files with 58 additions and 6 deletions

View File

@ -117,6 +117,7 @@ FUNCTION_OVERRIDES = {
"vkFreeCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False},
"vkGetDeviceProcAddr" : {"dispatch" : True, "driver" : True, "thunk" : False},
"vkGetDeviceQueue" : {"dispatch": True, "driver" : False, "thunk" : False},
"vkQueueSubmit" : {"dispatch": True, "driver" : False, "thunk" : False},
# VK_KHR_surface
"vkDestroySurfaceKHR" : {"dispatch" : True, "driver" : True, "thunk" : False},

View File

@ -968,6 +968,62 @@ VkResult WINAPI wine_vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *supporte
return VK_SUCCESS;
}
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 = heap_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 = heap_calloc(num_command_buffers, sizeof(*submits_host));
if (!command_buffers)
{
ERR("Unable to allocate memory for comman buffers!\n");
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto err;
}
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);
err:
for (i = 0; i < count; i++)
{
heap_free((void *)submits_host[i].pCommandBuffers);
}
heap_free(submits_host);
TRACE("Returning %d\n", res);
return res;
}
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved)
{
switch (reason)

View File

@ -1641,12 +1641,6 @@ static VkResult WINAPI wine_vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCo
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
static VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence)
{
FIXME("stub: %p, %u, %p, 0x%s\n", queue, submitCount, pSubmits, wine_dbgstr_longlong(fence));
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
static VkResult WINAPI wine_vkQueueWaitIdle(VkQueue queue)
{
FIXME("stub: %p\n", queue);

View File

@ -37,6 +37,7 @@ VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physi
VkBool32 WINAPI wine_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) DECLSPEC_HIDDEN;
typedef struct VkCommandBufferAllocateInfo_host
{