Propagate errors from Tick in backend::Queue::SubmitImpl
Otherwise errors in Tick could cause the device to be lost and further processing in Queue::SubmitImpl to fail in interesting ways. Bug: dawn:723 Bug: chromium:1191777 Change-Id: I586c6b0f97c89938b9e7deeb6f31231ec19e826c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/46002 Auto-Submit: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
d7d98509da
commit
1bc1ed4bc9
|
@ -870,18 +870,22 @@ namespace dawn_native {
|
||||||
|
|
||||||
// Returns true if future ticking is needed.
|
// Returns true if future ticking is needed.
|
||||||
bool DeviceBase::APITick() {
|
bool DeviceBase::APITick() {
|
||||||
if (ConsumedError(ValidateIsAlive())) {
|
if (ConsumedError(Tick())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return !IsDeviceIdle();
|
||||||
|
}
|
||||||
|
|
||||||
|
MaybeError DeviceBase::Tick() {
|
||||||
|
DAWN_TRY(ValidateIsAlive());
|
||||||
|
|
||||||
// to avoid overly ticking, we only want to tick when:
|
// to avoid overly ticking, we only want to tick when:
|
||||||
// 1. the last submitted serial has moved beyond the completed serial
|
// 1. the last submitted serial has moved beyond the completed serial
|
||||||
// 2. or the completed serial has not reached the future serial set by the trackers
|
// 2. or the completed serial has not reached the future serial set by the trackers
|
||||||
if (mLastSubmittedSerial > mCompletedSerial || mCompletedSerial < mFutureSerial) {
|
if (mLastSubmittedSerial > mCompletedSerial || mCompletedSerial < mFutureSerial) {
|
||||||
CheckPassedSerials();
|
CheckPassedSerials();
|
||||||
|
|
||||||
if (ConsumedError(TickImpl())) {
|
DAWN_TRY(TickImpl());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There is no GPU work in flight, we need to move the serials forward so that
|
// There is no GPU work in flight, we need to move the serials forward so that
|
||||||
// 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.
|
||||||
|
@ -900,7 +904,7 @@ namespace dawn_native {
|
||||||
mCreatePipelineAsyncTracker->Tick(mCompletedSerial);
|
mCreatePipelineAsyncTracker->Tick(mCompletedSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !IsDeviceIdle();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueBase* DeviceBase::APIGetQueue() {
|
QueueBase* DeviceBase::APIGetQueue() {
|
||||||
|
|
|
@ -89,7 +89,6 @@ namespace dawn_native {
|
||||||
ExecutionSerial GetLastSubmittedCommandSerial() const;
|
ExecutionSerial GetLastSubmittedCommandSerial() const;
|
||||||
ExecutionSerial GetFutureSerial() const;
|
ExecutionSerial GetFutureSerial() const;
|
||||||
ExecutionSerial GetPendingCommandSerial() const;
|
ExecutionSerial GetPendingCommandSerial() const;
|
||||||
virtual MaybeError TickImpl() = 0;
|
|
||||||
|
|
||||||
// Many Dawn objects are completely immutable once created which means that if two
|
// Many Dawn objects are completely immutable once created which means that if two
|
||||||
// creations are given the same arguments, they can return the same object. Reusing
|
// creations are given the same arguments, they can return the same object. Reusing
|
||||||
|
@ -242,6 +241,8 @@ namespace dawn_native {
|
||||||
// Check for passed fences and set the new completed serial
|
// Check for passed fences and set the new completed serial
|
||||||
void CheckPassedSerials();
|
void CheckPassedSerials();
|
||||||
|
|
||||||
|
MaybeError Tick();
|
||||||
|
|
||||||
virtual uint32_t GetOptimalBytesPerRowAlignment() const = 0;
|
virtual uint32_t GetOptimalBytesPerRowAlignment() const = 0;
|
||||||
virtual uint64_t GetOptimalBufferToTextureCopyOffsetAlignment() const = 0;
|
virtual uint64_t GetOptimalBufferToTextureCopyOffsetAlignment() const = 0;
|
||||||
|
|
||||||
|
@ -290,6 +291,8 @@ namespace dawn_native {
|
||||||
TextureBase* texture,
|
TextureBase* texture,
|
||||||
const TextureViewDescriptor* descriptor) = 0;
|
const TextureViewDescriptor* descriptor) = 0;
|
||||||
|
|
||||||
|
virtual MaybeError TickImpl() = 0;
|
||||||
|
|
||||||
ResultOrError<Ref<BindGroupLayoutBase>> CreateEmptyBindGroupLayout();
|
ResultOrError<Ref<BindGroupLayoutBase>> CreateEmptyBindGroupLayout();
|
||||||
|
|
||||||
MaybeError CreateBindGroupInternal(BindGroupBase** result,
|
MaybeError CreateBindGroupInternal(BindGroupBase** result,
|
||||||
|
|
|
@ -32,8 +32,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
|
||||||
// TODO(dawn:723): propagate any errors from Tick.
|
DAWN_TRY(device->Tick());
|
||||||
device->APITick();
|
|
||||||
|
|
||||||
CommandRecordingContext* commandContext;
|
CommandRecordingContext* commandContext;
|
||||||
DAWN_TRY_ASSIGN(commandContext, device->GetPendingCommandContext());
|
DAWN_TRY_ASSIGN(commandContext, device->GetPendingCommandContext());
|
||||||
|
|
|
@ -32,8 +32,7 @@ namespace dawn_native { namespace metal {
|
||||||
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
|
||||||
// TODO(dawn:723): propagate any errors from Tick.
|
DAWN_TRY(device->Tick());
|
||||||
device->APITick();
|
|
||||||
|
|
||||||
CommandRecordingContext* commandContext = device->GetPendingCommandContext();
|
CommandRecordingContext* commandContext = device->GetPendingCommandContext();
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
|
||||||
// TODO(dawn:723): propagate any errors from Tick.
|
DAWN_TRY(device->Tick());
|
||||||
device->APITick();
|
|
||||||
|
|
||||||
TRACE_EVENT_BEGIN0(GetDevice()->GetPlatform(), Recording,
|
TRACE_EVENT_BEGIN0(GetDevice()->GetPlatform(), Recording,
|
||||||
"CommandBufferVk::RecordCommands");
|
"CommandBufferVk::RecordCommands");
|
||||||
|
|
Loading…
Reference in New Issue