diff options
author | Jason Ekstrand <[email protected]> | 2015-12-02 17:18:41 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-12-03 13:44:02 -0800 |
commit | 4e904a0310be8a5c311355473e70df4fd4d9caa1 (patch) | |
tree | 07872f76727c71d1507b1e4c5ecebd1cdfadb5b0 | |
parent | 5757ad2959a91f71dcc4a3661cce0e5ab065052b (diff) |
vk/0.210.0: Rework vkQueueSubmit
-rw-r--r-- | include/vulkan/vulkan.h | 17 | ||||
-rw-r--r-- | src/vulkan/anv_device.c | 38 | ||||
-rw-r--r-- | src/vulkan/anv_dump.c | 8 |
3 files changed, 40 insertions, 23 deletions
diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 67ab34ddf23..a897a6efbc0 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -1377,6 +1377,17 @@ typedef struct VkLayerProperties { char description[VK_MAX_DESCRIPTION_SIZE]; } VkLayerProperties; +typedef struct VkSubmitInfo { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + uint32_t commandBufferCount; + const VkCommandBuffer* pCommandBuffers; + uint32_t signalSemaphoreCount; + const VkSemaphore* pSignalSemaphores; +} VkSubmitInfo; + typedef struct VkMemoryAllocateInfo { VkStructureType sType; const void* pNext; @@ -2155,7 +2166,7 @@ typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysica typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t* pPropertyCount, VkLayerProperties* pProperties); typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties); typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue); -typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence); typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue queue); typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice device); typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory); @@ -2367,8 +2378,8 @@ VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue( VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit( VkQueue queue, - uint32_t commandBufferCount, - const VkCommandBuffer* pCommandBuffers, + uint32_t submitCount, + const VkSubmitInfo* pSubmits, VkFence fence); VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle( diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index 5b300afc0a8..e3b3541d251 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -808,8 +808,8 @@ void anv_GetDeviceQueue( VkResult anv_QueueSubmit( VkQueue _queue, - uint32_t commandBufferCount, - const VkCommandBuffer* pCommandBuffers, + uint32_t submitCount, + const VkSubmitInfo* pSubmits, VkFence _fence) { ANV_FROM_HANDLE(anv_queue, queue, _queue); @@ -817,29 +817,31 @@ VkResult anv_QueueSubmit( struct anv_device *device = queue->device; int ret; - for (uint32_t i = 0; i < commandBufferCount; i++) { - ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, pCommandBuffers[i]); + for (uint32_t i = 0; i < submitCount; i++) { + for (uint32_t j = 0; j < pSubmits[i].commandBufferCount; j++) { + ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, + pSubmits[i].pCommandBuffers[j]); + assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); - assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); - - ret = anv_gem_execbuffer(device, &cmd_buffer->execbuf2.execbuf); - if (ret != 0) { - /* We don't know the real error. */ - return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY, - "execbuf2 failed: %m"); - } - - if (fence) { - ret = anv_gem_execbuffer(device, &fence->execbuf); + ret = anv_gem_execbuffer(device, &cmd_buffer->execbuf2.execbuf); if (ret != 0) { /* We don't know the real error. */ return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY, "execbuf2 failed: %m"); } - } - for (uint32_t i = 0; i < cmd_buffer->execbuf2.bo_count; i++) - cmd_buffer->execbuf2.bos[i]->offset = cmd_buffer->execbuf2.objects[i].offset; + if (fence) { + ret = anv_gem_execbuffer(device, &fence->execbuf); + if (ret != 0) { + /* We don't know the real error. */ + return vk_errorf(VK_ERROR_OUT_OF_DEVICE_MEMORY, + "execbuf2 failed: %m"); + } + } + + for (uint32_t k = 0; k < cmd_buffer->execbuf2.bo_count; k++) + cmd_buffer->execbuf2.bos[k]->offset = cmd_buffer->execbuf2.objects[k].offset; + } } return VK_SUCCESS; diff --git a/src/vulkan/anv_dump.c b/src/vulkan/anv_dump.c index 4db7c2539e1..3a1430d49a0 100644 --- a/src/vulkan/anv_dump.c +++ b/src/vulkan/anv_dump.c @@ -161,8 +161,12 @@ anv_dump_image_to_ppm(struct anv_device *device, }, NULL, &fence); assert(result == VK_SUCCESS); - result = anv_QueueSubmit(anv_queue_to_handle(&device->queue), - 1, &cmd, fence); + result = anv_QueueSubmit(anv_queue_to_handle(&device->queue), 1, + &(VkSubmitInfo) { + .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, + .commandBufferCount = 1, + .pCommandBuffers = &cmd, + }, fence); assert(result == VK_SUCCESS); result = anv_WaitForFences(vk_device, 1, &fence, true, UINT64_MAX); |