Vulkan: Proper error handling for submission.

BUG=dawn:19

Change-Id: I457a7d3f95a9f486b6d7dbf5fe1885758362d504
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12021
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2019-10-11 11:29:46 +00:00 committed by Commit Bot service account
parent 18a5d42898
commit 76e1e41cc7
5 changed files with 13 additions and 13 deletions

View File

@ -222,7 +222,7 @@ namespace dawn_native { namespace vulkan {
mDeleter->Tick(mCompletedSerial);
if (mPendingCommands.pool != VK_NULL_HANDLE) {
SubmitPendingCommands();
DAWN_TRY(SubmitPendingCommands());
} else if (mCompletedSerial == mLastSubmittedSerial) {
// If there's no GPU work in flight we still need to artificially increment the serial
// so that CPU operations waiting on GPU completion can know they don't have to wait.
@ -294,14 +294,13 @@ namespace dawn_native { namespace vulkan {
return &mRecordingContext;
}
void Device::SubmitPendingCommands() {
MaybeError Device::SubmitPendingCommands() {
if (mPendingCommands.pool == VK_NULL_HANDLE) {
return;
return {};
}
if (fn.EndCommandBuffer(mPendingCommands.commandBuffer) != VK_SUCCESS) {
ASSERT(false);
}
DAWN_TRY(CheckVkSuccess(fn.EndCommandBuffer(mPendingCommands.commandBuffer),
"vkEndCommandBuffer"));
std::vector<VkPipelineStageFlags> dstStageMasks(mRecordingContext.waitSemaphores.size(),
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
@ -320,9 +319,7 @@ namespace dawn_native { namespace vulkan {
submitInfo.pSignalSemaphores = mRecordingContext.signalSemaphores.data();
VkFence fence = GetUnusedFence();
if (fn.QueueSubmit(mQueue, 1, &submitInfo, fence) != VK_SUCCESS) {
ASSERT(false);
}
DAWN_TRY(CheckVkSuccess(fn.QueueSubmit(mQueue, 1, &submitInfo, fence), "vkQueueSubmit"));
mLastSubmittedSerial++;
mCommandsInFlight.Enqueue(mPendingCommands, mLastSubmittedSerial);
@ -338,6 +335,8 @@ namespace dawn_native { namespace vulkan {
}
mRecordingContext = CommandRecordingContext();
return {};
}
ResultOrError<VulkanDeviceKnobs> Device::CreateDevice(VkPhysicalDevice physicalDevice) {

View File

@ -67,7 +67,7 @@ namespace dawn_native { namespace vulkan {
VkCommandBuffer GetPendingCommandBuffer();
CommandRecordingContext* GetPendingRecordingContext();
Serial GetPendingCommandSerial() const override;
void SubmitPendingCommands();
MaybeError SubmitPendingCommands();
TextureBase* CreateTextureWrappingVulkanImage(
const ExternalImageDescriptor* descriptor,

View File

@ -38,7 +38,8 @@ namespace dawn_native { namespace vulkan {
DAWN_TRY(ToBackend(commands[i])->RecordCommands(recordingContext));
}
device->SubmitPendingCommands();
DAWN_TRY(device->SubmitPendingCommands());
return {};
}

View File

@ -59,7 +59,7 @@ namespace dawn_native { namespace vulkan {
CommandRecordingContext* recordingContext = device->GetPendingRecordingContext();
ToBackend(texture)->TransitionUsageNow(recordingContext, mTextureUsage);
device->SubmitPendingCommands();
DAWN_TRY(device->SubmitPendingCommands());
return {};
}

View File

@ -562,7 +562,7 @@ namespace dawn_native { namespace vulkan {
// Queue submit to signal we are done with the texture
device->GetPendingRecordingContext()->signalSemaphores.push_back(mSignalSemaphore);
device->SubmitPendingCommands();
DAWN_TRY(device->SubmitPendingCommands());
// Write out the signal semaphore
*outSignalSemaphore = mSignalSemaphore;