mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Don't rely on null::Queue::Submit resolving mapping operations.
In the validation tests, we relied on Queue.Submit(0, nullptr) to resolve mapping operations. This is fragile so we replace it with a FlushMappingOperations() function that uses device.Tick() instead. This allows removing the mapSerial argument from Buffer::MapRead/WriteAsyncImpl (which was the actual goal of this CL). Bug: dawn:445 Change-Id: Id98822287370c371bebb83afb8e290e17f3c1b55 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24381 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
d761d5a575
commit
1318c603d9
@@ -270,17 +270,6 @@ namespace dawn_native { namespace null {
|
||||
|
||||
// Buffer
|
||||
|
||||
struct BufferMapOperation : PendingOperation {
|
||||
virtual void Execute() {
|
||||
buffer->OnMapCommandSerialFinished(serial, isWrite);
|
||||
}
|
||||
|
||||
Ref<Buffer> buffer;
|
||||
void* ptr;
|
||||
uint32_t serial;
|
||||
bool isWrite;
|
||||
};
|
||||
|
||||
Buffer::Buffer(Device* device, const BufferDescriptor* descriptor)
|
||||
: BufferBase(device, descriptor) {
|
||||
mBackingData = std::unique_ptr<uint8_t[]>(new uint8_t[GetSize()]);
|
||||
@@ -315,28 +304,14 @@ namespace dawn_native { namespace null {
|
||||
memcpy(mBackingData.get() + bufferOffset, data, size);
|
||||
}
|
||||
|
||||
MaybeError Buffer::MapReadAsyncImpl(uint32_t serial) {
|
||||
MapAsyncImplCommon(serial, false);
|
||||
MaybeError Buffer::MapReadAsyncImpl() {
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError Buffer::MapWriteAsyncImpl(uint32_t serial) {
|
||||
MapAsyncImplCommon(serial, true);
|
||||
MaybeError Buffer::MapWriteAsyncImpl() {
|
||||
return {};
|
||||
}
|
||||
|
||||
void Buffer::MapAsyncImplCommon(uint32_t serial, bool isWrite) {
|
||||
ASSERT(mBackingData);
|
||||
|
||||
auto operation = std::make_unique<BufferMapOperation>();
|
||||
operation->buffer = this;
|
||||
operation->ptr = mBackingData.get();
|
||||
operation->serial = serial;
|
||||
operation->isWrite = isWrite;
|
||||
|
||||
ToBackend(GetDevice())->AddPendingOperation(std::move(operation));
|
||||
}
|
||||
|
||||
void* Buffer::GetMappedPointerImpl() {
|
||||
return mBackingData.get();
|
||||
}
|
||||
|
||||
@@ -199,14 +199,13 @@ namespace dawn_native { namespace null {
|
||||
~Buffer() override;
|
||||
|
||||
// Dawn API
|
||||
MaybeError MapReadAsyncImpl(uint32_t serial) override;
|
||||
MaybeError MapWriteAsyncImpl(uint32_t serial) override;
|
||||
MaybeError MapReadAsyncImpl() override;
|
||||
MaybeError MapWriteAsyncImpl() override;
|
||||
void UnmapImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
bool IsMapWritable() const override;
|
||||
MaybeError MapAtCreationImpl() override;
|
||||
void MapAsyncImplCommon(uint32_t serial, bool isWrite);
|
||||
void* GetMappedPointerImpl() override;
|
||||
|
||||
std::unique_ptr<uint8_t[]> mBackingData;
|
||||
|
||||
Reference in New Issue
Block a user