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:
parent
18a5d42898
commit
76e1e41cc7
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -38,7 +38,8 @@ namespace dawn_native { namespace vulkan {
|
|||
DAWN_TRY(ToBackend(commands[i])->RecordCommands(recordingContext));
|
||||
}
|
||||
|
||||
device->SubmitPendingCommands();
|
||||
DAWN_TRY(device->SubmitPendingCommands());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue