[chromium-style] Adding/moving constructors and destructors.
This CL adds missing constructors and destructors. Others are moved
from the header file to implementation files.
Bug: dawn:1405
Change-Id: I06657d4a4faa437ca5a95a0067a8f9f9bbc89d12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89181
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/native/AsyncTask.cpp b/src/dawn/native/AsyncTask.cpp
index 00e6a64..2f0face 100644
--- a/src/dawn/native/AsyncTask.cpp
+++ b/src/dawn/native/AsyncTask.cpp
@@ -77,4 +77,8 @@
waitableTask->taskManager->HandleTaskCompletion(waitableTask.Get());
}
+AsyncTaskManager::WaitableTask::WaitableTask() = default;
+
+AsyncTaskManager::WaitableTask::~WaitableTask() = default;
+
} // namespace dawn::native
diff --git a/src/dawn/native/AsyncTask.h b/src/dawn/native/AsyncTask.h
index d2c28fa..e1d130e 100644
--- a/src/dawn/native/AsyncTask.h
+++ b/src/dawn/native/AsyncTask.h
@@ -47,6 +47,9 @@
private:
class WaitableTask : public RefCounted {
public:
+ WaitableTask();
+ ~WaitableTask();
+
AsyncTask asyncTask;
AsyncTaskManager* taskManager;
std::unique_ptr<dawn::platform::WaitableEvent> waitableEvent;
diff --git a/src/dawn/native/BlobCache.cpp b/src/dawn/native/BlobCache.cpp
index 9ec4750..878ded6 100644
--- a/src/dawn/native/BlobCache.cpp
+++ b/src/dawn/native/BlobCache.cpp
@@ -27,6 +27,12 @@
}
}
+CachedBlob::CachedBlob(CachedBlob&&) = default;
+
+CachedBlob::~CachedBlob() = default;
+
+CachedBlob& CachedBlob::operator=(CachedBlob&&) = default;
+
bool CachedBlob::Empty() const {
return mSize == 0;
}
diff --git a/src/dawn/native/BlobCache.h b/src/dawn/native/BlobCache.h
index 8565429..b1c0a63 100644
--- a/src/dawn/native/BlobCache.h
+++ b/src/dawn/native/BlobCache.h
@@ -31,6 +31,10 @@
class CachedBlob {
public:
explicit CachedBlob(size_t size = 0);
+ CachedBlob(CachedBlob&&);
+ ~CachedBlob();
+
+ CachedBlob& operator=(CachedBlob&&);
bool Empty() const;
const uint8_t* Data() const;
diff --git a/src/dawn/native/BuddyMemoryAllocator.cpp b/src/dawn/native/BuddyMemoryAllocator.cpp
index d21ecf1..f744440 100644
--- a/src/dawn/native/BuddyMemoryAllocator.cpp
+++ b/src/dawn/native/BuddyMemoryAllocator.cpp
@@ -34,6 +34,8 @@
mTrackedSubAllocations.resize(maxSystemSize / mMemoryBlockSize);
}
+BuddyMemoryAllocator::~BuddyMemoryAllocator() = default;
+
uint64_t BuddyMemoryAllocator::GetMemoryIndex(uint64_t offset) const {
ASSERT(offset != BuddyAllocator::kInvalidOffset);
return offset / mMemoryBlockSize;
diff --git a/src/dawn/native/BuddyMemoryAllocator.h b/src/dawn/native/BuddyMemoryAllocator.h
index a58cbae..adbcc96 100644
--- a/src/dawn/native/BuddyMemoryAllocator.h
+++ b/src/dawn/native/BuddyMemoryAllocator.h
@@ -42,7 +42,7 @@
BuddyMemoryAllocator(uint64_t maxSystemSize,
uint64_t memoryBlockSize,
ResourceHeapAllocator* heapAllocator);
- ~BuddyMemoryAllocator() = default;
+ ~BuddyMemoryAllocator();
ResultOrError<ResourceMemoryAllocation> Allocate(uint64_t allocationSize, uint64_t alignment);
void Deallocate(const ResourceMemoryAllocation& allocation);
diff --git a/src/dawn/native/CallbackTaskManager.cpp b/src/dawn/native/CallbackTaskManager.cpp
index 40146f8..51a9b86 100644
--- a/src/dawn/native/CallbackTaskManager.cpp
+++ b/src/dawn/native/CallbackTaskManager.cpp
@@ -18,6 +18,10 @@
namespace dawn::native {
+CallbackTaskManager::CallbackTaskManager() = default;
+
+CallbackTaskManager::~CallbackTaskManager() = default;
+
bool CallbackTaskManager::IsEmpty() {
std::lock_guard<std::mutex> lock(mCallbackTaskQueueMutex);
return mCallbackTaskQueue.empty();
diff --git a/src/dawn/native/CallbackTaskManager.h b/src/dawn/native/CallbackTaskManager.h
index 479ba01..aceea0a 100644
--- a/src/dawn/native/CallbackTaskManager.h
+++ b/src/dawn/native/CallbackTaskManager.h
@@ -31,6 +31,9 @@
class CallbackTaskManager {
public:
+ CallbackTaskManager();
+ ~CallbackTaskManager();
+
void AddCallbackTask(std::unique_ptr<CallbackTask> callbackTask);
bool IsEmpty();
std::vector<std::unique_ptr<CallbackTask>> AcquireCallbackTasks();
diff --git a/src/dawn/native/CreatePipelineAsyncTask.cpp b/src/dawn/native/CreatePipelineAsyncTask.cpp
index 9ecd048..e7319ab 100644
--- a/src/dawn/native/CreatePipelineAsyncTask.cpp
+++ b/src/dawn/native/CreatePipelineAsyncTask.cpp
@@ -30,6 +30,8 @@
void* userdata)
: mErrorMessage(errorMessage), mUserData(userdata) {}
+CreatePipelineAsyncCallbackTaskBase::~CreatePipelineAsyncCallbackTaskBase() = default;
+
CreateComputePipelineAsyncCallbackTask::CreateComputePipelineAsyncCallbackTask(
Ref<ComputePipelineBase> pipeline,
std::string errorMessage,
@@ -39,6 +41,8 @@
mPipeline(std::move(pipeline)),
mCreateComputePipelineAsyncCallback(callback) {}
+CreateComputePipelineAsyncCallbackTask::~CreateComputePipelineAsyncCallbackTask() = default;
+
void CreateComputePipelineAsyncCallbackTask::Finish() {
ASSERT(mCreateComputePipelineAsyncCallback != nullptr);
@@ -74,6 +78,8 @@
mPipeline(std::move(pipeline)),
mCreateRenderPipelineAsyncCallback(callback) {}
+CreateRenderPipelineAsyncCallbackTask::~CreateRenderPipelineAsyncCallbackTask() = default;
+
void CreateRenderPipelineAsyncCallbackTask::Finish() {
ASSERT(mCreateRenderPipelineAsyncCallback != nullptr);
@@ -110,6 +116,8 @@
ASSERT(mComputePipeline != nullptr);
}
+CreateComputePipelineAsyncTask::~CreateComputePipelineAsyncTask() = default;
+
void CreateComputePipelineAsyncTask::Run() {
const char* eventLabel = utils::GetLabelForTrace(mComputePipeline->GetLabel().c_str());
@@ -160,6 +168,8 @@
ASSERT(mRenderPipeline != nullptr);
}
+CreateRenderPipelineAsyncTask::~CreateRenderPipelineAsyncTask() = default;
+
void CreateRenderPipelineAsyncTask::Run() {
const char* eventLabel = utils::GetLabelForTrace(mRenderPipeline->GetLabel().c_str());
diff --git a/src/dawn/native/CreatePipelineAsyncTask.h b/src/dawn/native/CreatePipelineAsyncTask.h
index cd98154..7b9e614 100644
--- a/src/dawn/native/CreatePipelineAsyncTask.h
+++ b/src/dawn/native/CreatePipelineAsyncTask.h
@@ -34,6 +34,7 @@
struct CreatePipelineAsyncCallbackTaskBase : CallbackTask {
CreatePipelineAsyncCallbackTaskBase(std::string errorMessage, void* userData);
+ ~CreatePipelineAsyncCallbackTaskBase();
protected:
std::string mErrorMessage;
@@ -45,6 +46,7 @@
std::string errorMessage,
WGPUCreateComputePipelineAsyncCallback callback,
void* userdata);
+ ~CreateComputePipelineAsyncCallbackTask() override;
void Finish() override;
void HandleShutDown() final;
@@ -60,6 +62,7 @@
std::string errorMessage,
WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata);
+ ~CreateRenderPipelineAsyncCallbackTask() override;
void Finish() override;
void HandleShutDown() final;
@@ -77,6 +80,7 @@
CreateComputePipelineAsyncTask(Ref<ComputePipelineBase> nonInitializedComputePipeline,
WGPUCreateComputePipelineAsyncCallback callback,
void* userdata);
+ ~CreateComputePipelineAsyncTask();
void Run();
@@ -95,6 +99,7 @@
CreateRenderPipelineAsyncTask(Ref<RenderPipelineBase> nonInitializedRenderPipeline,
WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata);
+ ~CreateRenderPipelineAsyncTask();
void Run();
diff --git a/src/dawn/native/ErrorScope.cpp b/src/dawn/native/ErrorScope.cpp
index fe40d2d..b90fb13 100644
--- a/src/dawn/native/ErrorScope.cpp
+++ b/src/dawn/native/ErrorScope.cpp
@@ -45,6 +45,10 @@
return mErrorMessage.c_str();
}
+ErrorScopeStack::ErrorScopeStack() = default;
+
+ErrorScopeStack::~ErrorScopeStack() = default;
+
void ErrorScopeStack::Push(wgpu::ErrorFilter filter) {
mScopes.push_back(ErrorScope(filter));
}
diff --git a/src/dawn/native/ErrorScope.h b/src/dawn/native/ErrorScope.h
index 3ffb510..7901d18 100644
--- a/src/dawn/native/ErrorScope.h
+++ b/src/dawn/native/ErrorScope.h
@@ -38,6 +38,9 @@
class ErrorScopeStack {
public:
+ ErrorScopeStack();
+ ~ErrorScopeStack();
+
void Push(wgpu::ErrorFilter errorFilter);
ErrorScope Pop();
diff --git a/src/dawn/native/Features.cpp b/src/dawn/native/Features.cpp
index 5621b63..c33b4af 100644
--- a/src/dawn/native/Features.cpp
+++ b/src/dawn/native/Features.cpp
@@ -232,6 +232,8 @@
}
}
+FeaturesInfo::~FeaturesInfo() = default;
+
const FeatureInfo* FeaturesInfo::GetFeatureInfo(wgpu::FeatureName feature) const {
Feature f = FromAPIFeature(feature);
if (f == Feature::InvalidEnum) {
diff --git a/src/dawn/native/Features.h b/src/dawn/native/Features.h
index bb1f015..c2439b2 100644
--- a/src/dawn/native/Features.h
+++ b/src/dawn/native/Features.h
@@ -68,6 +68,7 @@
class FeaturesInfo {
public:
FeaturesInfo();
+ ~FeaturesInfo();
// Used to query the details of an feature. Return nullptr if featureName is not a valid
// name of an feature supported in Dawn
diff --git a/src/dawn/native/Instance.cpp b/src/dawn/native/Instance.cpp
index 34436b2..1e25a3b 100644
--- a/src/dawn/native/Instance.cpp
+++ b/src/dawn/native/Instance.cpp
@@ -122,6 +122,10 @@
return instance;
}
+InstanceBase::InstanceBase() = default;
+
+InstanceBase::~InstanceBase() = default;
+
// TODO(crbug.com/dawn/832): make the platform an initialization parameter of the instance.
MaybeError InstanceBase::Initialize(const InstanceDescriptor* descriptor) {
DAWN_TRY(ValidateSingleSType(descriptor->nextInChain, wgpu::SType::DawnInstanceDescriptor));
diff --git a/src/dawn/native/Instance.h b/src/dawn/native/Instance.h
index 6f8f5d5..0f3cb18 100644
--- a/src/dawn/native/Instance.h
+++ b/src/dawn/native/Instance.h
@@ -93,8 +93,8 @@
Surface* APICreateSurface(const SurfaceDescriptor* descriptor);
private:
- InstanceBase() = default;
- ~InstanceBase() override = default;
+ InstanceBase();
+ ~InstanceBase() override;
InstanceBase(const InstanceBase& other) = delete;
InstanceBase& operator=(const InstanceBase& other) = delete;
diff --git a/src/dawn/native/PooledResourceMemoryAllocator.cpp b/src/dawn/native/PooledResourceMemoryAllocator.cpp
index 95bca8c..96b10c6 100644
--- a/src/dawn/native/PooledResourceMemoryAllocator.cpp
+++ b/src/dawn/native/PooledResourceMemoryAllocator.cpp
@@ -23,6 +23,8 @@
PooledResourceMemoryAllocator::PooledResourceMemoryAllocator(ResourceHeapAllocator* heapAllocator)
: mHeapAllocator(heapAllocator) {}
+PooledResourceMemoryAllocator::~PooledResourceMemoryAllocator() = default;
+
void PooledResourceMemoryAllocator::DestroyPool() {
for (auto& resourceHeap : mPool) {
ASSERT(resourceHeap != nullptr);
diff --git a/src/dawn/native/PooledResourceMemoryAllocator.h b/src/dawn/native/PooledResourceMemoryAllocator.h
index e75ad55..073ea26 100644
--- a/src/dawn/native/PooledResourceMemoryAllocator.h
+++ b/src/dawn/native/PooledResourceMemoryAllocator.h
@@ -32,7 +32,7 @@
class PooledResourceMemoryAllocator : public ResourceHeapAllocator {
public:
explicit PooledResourceMemoryAllocator(ResourceHeapAllocator* heapAllocator);
- ~PooledResourceMemoryAllocator() override = default;
+ ~PooledResourceMemoryAllocator() override;
ResultOrError<std::unique_ptr<ResourceHeapBase>> AllocateResourceHeap(uint64_t size) override;
void DeallocateResourceHeap(std::unique_ptr<ResourceHeapBase> allocation) override;
diff --git a/src/dawn/native/RingBufferAllocator.cpp b/src/dawn/native/RingBufferAllocator.cpp
index d384383..01e23e7 100644
--- a/src/dawn/native/RingBufferAllocator.cpp
+++ b/src/dawn/native/RingBufferAllocator.cpp
@@ -30,8 +30,16 @@
// used bytes.
namespace dawn::native {
+RingBufferAllocator::RingBufferAllocator() = default;
+
RingBufferAllocator::RingBufferAllocator(uint64_t maxSize) : mMaxBlockSize(maxSize) {}
+RingBufferAllocator::RingBufferAllocator(const RingBufferAllocator&) = default;
+
+RingBufferAllocator::~RingBufferAllocator() = default;
+
+RingBufferAllocator& RingBufferAllocator::operator=(const RingBufferAllocator&) = default;
+
void RingBufferAllocator::Deallocate(ExecutionSerial lastCompletedSerial) {
// Reclaim memory from previously recorded blocks.
for (Request& request : mInflightRequests.IterateUpTo(lastCompletedSerial)) {
diff --git a/src/dawn/native/RingBufferAllocator.h b/src/dawn/native/RingBufferAllocator.h
index cbb01b7..6aeb142 100644
--- a/src/dawn/native/RingBufferAllocator.h
+++ b/src/dawn/native/RingBufferAllocator.h
@@ -26,11 +26,12 @@
class RingBufferAllocator {
public:
- RingBufferAllocator() = default;
+ RingBufferAllocator();
explicit RingBufferAllocator(uint64_t maxSize);
- ~RingBufferAllocator() = default;
- RingBufferAllocator(const RingBufferAllocator&) = default;
- RingBufferAllocator& operator=(const RingBufferAllocator&) = default;
+ RingBufferAllocator(const RingBufferAllocator&);
+ ~RingBufferAllocator();
+
+ RingBufferAllocator& operator=(const RingBufferAllocator&);
uint64_t Allocate(uint64_t allocationSize, ExecutionSerial serial);
void Deallocate(ExecutionSerial lastCompletedSerial);
diff --git a/src/dawn/native/Toggles.cpp b/src/dawn/native/Toggles.cpp
index bc2fcbd..f98c94d 100644
--- a/src/dawn/native/Toggles.cpp
+++ b/src/dawn/native/Toggles.cpp
@@ -313,6 +313,10 @@
return toggleNameAndInfo.info.name;
}
+TogglesInfo::TogglesInfo() = default;
+
+TogglesInfo::~TogglesInfo() = default;
+
const ToggleInfo* TogglesInfo::GetToggleInfo(const char* toggleName) {
ASSERT(toggleName);
diff --git a/src/dawn/native/Toggles.h b/src/dawn/native/Toggles.h
index 2d8d286..341db79 100644
--- a/src/dawn/native/Toggles.h
+++ b/src/dawn/native/Toggles.h
@@ -91,6 +91,9 @@
class TogglesInfo {
public:
+ TogglesInfo();
+ ~TogglesInfo();
+
// Used to query the details of a toggle. Return nullptr if toggleName is not a valid name
// of a toggle supported in Dawn.
const ToggleInfo* GetToggleInfo(const char* toggleName);
diff --git a/src/dawn/native/metal/BackendMTL.h b/src/dawn/native/metal/BackendMTL.h
index fe6908f..75be730 100644
--- a/src/dawn/native/metal/BackendMTL.h
+++ b/src/dawn/native/metal/BackendMTL.h
@@ -24,6 +24,7 @@
class Backend : public BackendConnection {
public:
explicit Backend(InstanceBase* instance);
+ ~Backend() override;
std::vector<Ref<AdapterBase>> DiscoverDefaultAdapters() override;
ResultOrError<std::vector<Ref<AdapterBase>>> DiscoverAdapters(
diff --git a/src/dawn/native/metal/BackendMTL.mm b/src/dawn/native/metal/BackendMTL.mm
index 2545e11..11430de 100644
--- a/src/dawn/native/metal/BackendMTL.mm
+++ b/src/dawn/native/metal/BackendMTL.mm
@@ -608,6 +608,8 @@
}
}
+Backend::~Backend() = default;
+
std::vector<Ref<AdapterBase>> Backend::DiscoverDefaultAdapters() {
AdapterDiscoveryOptions options;
auto result = DiscoverAdapters(&options);
diff --git a/src/dawn/native/metal/BindGroupLayoutMTL.h b/src/dawn/native/metal/BindGroupLayoutMTL.h
index 97688eb..ab2abef 100644
--- a/src/dawn/native/metal/BindGroupLayoutMTL.h
+++ b/src/dawn/native/metal/BindGroupLayoutMTL.h
@@ -36,7 +36,7 @@
BindGroupLayout(DeviceBase* device,
const BindGroupLayoutDescriptor* descriptor,
PipelineCompatibilityToken pipelineCompatibilityToken);
- ~BindGroupLayout() override = default;
+ ~BindGroupLayout() override;
SlabAllocator<BindGroup> mBindGroupAllocator;
};
diff --git a/src/dawn/native/metal/BindGroupLayoutMTL.mm b/src/dawn/native/metal/BindGroupLayoutMTL.mm
index 2f1012c..6c1a7ac 100644
--- a/src/dawn/native/metal/BindGroupLayoutMTL.mm
+++ b/src/dawn/native/metal/BindGroupLayoutMTL.mm
@@ -32,6 +32,8 @@
: BindGroupLayoutBase(device, descriptor, pipelineCompatibilityToken),
mBindGroupAllocator(MakeFrontendBindGroupAllocator<BindGroup>(4096)) {}
+BindGroupLayout::~BindGroupLayout() = default;
+
Ref<BindGroup> BindGroupLayout::AllocateBindGroup(Device* device,
const BindGroupDescriptor* descriptor) {
return AcquireRef(mBindGroupAllocator.Allocate(device, descriptor));
diff --git a/src/dawn/native/metal/BufferMTL.h b/src/dawn/native/metal/BufferMTL.h
index 096237b..f36ebe8 100644
--- a/src/dawn/native/metal/BufferMTL.h
+++ b/src/dawn/native/metal/BufferMTL.h
@@ -29,6 +29,9 @@
class Buffer final : public BufferBase {
public:
static ResultOrError<Ref<Buffer>> Create(Device* device, const BufferDescriptor* descriptor);
+
+ Buffer(DeviceBase* device, const BufferDescriptor* descriptor);
+
id<MTLBuffer> GetMTLBuffer() const;
bool EnsureDataInitialized(CommandRecordingContext* commandContext);
@@ -45,6 +48,7 @@
MaybeError Initialize(bool mappedAtCreation);
~Buffer() override;
+
MaybeError MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) override;
void UnmapImpl() override;
void DestroyImpl() override;
diff --git a/src/dawn/native/metal/BufferMTL.mm b/src/dawn/native/metal/BufferMTL.mm
index e8d74c1..8f703ef 100644
--- a/src/dawn/native/metal/BufferMTL.mm
+++ b/src/dawn/native/metal/BufferMTL.mm
@@ -59,6 +59,8 @@
#endif
}
+Buffer::Buffer(DeviceBase* dev, const BufferDescriptor* desc) : BufferBase(dev, desc) {}
+
MaybeError Buffer::Initialize(bool mappedAtCreation) {
MTLResourceOptions storageMode;
if (GetUsage() & kMappableBufferUsages) {
diff --git a/src/dawn/native/metal/CommandBufferMTL.h b/src/dawn/native/metal/CommandBufferMTL.h
index 8f7a983..8f0c02b 100644
--- a/src/dawn/native/metal/CommandBufferMTL.h
+++ b/src/dawn/native/metal/CommandBufferMTL.h
@@ -47,6 +47,9 @@
static Ref<CommandBuffer> Create(CommandEncoder* encoder,
const CommandBufferDescriptor* descriptor);
+ CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor);
+ ~CommandBuffer();
+
MaybeError FillCommands(CommandRecordingContext* commandContext);
private:
diff --git a/src/dawn/native/metal/CommandBufferMTL.mm b/src/dawn/native/metal/CommandBufferMTL.mm
index 121198f..04dab40 100644
--- a/src/dawn/native/metal/CommandBufferMTL.mm
+++ b/src/dawn/native/metal/CommandBufferMTL.mm
@@ -577,6 +577,11 @@
return AcquireRef(new CommandBuffer(encoder, descriptor));
}
+CommandBuffer::CommandBuffer(CommandEncoder* enc, const CommandBufferDescriptor* desc)
+ : CommandBufferBase(enc, desc) {}
+
+CommandBuffer::~CommandBuffer() = default;
+
MaybeError CommandBuffer::FillCommands(CommandRecordingContext* commandContext) {
size_t nextComputePassNumber = 0;
size_t nextRenderPassNumber = 0;
diff --git a/src/dawn/native/metal/ComputePipelineMTL.h b/src/dawn/native/metal/ComputePipelineMTL.h
index 22ac635..48a723d 100644
--- a/src/dawn/native/metal/ComputePipelineMTL.h
+++ b/src/dawn/native/metal/ComputePipelineMTL.h
@@ -35,6 +35,9 @@
WGPUCreateComputePipelineAsyncCallback callback,
void* userdata);
+ ComputePipeline(DeviceBase* device, const ComputePipelineDescriptor* descriptor);
+ ~ComputePipeline() override;
+
void Encode(id<MTLComputeCommandEncoder> encoder);
MTLSize GetLocalWorkGroupSize() const;
bool RequiresStorageBufferLength() const;
diff --git a/src/dawn/native/metal/ComputePipelineMTL.mm b/src/dawn/native/metal/ComputePipelineMTL.mm
index f350071..855cd7b 100644
--- a/src/dawn/native/metal/ComputePipelineMTL.mm
+++ b/src/dawn/native/metal/ComputePipelineMTL.mm
@@ -29,6 +29,11 @@
return AcquireRef(new ComputePipeline(device, descriptor));
}
+ComputePipeline::ComputePipeline(DeviceBase* dev, const ComputePipelineDescriptor* desc)
+ : ComputePipelineBase(dev, desc) {}
+
+ComputePipeline::~ComputePipeline() = default;
+
MaybeError ComputePipeline::Initialize() {
auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice();
diff --git a/src/dawn/native/metal/PipelineLayoutMTL.h b/src/dawn/native/metal/PipelineLayoutMTL.h
index 1651954..48711e7 100644
--- a/src/dawn/native/metal/PipelineLayoutMTL.h
+++ b/src/dawn/native/metal/PipelineLayoutMTL.h
@@ -51,7 +51,7 @@
private:
PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor);
- ~PipelineLayout() override = default;
+ ~PipelineLayout() override;
PerStage<BindingIndexInfo> mIndexInfo;
PerStage<uint32_t> mBufferBindingCount;
};
diff --git a/src/dawn/native/metal/PipelineLayoutMTL.mm b/src/dawn/native/metal/PipelineLayoutMTL.mm
index 2dfad2e..800db51 100644
--- a/src/dawn/native/metal/PipelineLayoutMTL.mm
+++ b/src/dawn/native/metal/PipelineLayoutMTL.mm
@@ -70,6 +70,8 @@
}
}
+PipelineLayout::~PipelineLayout() = default;
+
const PipelineLayout::BindingIndexInfo& PipelineLayout::GetBindingIndexInfo(
SingleShaderStage stage) const {
return mIndexInfo[stage];
diff --git a/src/dawn/native/metal/QuerySetMTL.h b/src/dawn/native/metal/QuerySetMTL.h
index 9f0e6bb..c8b4c73 100644
--- a/src/dawn/native/metal/QuerySetMTL.h
+++ b/src/dawn/native/metal/QuerySetMTL.h
@@ -30,15 +30,18 @@
static ResultOrError<Ref<QuerySet>> Create(Device* device,
const QuerySetDescriptor* descriptor);
+ QuerySet(DeviceBase* device, const QuerySetDescriptor* descriptor);
+
id<MTLBuffer> GetVisibilityBuffer() const;
id<MTLCounterSampleBuffer> GetCounterSampleBuffer() const
API_AVAILABLE(macos(10.15), ios(14.0));
private:
- ~QuerySet() override;
using QuerySetBase::QuerySetBase;
MaybeError Initialize();
+ ~QuerySet() override;
+
// Dawn API
void DestroyImpl() override;
diff --git a/src/dawn/native/metal/QuerySetMTL.mm b/src/dawn/native/metal/QuerySetMTL.mm
index 1e19963..262ddc8 100644
--- a/src/dawn/native/metal/QuerySetMTL.mm
+++ b/src/dawn/native/metal/QuerySetMTL.mm
@@ -68,6 +68,8 @@
return queryset;
}
+QuerySet::QuerySet(DeviceBase* dev, const QuerySetDescriptor* desc) : QuerySetBase(dev, desc) {}
+
MaybeError QuerySet::Initialize() {
Device* device = ToBackend(GetDevice());
diff --git a/src/dawn/native/metal/QueueMTL.h b/src/dawn/native/metal/QueueMTL.h
index e1a37b9..5f95921 100644
--- a/src/dawn/native/metal/QueueMTL.h
+++ b/src/dawn/native/metal/QueueMTL.h
@@ -24,6 +24,7 @@
class Queue final : public QueueBase {
public:
Queue(Device* device, const QueueDescriptor* descriptor);
+ ~Queue() override;
private:
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
diff --git a/src/dawn/native/metal/QueueMTL.mm b/src/dawn/native/metal/QueueMTL.mm
index c129c5d..f6cfa4c 100644
--- a/src/dawn/native/metal/QueueMTL.mm
+++ b/src/dawn/native/metal/QueueMTL.mm
@@ -28,6 +28,8 @@
Queue::Queue(Device* device, const QueueDescriptor* descriptor) : QueueBase(device, descriptor) {}
+Queue::~Queue() = default;
+
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
Device* device = ToBackend(GetDevice());
diff --git a/src/dawn/native/metal/RenderPipelineMTL.h b/src/dawn/native/metal/RenderPipelineMTL.h
index cd8111d..23268ae 100644
--- a/src/dawn/native/metal/RenderPipelineMTL.h
+++ b/src/dawn/native/metal/RenderPipelineMTL.h
@@ -33,6 +33,9 @@
WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata);
+ RenderPipeline(DeviceBase* device, const RenderPipelineDescriptor* descriptor);
+ ~RenderPipeline() override;
+
MTLPrimitiveType GetMTLPrimitiveTopology() const;
MTLWinding GetMTLFrontFace() const;
MTLCullMode GetMTLCullMode() const;
diff --git a/src/dawn/native/metal/RenderPipelineMTL.mm b/src/dawn/native/metal/RenderPipelineMTL.mm
index 2e10ed9..89548ae 100644
--- a/src/dawn/native/metal/RenderPipelineMTL.mm
+++ b/src/dawn/native/metal/RenderPipelineMTL.mm
@@ -310,6 +310,11 @@
return AcquireRef(new RenderPipeline(device, descriptor));
}
+RenderPipeline::RenderPipeline(DeviceBase* dev, const RenderPipelineDescriptor* desc)
+ : RenderPipelineBase(dev, desc) {}
+
+RenderPipeline::~RenderPipeline() = default;
+
MaybeError RenderPipeline::Initialize() {
mMtlPrimitiveTopology = MTLPrimitiveTopology(GetPrimitiveTopology());
mMtlFrontFace = MTLFrontFace(GetFrontFace());
diff --git a/src/dawn/native/metal/SamplerMTL.h b/src/dawn/native/metal/SamplerMTL.h
index 2960817..fb7b1fc 100644
--- a/src/dawn/native/metal/SamplerMTL.h
+++ b/src/dawn/native/metal/SamplerMTL.h
@@ -29,6 +29,9 @@
public:
static ResultOrError<Ref<Sampler>> Create(Device* device, const SamplerDescriptor* descriptor);
+ Sampler(DeviceBase* device, const SamplerDescriptor* descriptor);
+ ~Sampler() override;
+
id<MTLSamplerState> GetMTLSamplerState();
private:
diff --git a/src/dawn/native/metal/SamplerMTL.mm b/src/dawn/native/metal/SamplerMTL.mm
index 329cd28..97b3046 100644
--- a/src/dawn/native/metal/SamplerMTL.mm
+++ b/src/dawn/native/metal/SamplerMTL.mm
@@ -64,6 +64,10 @@
return sampler;
}
+Sampler::Sampler(DeviceBase* dev, const SamplerDescriptor* desc) : SamplerBase(dev, desc) {}
+
+Sampler::~Sampler() = default;
+
MaybeError Sampler::Initialize(const SamplerDescriptor* descriptor) {
NSRef<MTLSamplerDescriptor> mtlDescRef = AcquireNSRef([MTLSamplerDescriptor new]);
MTLSamplerDescriptor* mtlDesc = mtlDescRef.Get();
diff --git a/src/dawn/native/metal/ShaderModuleMTL.h b/src/dawn/native/metal/ShaderModuleMTL.h
index dc0ea0b..0359223 100644
--- a/src/dawn/native/metal/ShaderModuleMTL.h
+++ b/src/dawn/native/metal/ShaderModuleMTL.h
@@ -65,7 +65,7 @@
bool* hasInvariantAttribute,
std::vector<uint32_t>* workgroupAllocations);
ShaderModule(Device* device, const ShaderModuleDescriptor* descriptor);
- ~ShaderModule() override = default;
+ ~ShaderModule() override;
MaybeError Initialize(ShaderModuleParseResult* parseResult,
OwnedCompilationMessages* compilationMessages);
};
diff --git a/src/dawn/native/metal/ShaderModuleMTL.mm b/src/dawn/native/metal/ShaderModuleMTL.mm
index 7b17c56..fa8befd 100644
--- a/src/dawn/native/metal/ShaderModuleMTL.mm
+++ b/src/dawn/native/metal/ShaderModuleMTL.mm
@@ -42,6 +42,8 @@
ShaderModule::ShaderModule(Device* device, const ShaderModuleDescriptor* descriptor)
: ShaderModuleBase(device, descriptor) {}
+ShaderModule::~ShaderModule() = default;
+
MaybeError ShaderModule::Initialize(ShaderModuleParseResult* parseResult,
OwnedCompilationMessages* compilationMessages) {
ScopedTintICEHandler scopedICEHandler(GetDevice());
diff --git a/src/dawn/native/metal/StagingBufferMTL.h b/src/dawn/native/metal/StagingBufferMTL.h
index afd2eac..bbad022 100644
--- a/src/dawn/native/metal/StagingBufferMTL.h
+++ b/src/dawn/native/metal/StagingBufferMTL.h
@@ -28,6 +28,7 @@
class StagingBuffer : public StagingBufferBase {
public:
StagingBuffer(size_t size, Device* device);
+ ~StagingBuffer() override;
id<MTLBuffer> GetBufferHandle() const;
diff --git a/src/dawn/native/metal/StagingBufferMTL.mm b/src/dawn/native/metal/StagingBufferMTL.mm
index 6bdc9e3..f4255f1 100644
--- a/src/dawn/native/metal/StagingBufferMTL.mm
+++ b/src/dawn/native/metal/StagingBufferMTL.mm
@@ -20,6 +20,8 @@
StagingBuffer::StagingBuffer(size_t size, Device* device)
: StagingBufferBase(size), mDevice(device) {}
+StagingBuffer::~StagingBuffer() = default;
+
MaybeError StagingBuffer::Initialize() {
const size_t bufferSize = GetSize();
mBuffer =
diff --git a/src/dawn/native/metal/SwapChainMTL.h b/src/dawn/native/metal/SwapChainMTL.h
index 003629c..de5cd5c 100644
--- a/src/dawn/native/metal/SwapChainMTL.h
+++ b/src/dawn/native/metal/SwapChainMTL.h
@@ -44,6 +44,8 @@
Surface* surface,
NewSwapChainBase* previousSwapChain,
const SwapChainDescriptor* descriptor);
+
+ SwapChain(DeviceBase* device, Surface* surface, const SwapChainDescriptor* descriptor);
~SwapChain() override;
private:
diff --git a/src/dawn/native/metal/SwapChainMTL.mm b/src/dawn/native/metal/SwapChainMTL.mm
index bf68884..d9435dd 100644
--- a/src/dawn/native/metal/SwapChainMTL.mm
+++ b/src/dawn/native/metal/SwapChainMTL.mm
@@ -72,6 +72,9 @@
return swapchain;
}
+SwapChain::SwapChain(DeviceBase* dev, Surface* sur, const SwapChainDescriptor* desc)
+ : NewSwapChainBase(dev, sur, desc) {}
+
SwapChain::~SwapChain() = default;
void SwapChain::DestroyImpl() {
diff --git a/src/dawn/native/metal/TextureMTL.h b/src/dawn/native/metal/TextureMTL.h
index d8b8ccd..3a9c3d8 100644
--- a/src/dawn/native/metal/TextureMTL.h
+++ b/src/dawn/native/metal/TextureMTL.h
@@ -45,6 +45,8 @@
const TextureDescriptor* descriptor,
NSPRef<id<MTLTexture>> wrapped);
+ Texture(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state);
+
id<MTLTexture> GetMTLTexture() const;
IOSurfaceRef GetIOSurface();
NSPRef<id<MTLTexture>> CreateFormatView(wgpu::TextureFormat format);
diff --git a/src/dawn/native/metal/TextureMTL.mm b/src/dawn/native/metal/TextureMTL.mm
index 429d60c..38db7cf 100644
--- a/src/dawn/native/metal/TextureMTL.mm
+++ b/src/dawn/native/metal/TextureMTL.mm
@@ -772,6 +772,9 @@
return {};
}
+Texture::Texture(DeviceBase* dev, const TextureDescriptor* desc, TextureState st)
+ : TextureBase(dev, desc, st) {}
+
Texture::~Texture() {}
void Texture::DestroyImpl() {
diff --git a/src/dawn/native/vulkan/AdapterVk.cpp b/src/dawn/native/vulkan/AdapterVk.cpp
index 6b0d770..c414c62 100644
--- a/src/dawn/native/vulkan/AdapterVk.cpp
+++ b/src/dawn/native/vulkan/AdapterVk.cpp
@@ -32,6 +32,8 @@
mPhysicalDevice(physicalDevice),
mVulkanInstance(vulkanInstance) {}
+Adapter::~Adapter() = default;
+
const VulkanDeviceInfo& Adapter::GetDeviceInfo() const {
return mDeviceInfo;
}
diff --git a/src/dawn/native/vulkan/AdapterVk.h b/src/dawn/native/vulkan/AdapterVk.h
index 2d9ce45..9cb5234 100644
--- a/src/dawn/native/vulkan/AdapterVk.h
+++ b/src/dawn/native/vulkan/AdapterVk.h
@@ -30,7 +30,7 @@
Adapter(InstanceBase* instance,
VulkanInstance* vulkanInstance,
VkPhysicalDevice physicalDevice);
- ~Adapter() override = default;
+ ~Adapter() override;
// AdapterBase Implementation
bool SupportsExternalImages() const override;
diff --git a/src/dawn/wire/ChunkedCommandHandler.cpp b/src/dawn/wire/ChunkedCommandHandler.cpp
index 9c3dc0e..7dd1075 100644
--- a/src/dawn/wire/ChunkedCommandHandler.cpp
+++ b/src/dawn/wire/ChunkedCommandHandler.cpp
@@ -22,6 +22,8 @@
namespace dawn::wire {
+ChunkedCommandHandler::ChunkedCommandHandler() = default;
+
ChunkedCommandHandler::~ChunkedCommandHandler() = default;
const volatile char* ChunkedCommandHandler::HandleCommands(const volatile char* commands,
diff --git a/src/dawn/wire/ChunkedCommandHandler.h b/src/dawn/wire/ChunkedCommandHandler.h
index c84c4ef..713ed38 100644
--- a/src/dawn/wire/ChunkedCommandHandler.h
+++ b/src/dawn/wire/ChunkedCommandHandler.h
@@ -27,9 +27,11 @@
class ChunkedCommandHandler : public CommandHandler {
public:
- const volatile char* HandleCommands(const volatile char* commands, size_t size) override;
+ ChunkedCommandHandler();
~ChunkedCommandHandler() override;
+ const volatile char* HandleCommands(const volatile char* commands, size_t size) override;
+
protected:
enum class ChunkedCommandsResult {
Passthrough,
diff --git a/src/dawn/wire/server/Server.cpp b/src/dawn/wire/server/Server.cpp
index 565154e..6dc8358 100644
--- a/src/dawn/wire/server/Server.cpp
+++ b/src/dawn/wire/server/Server.cpp
@@ -17,6 +17,9 @@
namespace dawn::wire::server {
+CallbackUserdata::CallbackUserdata(Server* server, const std::shared_ptr<bool>& serverIsAlive)
+ : server(server), serverIsAlive(serverIsAlive) {}
+
Server::Server(const DawnProcTable& procs,
CommandSerializer* serializer,
MemoryTransferService* memoryTransferService)
diff --git a/src/dawn/wire/server/Server.h b/src/dawn/wire/server/Server.h
index 52901b0..9bf60c8 100644
--- a/src/dawn/wire/server/Server.h
+++ b/src/dawn/wire/server/Server.h
@@ -55,8 +55,7 @@
std::weak_ptr<bool> const serverIsAlive;
CallbackUserdata() = delete;
- CallbackUserdata(Server* server, const std::shared_ptr<bool>& serverIsAlive)
- : server(server), serverIsAlive(serverIsAlive) {}
+ CallbackUserdata(Server* server, const std::shared_ptr<bool>& serverIsAlive);
};
template <auto F>