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);
|
mDeleter->Tick(mCompletedSerial);
|
||||||
|
|
||||||
if (mPendingCommands.pool != VK_NULL_HANDLE) {
|
if (mPendingCommands.pool != VK_NULL_HANDLE) {
|
||||||
SubmitPendingCommands();
|
DAWN_TRY(SubmitPendingCommands());
|
||||||
} else if (mCompletedSerial == mLastSubmittedSerial) {
|
} else if (mCompletedSerial == mLastSubmittedSerial) {
|
||||||
// If there's no GPU work in flight we still need to artificially increment the serial
|
// 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.
|
// 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;
|
return &mRecordingContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::SubmitPendingCommands() {
|
MaybeError Device::SubmitPendingCommands() {
|
||||||
if (mPendingCommands.pool == VK_NULL_HANDLE) {
|
if (mPendingCommands.pool == VK_NULL_HANDLE) {
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fn.EndCommandBuffer(mPendingCommands.commandBuffer) != VK_SUCCESS) {
|
DAWN_TRY(CheckVkSuccess(fn.EndCommandBuffer(mPendingCommands.commandBuffer),
|
||||||
ASSERT(false);
|
"vkEndCommandBuffer"));
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<VkPipelineStageFlags> dstStageMasks(mRecordingContext.waitSemaphores.size(),
|
std::vector<VkPipelineStageFlags> dstStageMasks(mRecordingContext.waitSemaphores.size(),
|
||||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
|
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
|
||||||
|
@ -320,9 +319,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
submitInfo.pSignalSemaphores = mRecordingContext.signalSemaphores.data();
|
submitInfo.pSignalSemaphores = mRecordingContext.signalSemaphores.data();
|
||||||
|
|
||||||
VkFence fence = GetUnusedFence();
|
VkFence fence = GetUnusedFence();
|
||||||
if (fn.QueueSubmit(mQueue, 1, &submitInfo, fence) != VK_SUCCESS) {
|
DAWN_TRY(CheckVkSuccess(fn.QueueSubmit(mQueue, 1, &submitInfo, fence), "vkQueueSubmit"));
|
||||||
ASSERT(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
mLastSubmittedSerial++;
|
mLastSubmittedSerial++;
|
||||||
mCommandsInFlight.Enqueue(mPendingCommands, mLastSubmittedSerial);
|
mCommandsInFlight.Enqueue(mPendingCommands, mLastSubmittedSerial);
|
||||||
|
@ -338,6 +335,8 @@ namespace dawn_native { namespace vulkan {
|
||||||
}
|
}
|
||||||
|
|
||||||
mRecordingContext = CommandRecordingContext();
|
mRecordingContext = CommandRecordingContext();
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<VulkanDeviceKnobs> Device::CreateDevice(VkPhysicalDevice physicalDevice) {
|
ResultOrError<VulkanDeviceKnobs> Device::CreateDevice(VkPhysicalDevice physicalDevice) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
VkCommandBuffer GetPendingCommandBuffer();
|
VkCommandBuffer GetPendingCommandBuffer();
|
||||||
CommandRecordingContext* GetPendingRecordingContext();
|
CommandRecordingContext* GetPendingRecordingContext();
|
||||||
Serial GetPendingCommandSerial() const override;
|
Serial GetPendingCommandSerial() const override;
|
||||||
void SubmitPendingCommands();
|
MaybeError SubmitPendingCommands();
|
||||||
|
|
||||||
TextureBase* CreateTextureWrappingVulkanImage(
|
TextureBase* CreateTextureWrappingVulkanImage(
|
||||||
const ExternalImageDescriptor* descriptor,
|
const ExternalImageDescriptor* descriptor,
|
||||||
|
|
|
@ -38,7 +38,8 @@ namespace dawn_native { namespace vulkan {
|
||||||
DAWN_TRY(ToBackend(commands[i])->RecordCommands(recordingContext));
|
DAWN_TRY(ToBackend(commands[i])->RecordCommands(recordingContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
device->SubmitPendingCommands();
|
DAWN_TRY(device->SubmitPendingCommands());
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
CommandRecordingContext* recordingContext = device->GetPendingRecordingContext();
|
CommandRecordingContext* recordingContext = device->GetPendingRecordingContext();
|
||||||
ToBackend(texture)->TransitionUsageNow(recordingContext, mTextureUsage);
|
ToBackend(texture)->TransitionUsageNow(recordingContext, mTextureUsage);
|
||||||
|
|
||||||
device->SubmitPendingCommands();
|
DAWN_TRY(device->SubmitPendingCommands());
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -562,7 +562,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
|
|
||||||
// Queue submit to signal we are done with the texture
|
// Queue submit to signal we are done with the texture
|
||||||
device->GetPendingRecordingContext()->signalSemaphores.push_back(mSignalSemaphore);
|
device->GetPendingRecordingContext()->signalSemaphores.push_back(mSignalSemaphore);
|
||||||
device->SubmitPendingCommands();
|
DAWN_TRY(device->SubmitPendingCommands());
|
||||||
|
|
||||||
// Write out the signal semaphore
|
// Write out the signal semaphore
|
||||||
*outSignalSemaphore = mSignalSemaphore;
|
*outSignalSemaphore = mSignalSemaphore;
|
||||||
|
|
Loading…
Reference in New Issue