Function Prototype
vkDeferredOperationJoinKHR
Assign a thread to a deferred operation
To assign a thread to a deferred operation, call:
VkResult vkDeferredOperationJoinKHR(
VkDevice device,
VkDeferredOperationKHR operation);
device
is the device which ownsoperation
.operation
is the deferred operation that the calling thread should work on.
The vkDeferredOperationJoinKHR
command will execute a portion of the
deferred operation on the calling thread.
The return value will be one of the following:
- A return value of
VK_SUCCESS
indicates thatoperation
is complete. The application should use vkGetDeferredOperationResultKHR to retrieve the result ofoperation
. - A return value of
VK_THREAD_DONE_KHR
indicates that the deferred operation is not complete, but there is no work remaining to assign to threads. Future calls to vkDeferredOperationJoinKHR are not necessary and will simply harm performance. This situation may occur when other threads executing vkDeferredOperationJoinKHR are about to completeoperation
, and the implementation is unable to partition the workload any further. - A return value of
VK_THREAD_IDLE_KHR
indicates that the deferred operation is not complete, and there is no work for the thread to do at the time of the call. This situation may occur if the operation encounters a temporary reduction in parallelism. By returningVK_THREAD_IDLE_KHR
, the implementation is signaling that it expects that more opportunities for parallelism will emerge as execution progresses, and that future calls to vkDeferredOperationJoinKHR can be beneficial. In the meantime, the application can perform other work on the calling thread.
Implementations must guarantee forward progress by enforcing the following invariants:
- If only one thread has invoked vkDeferredOperationJoinKHR on a
given operation, that thread must execute the operation to completion
and return
VK_SUCCESS
. - If multiple threads have concurrently invoked
vkDeferredOperationJoinKHR on the same operation, then at least
one of them must complete the operation and return
VK_SUCCESS
.
Valid Usage (Implicit)
VUID-vkDeferredOperationJoinKHR-device-parameter
device
must be a valid VkDevice handle
VUID-vkDeferredOperationJoinKHR-operation-parameter
operation
must be a valid VkDeferredOperationKHR handle
VUID-vkDeferredOperationJoinKHR-operation-parent
operation
must have been created, allocated, or retrieved from device