Add the last usage serial in Buffer

Add the last usage serial in Buffer, it is used for optimizing
MapAsync(), so the callback of MapAsync() is called when the last usage
serial is done instead of using the current pending serial when
the MapAsync() is called.

Bug: b/265151060
Change-Id: Ibc95d4e41d41896f0a49b0fd1068912b46ea14e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116693
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Peng Huang
2023-01-19 20:33:32 +00:00
committed by Dawn LUCI CQ
parent b36e09c71a
commit e3eb03f8a3
16 changed files with 272 additions and 72 deletions

View File

@@ -39,6 +39,8 @@ ResultOrError<Ref<Buffer>> Buffer::CreateInternalBuffer(Device* device,
Buffer::Buffer(Device* device, const BufferDescriptor* descriptor)
: BufferBase(device, descriptor) {
// TODO(penghuang): track usage for GL.
mLastUsageSerial = kMaxExecutionSerial;
const OpenGLFunctions& gl = device->GetGL();
// Allocate at least 4 bytes so clamped accesses are always in bounds.
mAllocatedSize = std::max(GetSize(), uint64_t(4u));