[dawn][native] Eagerly submit to release mappedAtCreation staging.
The DynamicUploader has tracking of how much memory is pending a submit
to be eventually released. However the staging buffer for
mappedAtCreation buffers was not accounted.
Make the DynamicUploader trigger an early submit when pending staging
memory is above 16MB. This could cause reantrancy during some queue
submissions so ExecutionQueue is modified to have a guard against
reentrant submits.
Bug: 42242066
Change-Id: I1a81fc0fe51208b39b220fcc1b6d851f71367b33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/226596
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/native/Buffer.cpp b/src/dawn/native/Buffer.cpp
index 40dda63..1337cca 100644
--- a/src/dawn/native/Buffer.cpp
+++ b/src/dawn/native/Buffer.cpp
@@ -661,10 +661,10 @@
DAWN_TRY(
GetDevice()->CopyFromStagingToBuffer(mStagingBuffer.Get(), 0, this, 0, GetAllocatedSize()));
-
mStagingBuffer = nullptr;
- return {};
+ return GetDevice()->GetDynamicUploader()->OnStagingMemoryFreePendingOnSubmit(
+ GetAllocatedSize());
}
void BufferBase::APIUnmap() {
diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp
index 37939a2..4530de9 100644
--- a/src/dawn/native/Device.cpp
+++ b/src/dawn/native/Device.cpp
@@ -2367,19 +2367,6 @@
return 4u;
}
-MaybeError DeviceBase::CopyFromStagingToBuffer(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) {
- DAWN_TRY(
- CopyFromStagingToBufferImpl(source, sourceOffset, destination, destinationOffset, size));
- if (GetDynamicUploader()->ShouldFlush()) {
- mQueue->ForceEventualFlushOfCommands();
- }
- return {};
-}
-
MaybeError DeviceBase::CopyFromStagingToTexture(BufferBase* source,
const TexelCopyBufferLayout& src,
const TextureCopy& dst,
@@ -2399,9 +2386,6 @@
DAWN_TRY(CopyFromStagingToTextureImpl(source, src, dst, copySizePixels));
}
- if (GetDynamicUploader()->ShouldFlush()) {
- mQueue->ForceEventualFlushOfCommands();
- }
return {};
}
diff --git a/src/dawn/native/Device.h b/src/dawn/native/Device.h
index 6c41b55..c286bf8 100644
--- a/src/dawn/native/Device.h
+++ b/src/dawn/native/Device.h
@@ -286,11 +286,11 @@
Blob LoadCachedBlob(const CacheKey& key);
void StoreCachedBlob(const CacheKey& key, const Blob& blob);
- MaybeError CopyFromStagingToBuffer(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size);
+ virtual MaybeError CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) = 0;
MaybeError CopyFromStagingToTexture(BufferBase* source,
const TexelCopyBufferLayout& src,
const TextureCopy& dst,
@@ -539,11 +539,6 @@
// GPU or check errors.
virtual void DestroyImpl() = 0;
- virtual MaybeError CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) = 0;
virtual MaybeError CopyFromStagingToTextureImpl(const BufferBase* source,
const TexelCopyBufferLayout& src,
const TextureCopy& dst,
diff --git a/src/dawn/native/DynamicUploader.cpp b/src/dawn/native/DynamicUploader.cpp
index 15f565f..4ad9616 100644
--- a/src/dawn/native/DynamicUploader.cpp
+++ b/src/dawn/native/DynamicUploader.cpp
@@ -36,6 +36,10 @@
namespace dawn::native {
+namespace {
+constexpr uint64_t kRingBufferSize = 4 * 1024 * 1024;
+} // anonymous namespace
+
DynamicUploader::DynamicUploader(DeviceBase* device) : mDevice(device) {}
ResultOrError<UploadReservation> DynamicUploader::Reserve(uint64_t allocationSize,
@@ -121,6 +125,29 @@
return reservation;
}
+MaybeError DynamicUploader::OnStagingMemoryFreePendingOnSubmit(uint64_t size) {
+ QueueBase* queue = mDevice->GetQueue();
+
+ // Take into account that submits make the pending memory freed in finite time so we no longer
+ // need to track that memory.
+ ExecutionSerial pendingSerial = queue->GetPendingCommandSerial();
+ if (pendingSerial > mLastPendingSerialSeen) {
+ mMemoryPendingSubmit = 0;
+ mLastPendingSerialSeen = pendingSerial;
+ }
+
+ constexpr uint64_t kPendingMemorySubmitThreshold = 16 * 1024 * 1024;
+ mMemoryPendingSubmit += size;
+ if (mMemoryPendingSubmit < kPendingMemorySubmitThreshold) {
+ return {};
+ }
+
+ // TODO(crbug.com/42240396): Consider blocking when there is too much memory in flight for
+ // freeing, which could cause OOM even if we eagerly flush when too much memory is pending.
+ queue->ForceEventualFlushOfCommands();
+ return queue->SubmitPendingCommands();
+}
+
void DynamicUploader::Deallocate(ExecutionSerial lastCompletedSerial, bool freeAll) {
// Reclaim memory within the ring buffers by ticking (or removing requests no longer
// in-flight).
@@ -139,21 +166,4 @@
}
}
-bool DynamicUploader::ShouldFlush() const {
- uint64_t kTotalAllocatedSizeThreshold = 64 * 1024 * 1024;
- // We use total allocated size instead of pending-upload size to prevent Dawn from allocating
- // too much GPU memory so that the risk of OOM can be minimized.
- return GetTotalAllocatedSize() > kTotalAllocatedSizeThreshold;
-}
-
-uint64_t DynamicUploader::GetTotalAllocatedSize() const {
- uint64_t size = 0;
- for (const auto& buffer : mRingBuffers) {
- if (buffer->mStagingBuffer != nullptr) {
- size += buffer->mStagingBuffer->GetSize();
- }
- }
- return size;
-}
-
} // namespace dawn::native
diff --git a/src/dawn/native/DynamicUploader.h b/src/dawn/native/DynamicUploader.h
index e32605d..6efccf0 100644
--- a/src/dawn/native/DynamicUploader.h
+++ b/src/dawn/native/DynamicUploader.h
@@ -31,6 +31,7 @@
#include <memory>
#include <vector>
+#include "dawn/common/NonMovable.h"
#include "dawn/common/Ref.h"
#include "dawn/native/Error.h"
#include "dawn/native/Forward.h"
@@ -50,7 +51,7 @@
Ref<BufferBase> buffer;
};
-class DynamicUploader {
+class DynamicUploader : NonMovable {
public:
explicit DynamicUploader(DeviceBase* device);
~DynamicUploader() = default;
@@ -60,25 +61,29 @@
MaybeError WithUploadReservation(uint64_t size, uint64_t offsetAlignment, F&& f) {
UploadReservation reservation;
DAWN_TRY_ASSIGN(reservation, Reserve(size, offsetAlignment));
- return f(reservation);
+ DAWN_TRY(f(reservation));
+ return OnStagingMemoryFreePendingOnSubmit(size);
}
+ // Notifies the dynamic uploader that some freeing of memory is associated with the pending
+ // submit. The dynamic uploader may take some action in this case, like forcing an early submit.
+ MaybeError OnStagingMemoryFreePendingOnSubmit(uint64_t size);
+
void Deallocate(ExecutionSerial lastCompletedSerial, bool freeAll = false);
- bool ShouldFlush() const;
-
private:
- static constexpr uint64_t kRingBufferSize = 4 * 1024 * 1024;
- uint64_t GetTotalAllocatedSize() const;
+ ResultOrError<UploadReservation> Reserve(uint64_t size, uint64_t offsetAlignment);
struct RingBuffer {
Ref<BufferBase> mStagingBuffer;
RingBufferAllocator mAllocator;
};
-
- ResultOrError<UploadReservation> Reserve(uint64_t size, uint64_t offsetAlignment);
-
std::vector<std::unique_ptr<RingBuffer>> mRingBuffers;
+
+ // Serial used to track when a serial has been scheduled and the corresponding pending memory
+ // will be freed in finite time.
+ ExecutionSerial mLastPendingSerialSeen = kBeginningOfGPUTime;
+ uint64_t mMemoryPendingSubmit = 0;
raw_ptr<DeviceBase> mDevice;
};
} // namespace dawn::native
diff --git a/src/dawn/native/ExecutionQueue.cpp b/src/dawn/native/ExecutionQueue.cpp
index 1359724..f131ff2 100644
--- a/src/dawn/native/ExecutionQueue.cpp
+++ b/src/dawn/native/ExecutionQueue.cpp
@@ -96,6 +96,18 @@
return {};
}
+MaybeError ExecutionQueueBase::SubmitPendingCommands() {
+ if (mInSubmit) {
+ return {};
+ }
+
+ mInSubmit = true;
+ auto result = SubmitPendingCommandsImpl();
+ mInSubmit = false;
+
+ return result;
+}
+
void ExecutionQueueBase::AssumeCommandsComplete() {
// Bump serials so any pending callbacks can be fired.
// TODO(crbug.com/dawn/831): This is called during device destroy, which is not
diff --git a/src/dawn/native/ExecutionQueue.h b/src/dawn/native/ExecutionQueue.h
index 256a306..13692f9 100644
--- a/src/dawn/native/ExecutionQueue.h
+++ b/src/dawn/native/ExecutionQueue.h
@@ -68,6 +68,9 @@
// Ensures that all commands which were recorded are flushed upto the given serial.
MaybeError EnsureCommandsFlushed(ExecutionSerial serial);
+ // Submit any pending commands that are enqueued.
+ MaybeError SubmitPendingCommands();
+
// During shut down of device, some operations might have been started since the last submit
// and waiting on a serial that doesn't have a corresponding fence enqueued. Fake serials to
// make all commands look completed.
@@ -101,6 +104,14 @@
// TODO(crbug.com/421945313): This shouldn't need to be public once we fix lock ordering.
void UpdateCompletedSerial(ExecutionSerial completedSerial);
+ // Tracks whether we are in a submit to avoid submit reentrancy. Reentrancy could otherwise
+ // happen when allocating resources or staging memory during submission (for workarounds, or
+ // emulation) and the heuristics ask for an early submit to happen (which would cause a
+ // submit-in-submit and many issues).
+ // TODO(crbug.com/42240396): Move all handling of Submit(command buffers) in this class as well,
+ // at which point this member can be private.
+ bool mInSubmit = false;
+
private:
// Each backend should implement to check their passed fences if there are any and return a
// completed serial. Return 0 should indicate no fences to check.
@@ -118,7 +129,7 @@
virtual bool HasPendingCommands() const = 0;
// Submit any pending commands that are enqueued.
- virtual MaybeError SubmitPendingCommands() = 0;
+ virtual MaybeError SubmitPendingCommandsImpl() = 0;
};
} // namespace dawn::native
diff --git a/src/dawn/native/Queue.cpp b/src/dawn/native/Queue.cpp
index acd0f4d..0d7066e 100644
--- a/src/dawn/native/Queue.cpp
+++ b/src/dawn/native/Queue.cpp
@@ -110,7 +110,7 @@
DAWN_UNREACHABLE();
}
bool HasPendingCommands() const override { DAWN_UNREACHABLE(); }
- MaybeError SubmitPendingCommands() override { DAWN_UNREACHABLE(); }
+ MaybeError SubmitPendingCommandsImpl() override { DAWN_UNREACHABLE(); }
ResultOrError<ExecutionSerial> CheckAndUpdateCompletedSerials() override { DAWN_UNREACHABLE(); }
void ForceEventualFlushOfCommands() override { DAWN_UNREACHABLE(); }
ResultOrError<bool> WaitForQueueSerial(ExecutionSerial serial, Nanoseconds timeout) override {
@@ -586,7 +586,9 @@
}
DAWN_ASSERT(!IsError());
+ mInSubmit = true;
DAWN_TRY(SubmitImpl(commandCount, commands));
+ mInSubmit = false;
// Call Tick() to flush pending work.
DAWN_TRY(device->Tick());
diff --git a/src/dawn/native/d3d11/DeviceD3D11.cpp b/src/dawn/native/d3d11/DeviceD3D11.cpp
index b8e74e5..1a743d1 100644
--- a/src/dawn/native/d3d11/DeviceD3D11.cpp
+++ b/src/dawn/native/d3d11/DeviceD3D11.cpp
@@ -366,11 +366,11 @@
}
}
-MaybeError Device::CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) {
+MaybeError Device::CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) {
// D3D11 requires that buffers are unmapped before being used in a copy.
DAWN_TRY(source->Unmap());
diff --git a/src/dawn/native/d3d11/DeviceD3D11.h b/src/dawn/native/d3d11/DeviceD3D11.h
index e66cc97..1848e8d 100644
--- a/src/dawn/native/d3d11/DeviceD3D11.h
+++ b/src/dawn/native/d3d11/DeviceD3D11.h
@@ -62,11 +62,11 @@
CommandEncoder* encoder,
const CommandBufferDescriptor* descriptor) override;
MaybeError TickImpl() override;
- MaybeError CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) override;
+ MaybeError CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) override;
MaybeError CopyFromStagingToTextureImpl(const BufferBase* source,
const TexelCopyBufferLayout& src,
const TextureCopy& dst,
diff --git a/src/dawn/native/d3d11/QueueD3D11.cpp b/src/dawn/native/d3d11/QueueD3D11.cpp
index 3b7323e..abe671d 100644
--- a/src/dawn/native/d3d11/QueueD3D11.cpp
+++ b/src/dawn/native/d3d11/QueueD3D11.cpp
@@ -280,7 +280,7 @@
});
}
-MaybeError Queue::SubmitPendingCommands() {
+MaybeError Queue::SubmitPendingCommandsImpl() {
bool needsSubmit = mPendingCommands.Use([&](auto pendingCommands) {
pendingCommands->ReleaseKeyedMutexes();
return mPendingCommandsNeedSubmit.exchange(false, std::memory_order_acq_rel);
@@ -304,7 +304,7 @@
DAWN_TRY(ToBackend(commands[i])->Execute(&commandContext));
}
}
- DAWN_TRY(SubmitPendingCommands());
+ DAWN_TRY(SubmitPendingCommandsImpl());
TRACE_EVENT_END0(GetDevice()->GetPlatform(), Recording, "CommandBufferD3D11::Execute");
return {};
diff --git a/src/dawn/native/d3d11/QueueD3D11.h b/src/dawn/native/d3d11/QueueD3D11.h
index 40eef29..10e909f 100644
--- a/src/dawn/native/d3d11/QueueD3D11.h
+++ b/src/dawn/native/d3d11/QueueD3D11.h
@@ -46,7 +46,6 @@
ScopedCommandRecordingContext GetScopedPendingCommandContext(SubmitMode submitMode);
ScopedSwapStateCommandRecordingContext GetScopedSwapStatePendingCommandContext(
SubmitMode submitMode);
- MaybeError SubmitPendingCommands() override;
virtual MaybeError NextSerial() = 0;
// Separated from creation because it creates resources, which is not valid before the
@@ -83,6 +82,7 @@
bool HasPendingCommands() const override;
void ForceEventualFlushOfCommands() override;
MaybeError WaitForIdleForDestruction() override;
+ MaybeError SubmitPendingCommandsImpl() override;
ResultOrError<Ref<d3d::SharedFence>> GetOrCreateSharedFence() override;
diff --git a/src/dawn/native/d3d12/DeviceD3D12.cpp b/src/dawn/native/d3d12/DeviceD3D12.cpp
index 320a49e..4396c0f 100644
--- a/src/dawn/native/d3d12/DeviceD3D12.cpp
+++ b/src/dawn/native/d3d12/DeviceD3D12.cpp
@@ -482,11 +482,11 @@
}
}
-MaybeError Device::CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) {
+MaybeError Device::CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) {
CommandRecordingContext* commandRecordingContext =
ToBackend(GetQueue())->GetPendingCommandContext(QueueBase::SubmitMode::Passive);
diff --git a/src/dawn/native/d3d12/DeviceD3D12.h b/src/dawn/native/d3d12/DeviceD3D12.h
index 9a4d7f3..fc6c7c4 100644
--- a/src/dawn/native/d3d12/DeviceD3D12.h
+++ b/src/dawn/native/d3d12/DeviceD3D12.h
@@ -94,11 +94,11 @@
void ReferenceUntilUnused(ComPtr<IUnknown> object);
- MaybeError CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) override;
+ MaybeError CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) override;
void CopyFromStagingToBufferHelper(CommandRecordingContext* commandContext,
BufferBase* source,
diff --git a/src/dawn/native/d3d12/QueueD3D12.cpp b/src/dawn/native/d3d12/QueueD3D12.cpp
index ea79ce3..2c6d610 100644
--- a/src/dawn/native/d3d12/QueueD3D12.cpp
+++ b/src/dawn/native/d3d12/QueueD3D12.cpp
@@ -119,10 +119,10 @@
TRACE_EVENT_END1(GetDevice()->GetPlatform(), Recording, "CommandBufferD3D12::RecordCommands",
"serial", uint64_t(pendingSerial));
- return SubmitPendingCommands();
+ return SubmitPendingCommandsImpl();
}
-MaybeError Queue::SubmitPendingCommands() {
+MaybeError Queue::SubmitPendingCommandsImpl() {
Device* device = ToBackend(GetDevice());
DAWN_ASSERT(device->IsLockedByCurrentThreadIfNeeded());
diff --git a/src/dawn/native/d3d12/QueueD3D12.h b/src/dawn/native/d3d12/QueueD3D12.h
index 8705ed1..261180d 100644
--- a/src/dawn/native/d3d12/QueueD3D12.h
+++ b/src/dawn/native/d3d12/QueueD3D12.h
@@ -54,7 +54,6 @@
ID3D12CommandQueue* GetCommandQueue() const;
ResultOrError<Ref<d3d::SharedFence>> GetOrCreateSharedFence() override;
ID3D12SharingContract* GetSharingContract() const;
- MaybeError SubmitPendingCommands() override;
private:
using d3d::Queue::Queue;
@@ -63,6 +62,7 @@
MaybeError Initialize();
void DestroyImpl() override;
+ MaybeError SubmitPendingCommandsImpl() override;
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
bool HasPendingCommands() const override;
ResultOrError<ExecutionSerial> CheckAndUpdateCompletedSerials() override;
diff --git a/src/dawn/native/metal/DeviceMTL.h b/src/dawn/native/metal/DeviceMTL.h
index ba85a5f..556b80c 100644
--- a/src/dawn/native/metal/DeviceMTL.h
+++ b/src/dawn/native/metal/DeviceMTL.h
@@ -63,11 +63,11 @@
id<MTLDevice> GetMTLDevice() const;
- MaybeError CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) override;
+ MaybeError CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) override;
MaybeError CopyFromStagingToTextureImpl(const BufferBase* source,
const TexelCopyBufferLayout& dataLayout,
const TextureCopy& dst,
diff --git a/src/dawn/native/metal/DeviceMTL.mm b/src/dawn/native/metal/DeviceMTL.mm
index 4d259c8..935ac58 100644
--- a/src/dawn/native/metal/DeviceMTL.mm
+++ b/src/dawn/native/metal/DeviceMTL.mm
@@ -320,11 +320,11 @@
return mMtlDevice.Get();
}
-MaybeError Device::CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) {
+MaybeError Device::CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) {
// Metal validation layers forbid 0-sized copies, assert it is skipped prior to calling
// this function.
DAWN_ASSERT(size != 0);
diff --git a/src/dawn/native/metal/QueueMTL.h b/src/dawn/native/metal/QueueMTL.h
index 1e03df3..17ee414 100644
--- a/src/dawn/native/metal/QueueMTL.h
+++ b/src/dawn/native/metal/QueueMTL.h
@@ -65,7 +65,7 @@
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
bool HasPendingCommands() const override;
- MaybeError SubmitPendingCommands() override;
+ MaybeError SubmitPendingCommandsImpl() override;
ResultOrError<ExecutionSerial> CheckAndUpdateCompletedSerials() override;
void ForceEventualFlushOfCommands() override;
MaybeError WaitForIdleForDestruction() override;
diff --git a/src/dawn/native/metal/QueueMTL.mm b/src/dawn/native/metal/QueueMTL.mm
index b51248a..a2be82e 100644
--- a/src/dawn/native/metal/QueueMTL.mm
+++ b/src/dawn/native/metal/QueueMTL.mm
@@ -224,7 +224,7 @@
return mCommandContext.NeedsSubmit();
}
-MaybeError Queue::SubmitPendingCommands() {
+MaybeError Queue::SubmitPendingCommandsImpl() {
return SubmitPendingCommandBuffer();
}
diff --git a/src/dawn/native/null/DeviceNull.cpp b/src/dawn/native/null/DeviceNull.cpp
index 08bbc35..e089c8f 100644
--- a/src/dawn/native/null/DeviceNull.cpp
+++ b/src/dawn/native/null/DeviceNull.cpp
@@ -276,11 +276,11 @@
mPendingOperations.clear();
}
-MaybeError Device::CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) {
+MaybeError Device::CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) {
if (IsToggleEnabled(Toggle::LazyClearResourceOnFirstUse)) {
destination->SetInitialized(true);
}
@@ -461,7 +461,7 @@
return false;
}
-MaybeError Queue::SubmitPendingCommands() {
+MaybeError Queue::SubmitPendingCommandsImpl() {
return {};
}
diff --git a/src/dawn/native/null/DeviceNull.h b/src/dawn/native/null/DeviceNull.h
index 6c5f623..482b6df 100644
--- a/src/dawn/native/null/DeviceNull.h
+++ b/src/dawn/native/null/DeviceNull.h
@@ -120,11 +120,11 @@
MaybeError SubmitPendingOperations();
void ForgetPendingOperations();
- MaybeError CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) override;
+ MaybeError CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) override;
MaybeError CopyFromStagingToTextureImpl(const BufferBase* source,
const TexelCopyBufferLayout& src,
const TextureCopy& dst,
@@ -299,7 +299,7 @@
ResultOrError<ExecutionSerial> CheckAndUpdateCompletedSerials() override;
void ForceEventualFlushOfCommands() override;
bool HasPendingCommands() const override;
- MaybeError SubmitPendingCommands() override;
+ MaybeError SubmitPendingCommandsImpl() override;
ResultOrError<bool> WaitForQueueSerial(ExecutionSerial serial, Nanoseconds timeout) override;
MaybeError WaitForIdleForDestruction() override;
};
diff --git a/src/dawn/native/opengl/DeviceGL.cpp b/src/dawn/native/opengl/DeviceGL.cpp
index 063c513..86e46ab 100644
--- a/src/dawn/native/opengl/DeviceGL.cpp
+++ b/src/dawn/native/opengl/DeviceGL.cpp
@@ -468,11 +468,11 @@
return {};
}
-MaybeError Device::CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) {
+MaybeError Device::CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) {
return DAWN_UNIMPLEMENTED_ERROR("Device unable to copy from staging buffer.");
}
diff --git a/src/dawn/native/opengl/DeviceGL.h b/src/dawn/native/opengl/DeviceGL.h
index 1f03412..272a04c 100644
--- a/src/dawn/native/opengl/DeviceGL.h
+++ b/src/dawn/native/opengl/DeviceGL.h
@@ -86,11 +86,11 @@
MaybeError TickImpl() override;
- MaybeError CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) override;
+ MaybeError CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) override;
MaybeError CopyFromStagingToTextureImpl(const BufferBase* source,
const TexelCopyBufferLayout& src,
diff --git a/src/dawn/native/opengl/QueueGL.cpp b/src/dawn/native/opengl/QueueGL.cpp
index 34bf589..68fcd29 100644
--- a/src/dawn/native/opengl/QueueGL.cpp
+++ b/src/dawn/native/opengl/QueueGL.cpp
@@ -275,7 +275,7 @@
return mHasPendingCommands;
}
-MaybeError Queue::SubmitPendingCommands() {
+MaybeError Queue::SubmitPendingCommandsImpl() {
DAWN_TRY(SubmitFenceSync());
return {};
}
diff --git a/src/dawn/native/opengl/QueueGL.h b/src/dawn/native/opengl/QueueGL.h
index 7b70205..80c93a7 100644
--- a/src/dawn/native/opengl/QueueGL.h
+++ b/src/dawn/native/opengl/QueueGL.h
@@ -69,7 +69,7 @@
ResultOrError<bool> WaitForQueueSerial(ExecutionSerial serial, Nanoseconds timeout) override;
bool HasPendingCommands() const override;
- MaybeError SubmitPendingCommands() override;
+ MaybeError SubmitPendingCommandsImpl() override;
ResultOrError<ExecutionSerial> CheckAndUpdateCompletedSerials() override;
void ForceEventualFlushOfCommands() override;
MaybeError WaitForIdleForDestruction() override;
diff --git a/src/dawn/native/vulkan/DeviceVk.cpp b/src/dawn/native/vulkan/DeviceVk.cpp
index 78b321b..8c5d02c 100644
--- a/src/dawn/native/vulkan/DeviceVk.cpp
+++ b/src/dawn/native/vulkan/DeviceVk.cpp
@@ -647,11 +647,11 @@
return const_cast<VulkanFunctions*>(&fn);
}
-MaybeError Device::CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) {
+MaybeError Device::CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) {
// It is a validation error to do a 0-sized copy in Vulkan, check it is skipped prior to
// calling this function.
DAWN_ASSERT(size != 0);
diff --git a/src/dawn/native/vulkan/DeviceVk.h b/src/dawn/native/vulkan/DeviceVk.h
index 65df853..547e362 100644
--- a/src/dawn/native/vulkan/DeviceVk.h
+++ b/src/dawn/native/vulkan/DeviceVk.h
@@ -99,11 +99,11 @@
MaybeError TickImpl() override;
- MaybeError CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) override;
+ MaybeError CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) override;
MaybeError CopyFromStagingToTextureImpl(const BufferBase* source,
const TexelCopyBufferLayout& src,
const TextureCopy& dst,
diff --git a/src/dawn/native/vulkan/QueueVk.cpp b/src/dawn/native/vulkan/QueueVk.cpp
index 34082be..225426c 100644
--- a/src/dawn/native/vulkan/QueueVk.cpp
+++ b/src/dawn/native/vulkan/QueueVk.cpp
@@ -103,7 +103,7 @@
}
TRACE_EVENT_END0(GetDevice()->GetPlatform(), Recording, "CommandBufferVk::RecordCommands");
- DAWN_TRY(SubmitPendingCommands());
+ DAWN_TRY(SubmitPendingCommandsImpl());
return {};
}
@@ -318,7 +318,7 @@
mCommandsInFlight.ClearUpTo(completedSerial);
}
-MaybeError Queue::SubmitPendingCommands() {
+MaybeError Queue::SubmitPendingCommandsImpl() {
if (!mRecordingContext.needsSubmit) {
return {};
}
diff --git a/src/dawn/native/vulkan/QueueVk.h b/src/dawn/native/vulkan/QueueVk.h
index 8d9033e..e947ae3 100644
--- a/src/dawn/native/vulkan/QueueVk.h
+++ b/src/dawn/native/vulkan/QueueVk.h
@@ -52,8 +52,6 @@
CommandRecordingContext* GetPendingRecordingContext(SubmitMode submitMode = SubmitMode::Normal);
MaybeError SplitRecordingContext(CommandRecordingContext* recordingContext);
- MaybeError SubmitPendingCommands() override;
-
void RecycleCompletedCommands(ExecutionSerial completedSerial);
ResultOrError<bool> WaitForQueueSerial(ExecutionSerial serial, Nanoseconds timeout) override;
@@ -70,6 +68,7 @@
ResultOrError<ExecutionSerial> CheckAndUpdateCompletedSerials() override;
void ForceEventualFlushOfCommands() override;
MaybeError WaitForIdleForDestruction() override;
+ MaybeError SubmitPendingCommandsImpl() override;
void DestroyImpl() override;
// Dawn API
diff --git a/src/dawn/native/webgpu/DeviceWGPU.cpp b/src/dawn/native/webgpu/DeviceWGPU.cpp
index 6fe43f4..259592c 100644
--- a/src/dawn/native/webgpu/DeviceWGPU.cpp
+++ b/src/dawn/native/webgpu/DeviceWGPU.cpp
@@ -210,11 +210,11 @@
}
}
-MaybeError Device::CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) {
+MaybeError Device::CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) {
return DAWN_UNIMPLEMENTED_ERROR("webgpu::Device implementation is incomplete.");
}
diff --git a/src/dawn/native/webgpu/DeviceWGPU.h b/src/dawn/native/webgpu/DeviceWGPU.h
index bb8c3fd..7cf1485 100644
--- a/src/dawn/native/webgpu/DeviceWGPU.h
+++ b/src/dawn/native/webgpu/DeviceWGPU.h
@@ -101,11 +101,11 @@
MaybeError TickImpl() override;
- MaybeError CopyFromStagingToBufferImpl(BufferBase* source,
- uint64_t sourceOffset,
- BufferBase* destination,
- uint64_t destinationOffset,
- uint64_t size) override;
+ MaybeError CopyFromStagingToBuffer(BufferBase* source,
+ uint64_t sourceOffset,
+ BufferBase* destination,
+ uint64_t destinationOffset,
+ uint64_t size) override;
MaybeError CopyFromStagingToTextureImpl(const BufferBase* source,
const TexelCopyBufferLayout& src,
const TextureCopy& dst,
diff --git a/src/dawn/native/webgpu/QueueWGPU.cpp b/src/dawn/native/webgpu/QueueWGPU.cpp
index 691a96c..973af67 100644
--- a/src/dawn/native/webgpu/QueueWGPU.cpp
+++ b/src/dawn/native/webgpu/QueueWGPU.cpp
@@ -96,7 +96,7 @@
return false;
}
-MaybeError Queue::SubmitPendingCommands() {
+MaybeError Queue::SubmitPendingCommandsImpl() {
return {};
}
diff --git a/src/dawn/native/webgpu/QueueWGPU.h b/src/dawn/native/webgpu/QueueWGPU.h
index 27b9786..8ca5ec9 100644
--- a/src/dawn/native/webgpu/QueueWGPU.h
+++ b/src/dawn/native/webgpu/QueueWGPU.h
@@ -51,7 +51,7 @@
ResultOrError<ExecutionSerial> CheckAndUpdateCompletedSerials() override;
void ForceEventualFlushOfCommands() override;
bool HasPendingCommands() const override;
- MaybeError SubmitPendingCommands() override;
+ MaybeError SubmitPendingCommandsImpl() override;
ResultOrError<bool> WaitForQueueSerial(ExecutionSerial serial, Nanoseconds timeout) override;
MaybeError WaitForIdleForDestruction() override;
diff --git a/src/dawn/tests/unittests/native/mocks/DeviceMock.h b/src/dawn/tests/unittests/native/mocks/DeviceMock.h
index a0689d6..a7a30b1 100644
--- a/src/dawn/tests/unittests/native/mocks/DeviceMock.h
+++ b/src/dawn/tests/unittests/native/mocks/DeviceMock.h
@@ -64,7 +64,7 @@
(override));
MOCK_METHOD(MaybeError,
- CopyFromStagingToBufferImpl,
+ CopyFromStagingToBuffer,
(BufferBase*, uint64_t, BufferBase*, uint64_t, uint64_t),
(override));
MOCK_METHOD(
diff --git a/src/dawn/tests/unittests/native/mocks/QueueMock.h b/src/dawn/tests/unittests/native/mocks/QueueMock.h
index 3d961c0..466ae74 100644
--- a/src/dawn/tests/unittests/native/mocks/QueueMock.h
+++ b/src/dawn/tests/unittests/native/mocks/QueueMock.h
@@ -58,7 +58,7 @@
MOCK_METHOD(ResultOrError<ExecutionSerial>, CheckAndUpdateCompletedSerials, (), (override));
MOCK_METHOD(bool, HasPendingCommands, (), (const, override));
- MOCK_METHOD(MaybeError, SubmitPendingCommands, (), (override));
+ MOCK_METHOD(MaybeError, SubmitPendingCommandsImpl, (), (override));
MOCK_METHOD(void, ForceEventualFlushOfCommands, (), (override));
MOCK_METHOD(MaybeError, WaitForIdleForDestruction, (), (override));
MOCK_METHOD(ResultOrError<bool>,