Handle DeviceLost error Handle DeviceLostCallback once DeviceLost error occurs. Disallow any other commands or actions on device to happen after device has been lost. Bug: dawn:68 Change-Id: Icbbbadf278cae5e6213050d00439118789c863dc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12801 Commit-Queue: Natasha Lee <natlee@microsoft.com> Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp index c57d23a..8e72bd7 100644 --- a/src/dawn_native/Buffer.cpp +++ b/src/dawn_native/Buffer.cpp
@@ -17,6 +17,7 @@ #include "common/Assert.h" #include "dawn_native/Device.h" #include "dawn_native/DynamicUploader.h" +#include "dawn_native/ErrorData.h" #include "dawn_native/ValidationUtils_autogen.h" #include <cstdio> @@ -350,6 +351,7 @@ } MaybeError BufferBase::ValidateSetSubData(uint32_t start, uint32_t count) const { + DAWN_TRY(GetDevice()->ValidateIsAlive()); DAWN_TRY(GetDevice()->ValidateObject(this)); switch (mState) { @@ -388,6 +390,7 @@ } MaybeError BufferBase::ValidateMap(wgpu::BufferUsage requiredUsage) const { + DAWN_TRY(GetDevice()->ValidateIsAlive()); DAWN_TRY(GetDevice()->ValidateObject(this)); switch (mState) { @@ -407,6 +410,7 @@ } MaybeError BufferBase::ValidateUnmap() const { + DAWN_TRY(GetDevice()->ValidateIsAlive()); DAWN_TRY(GetDevice()->ValidateObject(this)); switch (mState) {