From 9d4d3eac140723b28854c3eb5bdd6f19b05ea322 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Mon, 10 Jun 2019 20:53:57 +0000 Subject: [PATCH] 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 Commit-Queue: Austin Eng --- src/dawn_native/null/DeviceNull.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp index 6bf3627743..41203dd941 100644 --- a/src/dawn_native/null/DeviceNull.cpp +++ b/src/dawn_native/null/DeviceNull.cpp @@ -221,10 +221,7 @@ 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(new uint8_t[GetSize()]); - } + mBackingData = std::unique_ptr(new uint8_t[GetSize()]); } Buffer::~Buffer() {