Always back Buffers with data in the Null backend.

Now that CreateBufferMapped is implemented. Buffers of any usage may
be initialized with staging data. All buffers need to have backing data
otherwise copying from staging data to the buffer will dereference nullptr.

Bug: chromium:971542
Change-Id: I623cc236ffab918ec048cd1949520a4cb329c1b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7980
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2019-06-10 20:53:57 +00:00 committed by Commit Bot service account
parent fa8190ae44
commit 9d4d3eac14
1 changed files with 1 additions and 4 deletions

View File

@ -221,11 +221,8 @@ namespace dawn_native { namespace null {
Buffer::Buffer(Device* device, const BufferDescriptor* descriptor)
: BufferBase(device, descriptor) {
if (GetUsage() & (dawn::BufferUsageBit::TransferDst | dawn::BufferUsageBit::TransferSrc |
dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) {
mBackingData = std::unique_ptr<uint8_t[]>(new uint8_t[GetSize()]);
}
}
Buffer::~Buffer() {
DestroyInternal();