Change Device::Tick To Return Bool
Changes Device::Tick to return a boolean that denotes whether or not
Tick needs to be called again.
Bug: dawn:119
Change-Id: I9d4c7e291536d676b33fc61d652667c1fbff8c62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29980
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h
index a2f9c4b..bd76dee 100644
--- a/src/dawn_native/Device.h
+++ b/src/dawn_native/Device.h
@@ -86,7 +86,7 @@
ExecutionSerial GetCompletedCommandSerial() const;
ExecutionSerial GetLastSubmittedCommandSerial() const;
- ExecutionSerial GetFutureCallbackSerial() const;
+ ExecutionSerial GetFutureSerial() const;
ExecutionSerial GetPendingCommandSerial() const;
virtual MaybeError TickImpl() = 0;
@@ -161,7 +161,7 @@
QueueBase* GetDefaultQueue();
void InjectError(wgpu::ErrorType type, const char* message);
- void Tick();
+ bool Tick();
void SetDeviceLostCallback(wgpu::DeviceLostCallback callback, void* userdata);
void SetUncapturedErrorCallback(wgpu::ErrorCallback callback, void* userdata);
@@ -221,14 +221,15 @@
size_t GetDeprecationWarningCountForTesting();
void EmitDeprecationWarning(const char* warning);
void LoseForTesting();
- // AddFutureCallbackSerial is used to update the mFutureCallbackSerial with the max
- // serial needed to be ticked in order to clean up all pending callback work. It should be
- // given the serial that a callback is tracked with, so that once that serial is completed,
- // it can be resolved and cleaned up. This is so that when there is no gpu work (the last
- // submitted serial has not moved beyond the completed serial), Tick can still check if we
- // have pending callback work to take care of, rather than hanging and never reaching the
- // serial the callbacks are enqueued on.
- void AddFutureCallbackSerial(ExecutionSerial serial);
+
+ // AddFutureSerial is used to update the mFutureSerial with the max serial needed to be
+ // ticked in order to clean up all pending callback work or to execute asynchronous resource
+ // writes. It should be given the serial that a callback is tracked with, so that once that
+ // serial is completed, it can be resolved and cleaned up. This is so that when there is no
+ // gpu work (the last submitted serial has not moved beyond the completed serial), Tick can
+ // still check if we have pending work to take care of, rather than hanging and never
+ // reaching the serial the work will be executed on.
+ void AddFutureSerial(ExecutionSerial serial);
virtual uint32_t GetOptimalBytesPerRowAlignment() const = 0;
virtual uint64_t GetOptimalBufferToTextureCopyOffsetAlignment() const = 0;
@@ -320,17 +321,19 @@
// and waiting on a serial that doesn't have a corresponding fence enqueued. Fake serials to
// make all commands look completed.
void AssumeCommandsComplete();
+ bool IsDeviceIdle();
+
// mCompletedSerial tracks the last completed command serial that the fence has returned.
// mLastSubmittedSerial tracks the last submitted command serial.
// During device removal, the serials could be artificially incremented
// to make it appear as if commands have been compeleted. They can also be artificially
// incremented when no work is being done in the GPU so CPU operations don't have to wait on
// stale serials.
- // mFutureCallbackSerial tracks the largest serial we need to tick to for the callbacks to
- // fire
+ // mFutureSerial tracks the largest serial we need to tick to for asynchronous commands or
+ // callbacks to fire
ExecutionSerial mCompletedSerial = ExecutionSerial(0);
ExecutionSerial mLastSubmittedSerial = ExecutionSerial(0);
- ExecutionSerial mFutureCallbackSerial = ExecutionSerial(0);
+ ExecutionSerial mFutureSerial = ExecutionSerial(0);
// ShutDownImpl is used to clean up and release resources used by device, does not wait for
// GPU or check errors.