Handle staging buffer map failure on Metal.
BUG=dawn:108 Change-Id: Iae1331e179d112d5b93327e7e44f6a5e870557e7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9882 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
74e4834d3d
commit
9b45b5aafa
|
@ -25,7 +25,16 @@ namespace dawn_native { namespace metal {
|
||||||
const size_t bufferSize = GetSize();
|
const size_t bufferSize = GetSize();
|
||||||
mBuffer = [mDevice->GetMTLDevice() newBufferWithLength:bufferSize
|
mBuffer = [mDevice->GetMTLDevice() newBufferWithLength:bufferSize
|
||||||
options:MTLResourceStorageModeShared];
|
options:MTLResourceStorageModeShared];
|
||||||
|
|
||||||
|
if (mBuffer == nil) {
|
||||||
|
return DAWN_CONTEXT_LOST_ERROR("Unable to allocate buffer.");
|
||||||
|
}
|
||||||
|
|
||||||
mMappedPointer = [mBuffer contents];
|
mMappedPointer = [mBuffer contents];
|
||||||
|
if (mMappedPointer == nullptr) {
|
||||||
|
return DAWN_CONTEXT_LOST_ERROR("Unable to map staging buffer.");
|
||||||
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue