Define OutOfMemory error
Used to replace CONTEXT_LOST when allocation fails. BUG=dawn:152 Change-Id: I1b8d0061f2915df71f263e0712dba3d47d08e2b3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10060 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
40618d0b93
commit
c072fc2653
|
@ -25,7 +25,7 @@ namespace dawn_native {
|
||||||
// file to avoid having all files including headers like <string> and <vector>
|
// file to avoid having all files including headers like <string> and <vector>
|
||||||
class ErrorData;
|
class ErrorData;
|
||||||
|
|
||||||
enum class ErrorType : uint32_t { Validation, ContextLost, Unimplemented };
|
enum class ErrorType : uint32_t { Validation, ContextLost, Unimplemented, OutOfMemory };
|
||||||
|
|
||||||
// MaybeError and ResultOrError are meant to be used as return value for function that are not
|
// MaybeError and ResultOrError are meant to be used as return value for function that are not
|
||||||
// expected to, but might fail. The handling of error is potentially much slower than successes.
|
// expected to, but might fail. The handling of error is potentially much slower than successes.
|
||||||
|
@ -48,6 +48,7 @@ namespace dawn_native {
|
||||||
#define DAWN_VALIDATION_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::Validation, MESSAGE)
|
#define DAWN_VALIDATION_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::Validation, MESSAGE)
|
||||||
#define DAWN_CONTEXT_LOST_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::ContextLost, MESSAGE)
|
#define DAWN_CONTEXT_LOST_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::ContextLost, MESSAGE)
|
||||||
#define DAWN_UNIMPLEMENTED_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::Unimplemented, MESSAGE)
|
#define DAWN_UNIMPLEMENTED_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::Unimplemented, MESSAGE)
|
||||||
|
#define DAWN_OUT_OF_MEMORY_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::OutOfMemory, MESSAGE)
|
||||||
|
|
||||||
#define DAWN_CONCAT1(x, y) x##y
|
#define DAWN_CONCAT1(x, y) x##y
|
||||||
#define DAWN_CONCAT2(x, y) DAWN_CONCAT1(x, y)
|
#define DAWN_CONCAT2(x, y) DAWN_CONCAT1(x, y)
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace dawn_native { namespace metal {
|
||||||
options:MTLResourceStorageModeShared];
|
options:MTLResourceStorageModeShared];
|
||||||
|
|
||||||
if (mBuffer == nil) {
|
if (mBuffer == nil) {
|
||||||
return DAWN_CONTEXT_LOST_ERROR("Unable to allocate buffer.");
|
return DAWN_OUT_OF_MEMORY_ERROR("Unable to allocate buffer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
mMappedPointer = [mBuffer contents];
|
mMappedPointer = [mBuffer contents];
|
||||||
|
|
Loading…
Reference in New Issue