Vulkan: Ensure fences are properly tracked if vkQueueSubmit fails

Bug: chromium:1216929
Change-Id: I58fa8df4d539b58b47246bb2cde18c4ede46f5ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Auto-Submit: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Austin Eng 2021-06-23 02:08:49 +00:00 committed by Dawn LUCI CQ
parent 6e673b4b81
commit 59dffe0a9b
1 changed files with 7 additions and 1 deletions

View File

@ -259,7 +259,13 @@ namespace dawn_native { namespace vulkan {
VkFence fence = VK_NULL_HANDLE; VkFence fence = VK_NULL_HANDLE;
DAWN_TRY_ASSIGN(fence, GetUnusedFence()); DAWN_TRY_ASSIGN(fence, GetUnusedFence());
DAWN_TRY(CheckVkSuccess(fn.QueueSubmit(mQueue, 1, &submitInfo, fence), "vkQueueSubmit")); DAWN_TRY_WITH_CLEANUP(
CheckVkSuccess(fn.QueueSubmit(mQueue, 1, &submitInfo, fence), "vkQueueSubmit"), {
// If submitting to the queue fails, move the fence back into the unused fence
// list, as if it were never acquired. Not doing so would leak the fence since
// it would be neither in the unused list nor in the in-flight list.
mUnusedFences.push_back(fence);
});
// Enqueue the semaphores before incrementing the serial, so that they can be deleted as // Enqueue the semaphores before incrementing the serial, so that they can be deleted as
// soon as the current submission is finished. // soon as the current submission is finished.