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:
parent
fa8190ae44
commit
9d4d3eac14
|
@ -221,11 +221,8 @@ namespace dawn_native { namespace null {
|
||||||
|
|
||||||
Buffer::Buffer(Device* device, const BufferDescriptor* descriptor)
|
Buffer::Buffer(Device* device, const BufferDescriptor* descriptor)
|
||||||
: BufferBase(device, 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()]);
|
mBackingData = std::unique_ptr<uint8_t[]>(new uint8_t[GetSize()]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Buffer::~Buffer() {
|
Buffer::~Buffer() {
|
||||||
DestroyInternal();
|
DestroyInternal();
|
||||||
|
|
Loading…
Reference in New Issue