*/
int64_t timeout = MIN2(_timeout, INT64_MAX);
+ VkResult result = VK_SUCCESS;
uint32_t pending_fences = fenceCount;
while (pending_fences) {
pending_fences = 0;
/* This fence is not pending. If waitAll isn't set, we can return
* early. Otherwise, we have to keep going.
*/
- if (!waitAll)
- return VK_SUCCESS;
+ if (!waitAll) {
+ result = VK_SUCCESS;
+ goto done;
+ }
continue;
case ANV_FENCE_STATE_SUBMITTED:
*/
ret = anv_gem_wait(device, fence->bo.gem_handle, &timeout);
if (ret == -1 && errno == ETIME) {
- return VK_TIMEOUT;
+ result = VK_TIMEOUT;
+ goto done;
} else if (ret == -1) {
/* We don't know the real error. */
device->lost = true;
if (time_elapsed >= timeout) {
pthread_mutex_unlock(&device->mutex);
- return VK_TIMEOUT;
+ result = VK_TIMEOUT;
+ goto done;
}
timeout -= time_elapsed;
}
}
- return VK_SUCCESS;
+done:
+ if (unlikely(device->lost))
+ return VK_ERROR_DEVICE_LOST;
+
+ return result;
}
// Queue semaphore functions