Renames DestroyApiObject* to Destroy* for simplicity.
- Also updates and adds tests for CommandBuffer since it is the last object with a Destroy name clash. Bug: dawn:628 Change-Id: I028e0101a91a785aa90d2b656556d48fe0d6e736 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68101 Commit-Queue: Loko Kung <lokokung@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
4a24f9c261
commit
e9c84c071f
|
@ -418,8 +418,8 @@ namespace dawn_native {
|
|||
|
||||
BindGroupLayoutBase::~BindGroupLayoutBase() = default;
|
||||
|
||||
bool BindGroupLayoutBase::DestroyApiObject() {
|
||||
bool wasDestroyed = ApiObjectBase::DestroyApiObject();
|
||||
bool BindGroupLayoutBase::Destroy() {
|
||||
bool wasDestroyed = ApiObjectBase::Destroy();
|
||||
if (wasDestroyed && IsCachedReference()) {
|
||||
// Do not uncache the actual cached object if we are a blueprint or already destroyed.
|
||||
GetDevice()->UncacheBindGroupLayout(this);
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace dawn_native {
|
|||
|
||||
static BindGroupLayoutBase* MakeError(DeviceBase* device);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
// A map from the BindingNumber to its packed BindingIndex.
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace dawn_native {
|
|||
mFakeMappedData.reset();
|
||||
}
|
||||
|
||||
void DestroyApiObjectImpl() override {
|
||||
void DestroyImpl() override {
|
||||
mFakeMappedData.reset();
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ namespace dawn_native {
|
|||
ASSERT(mState == BufferState::Unmapped || mState == BufferState::Destroyed);
|
||||
}
|
||||
|
||||
bool BufferBase::DestroyApiObject() {
|
||||
bool BufferBase::Destroy() {
|
||||
bool marked = MarkDestroyed();
|
||||
if (!marked) {
|
||||
return false;
|
||||
|
@ -197,7 +197,7 @@ namespace dawn_native {
|
|||
}
|
||||
}
|
||||
|
||||
DestroyApiObjectImpl();
|
||||
DestroyImpl();
|
||||
mState = BufferState::Destroyed;
|
||||
return true;
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
void BufferBase::APIDestroy() {
|
||||
DestroyApiObject();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
MaybeError BufferBase::CopyFromStagingBuffer() {
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace dawn_native {
|
|||
|
||||
static BufferBase* MakeError(DeviceBase* device, const BufferDescriptor* descriptor);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
uint64_t GetSize() const;
|
||||
|
|
|
@ -29,16 +29,18 @@ namespace dawn_native {
|
|||
: ApiObjectBase(encoder->GetDevice(), kLabelNotImplemented),
|
||||
mCommands(encoder->AcquireCommands()),
|
||||
mResourceUsages(encoder->AcquireResourceUsages()) {
|
||||
TrackInDevice();
|
||||
}
|
||||
|
||||
CommandBufferBase::CommandBufferBase(DeviceBase* device)
|
||||
: ApiObjectBase(device, kLabelNotImplemented) {
|
||||
TrackInDevice();
|
||||
}
|
||||
|
||||
CommandBufferBase::CommandBufferBase(DeviceBase* device, ObjectBase::ErrorTag tag)
|
||||
: ApiObjectBase(device, tag) {
|
||||
}
|
||||
|
||||
CommandBufferBase::~CommandBufferBase() {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// static
|
||||
CommandBufferBase* CommandBufferBase::MakeError(DeviceBase* device) {
|
||||
return new CommandBufferBase(device, ObjectBase::kError);
|
||||
|
@ -51,14 +53,13 @@ namespace dawn_native {
|
|||
MaybeError CommandBufferBase::ValidateCanUseInSubmitNow() const {
|
||||
ASSERT(!IsError());
|
||||
|
||||
DAWN_INVALID_IF(mDestroyed, "%s cannot be submitted more than once.", this);
|
||||
DAWN_INVALID_IF(!IsAlive(), "%s cannot be submitted more than once.", this);
|
||||
return {};
|
||||
}
|
||||
|
||||
void CommandBufferBase::Destroy() {
|
||||
void CommandBufferBase::DestroyImpl() {
|
||||
FreeCommands(&mCommands);
|
||||
mResourceUsages = {};
|
||||
mDestroyed = true;
|
||||
}
|
||||
|
||||
const CommandBufferResourceUsage& CommandBufferBase::GetResourceUsages() const {
|
||||
|
|
|
@ -36,17 +36,18 @@ namespace dawn_native {
|
|||
|
||||
static CommandBufferBase* MakeError(DeviceBase* device);
|
||||
|
||||
void DestroyImpl() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
MaybeError ValidateCanUseInSubmitNow() const;
|
||||
void Destroy();
|
||||
|
||||
const CommandBufferResourceUsage& GetResourceUsages() const;
|
||||
|
||||
CommandIterator* GetCommandIteratorForTesting();
|
||||
|
||||
protected:
|
||||
~CommandBufferBase() override;
|
||||
// Constructor used only for mocking and testing.
|
||||
CommandBufferBase(DeviceBase* device);
|
||||
|
||||
CommandIterator mCommands;
|
||||
|
||||
|
@ -54,7 +55,6 @@ namespace dawn_native {
|
|||
CommandBufferBase(DeviceBase* device, ObjectBase::ErrorTag tag);
|
||||
|
||||
CommandBufferResourceUsage mResourceUsages;
|
||||
bool mDestroyed = false;
|
||||
};
|
||||
|
||||
bool IsCompleteSubresourceCopiedTo(const TextureBase* texture,
|
||||
|
|
|
@ -60,8 +60,8 @@ namespace dawn_native {
|
|||
|
||||
ComputePipelineBase::~ComputePipelineBase() = default;
|
||||
|
||||
bool ComputePipelineBase::DestroyApiObject() {
|
||||
bool wasDestroyed = ApiObjectBase::DestroyApiObject();
|
||||
bool ComputePipelineBase::Destroy() {
|
||||
bool wasDestroyed = ApiObjectBase::Destroy();
|
||||
if (wasDestroyed && IsCachedReference()) {
|
||||
// Do not uncache the actual cached object if we are a blueprint or already destroyed.
|
||||
GetDevice()->UncacheComputePipeline(this);
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace dawn_native {
|
|||
|
||||
static ComputePipelineBase* MakeError(DeviceBase* device);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
// Functors necessary for the unordered_set<ComputePipelineBase*>-based cache.
|
||||
|
|
|
@ -269,7 +269,8 @@ namespace dawn_native {
|
|||
// TODO(dawn/628) Add types into the array as they are implemented.
|
||||
|
||||
// clang-format off
|
||||
static constexpr std::array<ObjectType, 13> kObjectTypeDependencyOrder = {
|
||||
static constexpr std::array<ObjectType, 14> kObjectTypeDependencyOrder = {
|
||||
ObjectType::CommandBuffer,
|
||||
ObjectType::RenderPipeline,
|
||||
ObjectType::ComputePipeline,
|
||||
ObjectType::PipelineLayout,
|
||||
|
@ -296,7 +297,7 @@ namespace dawn_native {
|
|||
objList.objects.MoveInto(&objects);
|
||||
}
|
||||
for (LinkNode<ApiObjectBase>* node : objects) {
|
||||
node->value()->DestroyApiObject();
|
||||
node->value()->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,12 +119,12 @@ namespace dawn_native {
|
|||
if (GetDevice()->ConsumedError(GetDevice()->ValidateObject(this))) {
|
||||
return;
|
||||
}
|
||||
DestroyApiObject();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
bool ExternalTextureBase::DestroyApiObject() {
|
||||
bool ExternalTextureBase::Destroy() {
|
||||
mState = ExternalTextureState::Destroyed;
|
||||
return ApiObjectBase::DestroyApiObject();
|
||||
return ApiObjectBase::Destroy();
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace dawn_native {
|
|||
|
||||
static ExternalTextureBase* MakeError(DeviceBase* device);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
void APIDestroy();
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
void ApiObjectBase::DeleteThis() {
|
||||
DestroyApiObject();
|
||||
Destroy();
|
||||
RefCounted::DeleteThis();
|
||||
}
|
||||
|
||||
|
@ -85,15 +85,15 @@ namespace dawn_native {
|
|||
return RemoveFromList();
|
||||
}
|
||||
|
||||
bool ApiObjectBase::DestroyApiObject() {
|
||||
bool ApiObjectBase::Destroy() {
|
||||
bool marked = MarkDestroyed();
|
||||
if (marked) {
|
||||
DestroyApiObjectImpl();
|
||||
DestroyImpl();
|
||||
}
|
||||
return marked;
|
||||
}
|
||||
|
||||
void ApiObjectBase::DestroyApiObjectImpl() {
|
||||
void ApiObjectBase::DestroyImpl() {
|
||||
}
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -65,17 +65,17 @@ namespace dawn_native {
|
|||
// class's implementation in the override. This needs to be public because it can be called
|
||||
// from the device owning the object. Returns true iff destruction occurs. Upon any re-calls
|
||||
// of the function it will return false to indicate no further operations should be taken.
|
||||
virtual bool DestroyApiObject();
|
||||
virtual bool Destroy();
|
||||
|
||||
// Dawn API
|
||||
void APISetLabel(const char* label);
|
||||
|
||||
protected:
|
||||
// Overriding of the RefCounted's DeleteThis function ensures that instances of objects
|
||||
// always call their derived class implementation of DestroyApiObject prior to the derived
|
||||
// always call their derived class implementation of Destroy prior to the derived
|
||||
// class being destroyed. This guarantees that when ApiObjects' reference counts drop to 0,
|
||||
// then the underlying backend's Destroy calls are executed. We cannot naively put the call
|
||||
// to DestroyApiObject in the destructor of this class because it calls DestroyApiObjectImpl
|
||||
// to Destroy in the destructor of this class because it calls DestroyImpl
|
||||
// which is a virtual function often implemented in the Derived class which would already
|
||||
// have been destroyed by the time ApiObject's destructor is called by C++'s destruction
|
||||
// order. Note that some classes like BindGroup may override the DeleteThis function again,
|
||||
|
@ -89,7 +89,7 @@ namespace dawn_native {
|
|||
// pre-destruction steps that need to occur only once, i.e. Buffer needs to be unmapped
|
||||
// before being destroyed.
|
||||
bool MarkDestroyed();
|
||||
virtual void DestroyApiObjectImpl();
|
||||
virtual void DestroyImpl();
|
||||
|
||||
private:
|
||||
virtual void SetLabelImpl();
|
||||
|
|
|
@ -85,8 +85,8 @@ namespace dawn_native {
|
|||
|
||||
PipelineLayoutBase::~PipelineLayoutBase() = default;
|
||||
|
||||
bool PipelineLayoutBase::DestroyApiObject() {
|
||||
bool wasDestroyed = ApiObjectBase::DestroyApiObject();
|
||||
bool PipelineLayoutBase::Destroy() {
|
||||
bool wasDestroyed = ApiObjectBase::Destroy();
|
||||
if (wasDestroyed && IsCachedReference()) {
|
||||
// Do not uncache the actual cached object if we are a blueprint
|
||||
GetDevice()->UncachePipelineLayout(this);
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace dawn_native {
|
|||
DeviceBase* device,
|
||||
std::vector<StageAndDescriptor> stages);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
const BindGroupLayoutBase* GetBindGroupLayout(BindGroupIndex group) const;
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
private:
|
||||
void DestroyApiObjectImpl() override {
|
||||
void DestroyImpl() override {
|
||||
UNREACHABLE();
|
||||
}
|
||||
};
|
||||
|
@ -126,9 +126,9 @@ namespace dawn_native {
|
|||
ASSERT(mState == QuerySetState::Unavailable || mState == QuerySetState::Destroyed);
|
||||
}
|
||||
|
||||
bool QuerySetBase::DestroyApiObject() {
|
||||
bool QuerySetBase::Destroy() {
|
||||
mState = QuerySetState::Destroyed;
|
||||
return ApiObjectBase::DestroyApiObject();
|
||||
return ApiObjectBase::Destroy();
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -170,7 +170,7 @@ namespace dawn_native {
|
|||
if (GetDevice()->ConsumedError(ValidateDestroy())) {
|
||||
return;
|
||||
}
|
||||
DestroyApiObject();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
MaybeError QuerySetBase::ValidateDestroy() const {
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace dawn_native {
|
|||
|
||||
static QuerySetBase* MakeError(DeviceBase* device);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
wgpu::QueryType GetQueryType() const;
|
||||
|
|
|
@ -683,8 +683,8 @@ namespace dawn_native {
|
|||
|
||||
RenderPipelineBase::~RenderPipelineBase() = default;
|
||||
|
||||
bool RenderPipelineBase::DestroyApiObject() {
|
||||
bool wasDestroyed = ApiObjectBase::DestroyApiObject();
|
||||
bool RenderPipelineBase::Destroy() {
|
||||
bool wasDestroyed = ApiObjectBase::Destroy();
|
||||
if (wasDestroyed && IsCachedReference()) {
|
||||
// Do not uncache the actual cached object if we are a blueprint or already destroyed.
|
||||
GetDevice()->UncacheRenderPipeline(this);
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace dawn_native {
|
|||
|
||||
static RenderPipelineBase* MakeError(DeviceBase* device);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
const ityp::bitset<VertexAttributeLocation, kMaxVertexAttributes>&
|
||||
|
|
|
@ -100,8 +100,8 @@ namespace dawn_native {
|
|||
|
||||
SamplerBase::~SamplerBase() = default;
|
||||
|
||||
bool SamplerBase::DestroyApiObject() {
|
||||
bool wasDestroyed = ApiObjectBase::DestroyApiObject();
|
||||
bool SamplerBase::Destroy() {
|
||||
bool wasDestroyed = ApiObjectBase::Destroy();
|
||||
if (wasDestroyed && IsCachedReference()) {
|
||||
// Do not uncache the actual cached object if we are a blueprint or already destroyed.
|
||||
GetDevice()->UncacheSampler(this);
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace dawn_native {
|
|||
|
||||
static SamplerBase* MakeError(DeviceBase* device);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
bool IsComparison() const;
|
||||
|
|
|
@ -1204,8 +1204,8 @@ namespace dawn_native {
|
|||
|
||||
ShaderModuleBase::~ShaderModuleBase() = default;
|
||||
|
||||
bool ShaderModuleBase::DestroyApiObject() {
|
||||
bool wasDestroyed = ApiObjectBase::DestroyApiObject();
|
||||
bool ShaderModuleBase::Destroy() {
|
||||
bool wasDestroyed = ApiObjectBase::Destroy();
|
||||
if (wasDestroyed && IsCachedReference()) {
|
||||
// Do not uncache the actual cached object if we are a blueprint or already destroyed.
|
||||
GetDevice()->UncacheShaderModule(this);
|
||||
|
|
|
@ -248,7 +248,7 @@ namespace dawn_native {
|
|||
|
||||
static Ref<ShaderModuleBase> MakeError(DeviceBase* device);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
// Return true iff the program has an entrypoint called `entryPoint`.
|
||||
|
|
|
@ -483,12 +483,12 @@ namespace dawn_native {
|
|||
: ApiObjectBase(device, tag), mFormat(kUnusedFormat) {
|
||||
}
|
||||
|
||||
bool TextureBase::DestroyApiObject() {
|
||||
bool TextureBase::Destroy() {
|
||||
// We need to run the destroy operations prior to setting the state to destroyed so that
|
||||
// the state is both consistent, and implementations of the destroy that may check the
|
||||
// state do not skip operations unintentionally. (Example in Vulkan backend, the destroy
|
||||
// implementation will not be ran if we are already in the Destroyed state.)
|
||||
bool wasDestroyed = ApiObjectBase::DestroyApiObject();
|
||||
bool wasDestroyed = ApiObjectBase::Destroy();
|
||||
mState = TextureState::Destroyed;
|
||||
return wasDestroyed;
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ namespace dawn_native {
|
|||
return;
|
||||
}
|
||||
ASSERT(!IsError());
|
||||
DestroyApiObject();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
MaybeError TextureBase::ValidateDestroy() const {
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace dawn_native {
|
|||
|
||||
static TextureBase* MakeError(DeviceBase* device);
|
||||
|
||||
bool DestroyApiObject() override;
|
||||
bool Destroy() override;
|
||||
ObjectType GetType() const override;
|
||||
|
||||
wgpu::TextureDimension GetDimension() const;
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
BindGroup::~BindGroup() = default;
|
||||
|
||||
void BindGroup::DestroyApiObjectImpl() {
|
||||
void BindGroup::DestroyImpl() {
|
||||
ToBackend(GetLayout())->DeallocateBindGroup(this, &mCPUViewAllocation);
|
||||
ASSERT(!mCPUViewAllocation.IsValid());
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
private:
|
||||
~BindGroup() override;
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
Ref<SamplerHeapCacheEntry> mSamplerAllocationEntry;
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
return mMappedData;
|
||||
}
|
||||
|
||||
void Buffer::DestroyApiObjectImpl() {
|
||||
void Buffer::DestroyImpl() {
|
||||
// TODO(crbug.com/dawn/1189) Reintroduce optimization to skip flushing the writes to the GPU
|
||||
// memory when we unmap in destruction case since the buffer will be destroyed anyways.
|
||||
ToBackend(GetDevice())->DeallocateMemory(mResourceAllocation);
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
MaybeError Initialize(bool mappedAtCreation);
|
||||
MaybeError MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) override;
|
||||
void UnmapImpl() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
bool IsCPUWritableAtCreation() const override;
|
||||
virtual MaybeError MapAtCreationImpl() override;
|
||||
void* GetMappedPointerImpl() override;
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
ComputePipeline::~ComputePipeline() = default;
|
||||
|
||||
void ComputePipeline::DestroyApiObjectImpl() {
|
||||
void ComputePipeline::DestroyImpl() {
|
||||
ToBackend(GetDevice())->ReferenceUntilUnused(mPipelineState);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
private:
|
||||
~ComputePipeline() override;
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
using ComputePipelineBase::ComputePipelineBase;
|
||||
ComPtr<ID3D12PipelineState> mPipelineState;
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
QuerySet::~QuerySet() = default;
|
||||
|
||||
void QuerySet::DestroyApiObjectImpl() {
|
||||
void QuerySet::DestroyImpl() {
|
||||
ToBackend(GetDevice())->ReferenceUntilUnused(mQueryHeap);
|
||||
mQueryHeap = nullptr;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
MaybeError Initialize();
|
||||
|
||||
// Dawn API
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
ComPtr<ID3D12QueryHeap> mQueryHeap;
|
||||
};
|
||||
|
|
|
@ -419,7 +419,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
RenderPipeline::~RenderPipeline() = default;
|
||||
|
||||
void RenderPipeline::DestroyApiObjectImpl() {
|
||||
void RenderPipeline::DestroyImpl() {
|
||||
ToBackend(GetDevice())->ReferenceUntilUnused(mPipelineState);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
private:
|
||||
~RenderPipeline() override;
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
using RenderPipelineBase::RenderPipelineBase;
|
||||
D3D12_INPUT_LAYOUT_DESC ComputeInputLayout(
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
SwapChain::~SwapChain() = default;
|
||||
|
||||
void SwapChain::DestroyApiObjectImpl() {
|
||||
void SwapChain::DestroyImpl() {
|
||||
DetachFromSurface();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
private:
|
||||
~SwapChain() override;
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
using NewSwapChainBase::NewSwapChainBase;
|
||||
MaybeError Initialize(NewSwapChainBase* previousSwapChain);
|
||||
|
|
|
@ -649,7 +649,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
Texture::~Texture() {
|
||||
}
|
||||
|
||||
void Texture::DestroyApiObjectImpl() {
|
||||
void Texture::DestroyImpl() {
|
||||
Device* device = ToBackend(GetDevice());
|
||||
|
||||
// In PIX's D3D12-only mode, there is no way to determine frame boundaries
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
// Dawn API
|
||||
void SetLabelImpl() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
MaybeError ClearTexture(CommandRecordingContext* commandContext,
|
||||
const SubresourceRange& range,
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace dawn_native { namespace metal {
|
|||
private:
|
||||
~BindGroup() override;
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
};
|
||||
|
||||
}} // namespace dawn_native::metal
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace dawn_native { namespace metal {
|
|||
|
||||
BindGroup::~BindGroup() = default;
|
||||
|
||||
void BindGroup::DestroyApiObjectImpl() {
|
||||
void BindGroup::DestroyImpl() {
|
||||
ToBackend(GetLayout())->DeallocateBindGroup(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace dawn_native { namespace metal {
|
|||
~Buffer() override;
|
||||
MaybeError MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) override;
|
||||
void UnmapImpl() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
void* GetMappedPointerImpl() override;
|
||||
bool IsCPUWritableAtCreation() const override;
|
||||
MaybeError MapAtCreationImpl() override;
|
||||
|
|
|
@ -171,7 +171,7 @@ namespace dawn_native { namespace metal {
|
|||
// Nothing to do, Metal StorageModeShared buffers are always mapped.
|
||||
}
|
||||
|
||||
void Buffer::DestroyApiObjectImpl() {
|
||||
void Buffer::DestroyImpl() {
|
||||
mMtlBuffer = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace dawn_native { namespace metal {
|
|||
MaybeError Initialize();
|
||||
|
||||
// Dawn API
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
NSPRef<id<MTLBuffer>> mVisibilityBuffer;
|
||||
// Note that mCounterSampleBuffer cannot be an NSRef because the API_AVAILABLE macros don't
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace dawn_native { namespace metal {
|
|||
|
||||
QuerySet::~QuerySet() = default;
|
||||
|
||||
void QuerySet::DestroyApiObjectImpl() {
|
||||
void QuerySet::DestroyImpl() {
|
||||
mVisibilityBuffer = nullptr;
|
||||
|
||||
// mCounterSampleBuffer isn't an NSRef because API_AVAILABLE doesn't work will with
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace dawn_native { namespace metal {
|
|||
~SwapChain() override;
|
||||
|
||||
private:
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
using NewSwapChainBase::NewSwapChainBase;
|
||||
MaybeError Initialize(NewSwapChainBase* previousSwapChain);
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace dawn_native { namespace metal {
|
|||
|
||||
SwapChain::~SwapChain() = default;
|
||||
|
||||
void SwapChain::DestroyApiObjectImpl() {
|
||||
void SwapChain::DestroyImpl() {
|
||||
DetachFromSurface();
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace dawn_native { namespace metal {
|
|||
void InitializeAsWrapping(const TextureDescriptor* descriptor,
|
||||
NSPRef<id<MTLTexture>> wrapped);
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
MaybeError ClearTexture(CommandRecordingContext* commandContext,
|
||||
const SubresourceRange& range,
|
||||
|
|
|
@ -495,7 +495,7 @@ namespace dawn_native { namespace metal {
|
|||
Texture::~Texture() {
|
||||
}
|
||||
|
||||
void Texture::DestroyApiObjectImpl() {
|
||||
void Texture::DestroyImpl() {
|
||||
mMtlTexture = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ namespace dawn_native { namespace null {
|
|||
void Buffer::UnmapImpl() {
|
||||
}
|
||||
|
||||
void Buffer::DestroyApiObjectImpl() {
|
||||
void Buffer::DestroyImpl() {
|
||||
ToBackend(GetDevice())->DecrementMemoryUsage(GetSize());
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ namespace dawn_native { namespace null {
|
|||
: QuerySetBase(device, descriptor) {
|
||||
}
|
||||
|
||||
void QuerySet::DestroyApiObjectImpl() {
|
||||
void QuerySet::DestroyImpl() {
|
||||
}
|
||||
|
||||
// Queue
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace dawn_native { namespace null {
|
|||
private:
|
||||
MaybeError MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) override;
|
||||
void UnmapImpl() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
bool IsCPUWritableAtCreation() const override;
|
||||
MaybeError MapAtCreationImpl() override;
|
||||
void* GetMappedPointerImpl() override;
|
||||
|
@ -246,7 +246,7 @@ namespace dawn_native { namespace null {
|
|||
QuerySet(Device* device, const QuerySetDescriptor* descriptor);
|
||||
|
||||
private:
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
};
|
||||
|
||||
class Queue final : public QueueBase {
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
BindGroup::~BindGroup() = default;
|
||||
|
||||
void BindGroup::DestroyApiObjectImpl() {
|
||||
void BindGroup::DestroyImpl() {
|
||||
ToBackend(GetLayout())->DeallocateBindGroup(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace dawn_native { namespace opengl {
|
|||
private:
|
||||
~BindGroup() override;
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
};
|
||||
|
||||
}} // namespace dawn_native::opengl
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace dawn_native { namespace opengl {
|
|||
mMappedData = nullptr;
|
||||
}
|
||||
|
||||
void Buffer::DestroyApiObjectImpl() {
|
||||
void Buffer::DestroyImpl() {
|
||||
ToBackend(GetDevice())->gl.DeleteBuffers(1, &mBuffer);
|
||||
mBuffer = 0;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace dawn_native { namespace opengl {
|
|||
~Buffer() override;
|
||||
MaybeError MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) override;
|
||||
void UnmapImpl() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
bool IsCPUWritableAtCreation() const override;
|
||||
MaybeError MapAtCreationImpl() override;
|
||||
void* GetMappedPointerImpl() override;
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
ComputePipeline::~ComputePipeline() = default;
|
||||
|
||||
void ComputePipeline::DestroyApiObjectImpl() {
|
||||
void ComputePipeline::DestroyImpl() {
|
||||
DeleteProgram(ToBackend(GetDevice())->gl);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace dawn_native { namespace opengl {
|
|||
private:
|
||||
using ComputePipelineBase::ComputePipelineBase;
|
||||
~ComputePipeline() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
};
|
||||
|
||||
}} // namespace dawn_native::opengl
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
QuerySet::~QuerySet() = default;
|
||||
|
||||
void QuerySet::DestroyApiObjectImpl() {
|
||||
void QuerySet::DestroyImpl() {
|
||||
}
|
||||
|
||||
}} // namespace dawn_native::opengl
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native { namespace opengl {
|
|||
private:
|
||||
~QuerySet() override;
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
};
|
||||
|
||||
}} // namespace dawn_native::opengl
|
||||
|
|
|
@ -236,7 +236,7 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
RenderPipeline::~RenderPipeline() = default;
|
||||
|
||||
void RenderPipeline::DestroyApiObjectImpl() {
|
||||
void RenderPipeline::DestroyImpl() {
|
||||
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
|
||||
gl.DeleteVertexArrays(1, &mVertexArrayObject);
|
||||
gl.BindVertexArray(0);
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace dawn_native { namespace opengl {
|
|||
private:
|
||||
RenderPipeline(Device* device, const RenderPipelineDescriptor* descriptor);
|
||||
~RenderPipeline() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
void CreateVAOForVertexState();
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
Sampler::~Sampler() = default;
|
||||
|
||||
void Sampler::DestroyApiObjectImpl() {
|
||||
void Sampler::DestroyImpl() {
|
||||
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
|
||||
gl.DeleteSamplers(1, &mFilteringHandle);
|
||||
gl.DeleteSamplers(1, &mNonFilteringHandle);
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
private:
|
||||
~Sampler() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
void SetupGLSampler(GLuint sampler, const SamplerDescriptor* descriptor, bool forceNearest);
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ namespace dawn_native { namespace opengl {
|
|||
Texture::~Texture() {
|
||||
}
|
||||
|
||||
void Texture::DestroyApiObjectImpl() {
|
||||
void Texture::DestroyImpl() {
|
||||
if (GetTextureState() == TextureState::OwnedInternal) {
|
||||
ToBackend(GetDevice())->gl.DeleteTextures(1, &mHandle);
|
||||
mHandle = 0;
|
||||
|
@ -560,7 +560,7 @@ namespace dawn_native { namespace opengl {
|
|||
TextureView::~TextureView() {
|
||||
}
|
||||
|
||||
void TextureView::DestroyApiObjectImpl() {
|
||||
void TextureView::DestroyImpl() {
|
||||
if (mOwnsHandle) {
|
||||
ToBackend(GetDevice())->gl.DeleteTextures(1, &mHandle);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace dawn_native { namespace opengl {
|
|||
private:
|
||||
~Texture() override;
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
MaybeError ClearTexture(const SubresourceRange& range, TextureBase::ClearValue clearValue);
|
||||
|
||||
GLuint mHandle;
|
||||
|
@ -57,7 +57,7 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
private:
|
||||
~TextureView() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
GLuint mHandle;
|
||||
GLenum mTarget;
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
BindGroup::~BindGroup() = default;
|
||||
|
||||
void BindGroup::DestroyApiObjectImpl() {
|
||||
void BindGroup::DestroyImpl() {
|
||||
ToBackend(GetLayout())->DeallocateBindGroup(this, &mDescriptorSetAllocation);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace dawn_native { namespace vulkan {
|
|||
private:
|
||||
~BindGroup() override;
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
// The descriptor set in this allocation outlives the BindGroup because it is owned by
|
||||
// the BindGroupLayout which is referenced by the BindGroup.
|
||||
|
|
|
@ -329,7 +329,7 @@ namespace dawn_native { namespace vulkan {
|
|||
return memory;
|
||||
}
|
||||
|
||||
void Buffer::DestroyApiObjectImpl() {
|
||||
void Buffer::DestroyImpl() {
|
||||
ToBackend(GetDevice())->GetResourceMemoryAllocator()->Deallocate(&mMemoryAllocation);
|
||||
|
||||
if (mHandle != VK_NULL_HANDLE) {
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
MaybeError MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) override;
|
||||
void UnmapImpl() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
bool IsCPUWritableAtCreation() const override;
|
||||
MaybeError MapAtCreationImpl() override;
|
||||
void* GetMappedPointerImpl() override;
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
ComputePipeline::~ComputePipeline() = default;
|
||||
|
||||
void ComputePipeline::DestroyApiObjectImpl() {
|
||||
void ComputePipeline::DestroyImpl() {
|
||||
if (mHandle != VK_NULL_HANDLE) {
|
||||
ToBackend(GetDevice())->GetFencedDeleter()->DeleteWhenUnused(mHandle);
|
||||
mHandle = VK_NULL_HANDLE;
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
private:
|
||||
~ComputePipeline() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
using ComputePipelineBase::ComputePipelineBase;
|
||||
|
||||
VkPipeline mHandle = VK_NULL_HANDLE;
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
PipelineLayout::~PipelineLayout() = default;
|
||||
|
||||
void PipelineLayout::DestroyApiObjectImpl() {
|
||||
void PipelineLayout::DestroyImpl() {
|
||||
if (mHandle != VK_NULL_HANDLE) {
|
||||
ToBackend(GetDevice())->GetFencedDeleter()->DeleteWhenUnused(mHandle);
|
||||
mHandle = VK_NULL_HANDLE;
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
private:
|
||||
~PipelineLayout() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
using PipelineLayoutBase::PipelineLayoutBase;
|
||||
MaybeError Initialize();
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
QuerySet::~QuerySet() = default;
|
||||
|
||||
void QuerySet::DestroyApiObjectImpl() {
|
||||
void QuerySet::DestroyImpl() {
|
||||
if (mHandle != VK_NULL_HANDLE) {
|
||||
ToBackend(GetDevice())->GetFencedDeleter()->DeleteWhenUnused(mHandle);
|
||||
mHandle = VK_NULL_HANDLE;
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace dawn_native { namespace vulkan {
|
|||
using QuerySetBase::QuerySetBase;
|
||||
MaybeError Initialize();
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
VkQueryPool mHandle = VK_NULL_HANDLE;
|
||||
};
|
||||
|
|
|
@ -601,7 +601,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
RenderPipeline::~RenderPipeline() = default;
|
||||
|
||||
void RenderPipeline::DestroyApiObjectImpl() {
|
||||
void RenderPipeline::DestroyImpl() {
|
||||
if (mHandle != VK_NULL_HANDLE) {
|
||||
ToBackend(GetDevice())->GetFencedDeleter()->DeleteWhenUnused(mHandle);
|
||||
mHandle = VK_NULL_HANDLE;
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
private:
|
||||
~RenderPipeline() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
using RenderPipelineBase::RenderPipelineBase;
|
||||
|
||||
struct PipelineVertexInputStateCreateInfoTemporaryAllocations {
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
Sampler::~Sampler() = default;
|
||||
|
||||
void Sampler::DestroyApiObjectImpl() {
|
||||
void Sampler::DestroyImpl() {
|
||||
if (mHandle != VK_NULL_HANDLE) {
|
||||
ToBackend(GetDevice())->GetFencedDeleter()->DeleteWhenUnused(mHandle);
|
||||
mHandle = VK_NULL_HANDLE;
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
private:
|
||||
~Sampler() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
using SamplerBase::SamplerBase;
|
||||
MaybeError Initialize(const SamplerDescriptor* descriptor);
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
SwapChain::~SwapChain() = default;
|
||||
|
||||
void SwapChain::DestroyApiObjectImpl() {
|
||||
void SwapChain::DestroyImpl() {
|
||||
DetachFromSurface();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace dawn_native { namespace vulkan {
|
|||
private:
|
||||
using NewSwapChainBase::NewSwapChainBase;
|
||||
MaybeError Initialize(NewSwapChainBase* previousSwapChain);
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
|
||||
struct Config {
|
||||
// Information that's passed to vulkan swapchain creation.
|
||||
|
|
|
@ -792,7 +792,7 @@ namespace dawn_native { namespace vulkan {
|
|||
mSignalSemaphore = VK_NULL_HANDLE;
|
||||
|
||||
// Destroy the texture so it can't be used again
|
||||
DestroyApiObject();
|
||||
Destroy();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -808,7 +808,7 @@ namespace dawn_native { namespace vulkan {
|
|||
SetLabelHelper("Dawn_InternalTexture");
|
||||
}
|
||||
|
||||
void Texture::DestroyApiObjectImpl() {
|
||||
void Texture::DestroyImpl() {
|
||||
if (GetTextureState() == TextureState::OwnedInternal) {
|
||||
Device* device = ToBackend(GetDevice());
|
||||
|
||||
|
@ -1301,7 +1301,7 @@ namespace dawn_native { namespace vulkan {
|
|||
TextureView::~TextureView() {
|
||||
}
|
||||
|
||||
void TextureView::DestroyApiObjectImpl() {
|
||||
void TextureView::DestroyImpl() {
|
||||
Device* device = ToBackend(GetTexture()->GetDevice());
|
||||
|
||||
if (mHandle != VK_NULL_HANDLE) {
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace dawn_native { namespace vulkan {
|
|||
external_memory::Service* externalMemoryService);
|
||||
void InitializeForSwapChain(VkImage nativeImage);
|
||||
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
MaybeError ClearTexture(CommandRecordingContext* recordingContext,
|
||||
const SubresourceRange& range,
|
||||
TextureBase::ClearValue);
|
||||
|
@ -176,7 +176,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
private:
|
||||
~TextureView() override;
|
||||
void DestroyApiObjectImpl() override;
|
||||
void DestroyImpl() override;
|
||||
using TextureViewBase::TextureViewBase;
|
||||
MaybeError Initialize(const TextureViewDescriptor* descriptor);
|
||||
|
||||
|
|
|
@ -144,6 +144,7 @@ source_set("dawn_native_mocks_sources") {
|
|||
sources = [
|
||||
"unittests/native/mocks/BindGroupLayoutMock.h",
|
||||
"unittests/native/mocks/BindGroupMock.h",
|
||||
"unittests/native/mocks/CommandBufferMock.h",
|
||||
"unittests/native/mocks/ComputePipelineMock.h",
|
||||
"unittests/native/mocks/DeviceMock.h",
|
||||
"unittests/native/mocks/ExternalTextureMock.h",
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "mocks/BindGroupLayoutMock.h"
|
||||
#include "mocks/BindGroupMock.h"
|
||||
#include "mocks/BufferMock.h"
|
||||
#include "mocks/CommandBufferMock.h"
|
||||
#include "mocks/ComputePipelineMock.h"
|
||||
#include "mocks/DeviceMock.h"
|
||||
#include "mocks/ExternalTextureMock.h"
|
||||
|
@ -52,7 +53,7 @@ namespace dawn_native { namespace {
|
|||
}
|
||||
mTexture =
|
||||
AcquireRef(new TextureMock(&mDevice, TextureBase::TextureState::OwnedInternal));
|
||||
EXPECT_CALL(*mTexture.Get(), DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*mTexture.Get(), DestroyImpl).Times(1);
|
||||
return mTexture;
|
||||
}
|
||||
|
||||
|
@ -61,7 +62,7 @@ namespace dawn_native { namespace {
|
|||
return mPipelineLayout;
|
||||
}
|
||||
mPipelineLayout = AcquireRef(new PipelineLayoutMock(&mDevice));
|
||||
EXPECT_CALL(*mPipelineLayout.Get(), DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*mPipelineLayout.Get(), DestroyImpl).Times(1);
|
||||
return mPipelineLayout;
|
||||
}
|
||||
|
||||
|
@ -75,7 +76,7 @@ namespace dawn_native { namespace {
|
|||
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
})"),
|
||||
{ ASSERT(false); }, mVsModule);
|
||||
EXPECT_CALL(*mVsModule.Get(), DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*mVsModule.Get(), DestroyImpl).Times(1);
|
||||
return mVsModule;
|
||||
}
|
||||
|
||||
|
@ -88,7 +89,7 @@ namespace dawn_native { namespace {
|
|||
[[stage(compute), workgroup_size(1)]] fn main() {
|
||||
})"),
|
||||
{ ASSERT(false); }, mCsModule);
|
||||
EXPECT_CALL(*mCsModule.Get(), DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*mCsModule.Get(), DestroyImpl).Times(1);
|
||||
return mCsModule;
|
||||
}
|
||||
|
||||
|
@ -105,10 +106,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, BindGroupExplicit) {
|
||||
BindGroupMock bindGroupMock(&mDevice);
|
||||
EXPECT_CALL(bindGroupMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(bindGroupMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(bindGroupMock.IsAlive());
|
||||
bindGroupMock.DestroyApiObject();
|
||||
bindGroupMock.Destroy();
|
||||
EXPECT_FALSE(bindGroupMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -116,7 +117,7 @@ namespace dawn_native { namespace {
|
|||
// will also complain if there is a memory leak.
|
||||
TEST_F(DestroyObjectTests, BindGroupImplicit) {
|
||||
BindGroupMock* bindGroupMock = new BindGroupMock(&mDevice);
|
||||
EXPECT_CALL(*bindGroupMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*bindGroupMock, DestroyImpl).Times(1);
|
||||
{
|
||||
BindGroupDescriptor desc = {};
|
||||
Ref<BindGroupBase> bindGroup;
|
||||
|
@ -130,10 +131,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, BindGroupLayoutExplicit) {
|
||||
BindGroupLayoutMock bindGroupLayoutMock(&mDevice);
|
||||
EXPECT_CALL(bindGroupLayoutMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(bindGroupLayoutMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(bindGroupLayoutMock.IsAlive());
|
||||
bindGroupLayoutMock.DestroyApiObject();
|
||||
bindGroupLayoutMock.Destroy();
|
||||
EXPECT_FALSE(bindGroupLayoutMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -141,7 +142,7 @@ namespace dawn_native { namespace {
|
|||
// will also complain if there is a memory leak.
|
||||
TEST_F(DestroyObjectTests, BindGroupLayoutImplicit) {
|
||||
BindGroupLayoutMock* bindGroupLayoutMock = new BindGroupLayoutMock(&mDevice);
|
||||
EXPECT_CALL(*bindGroupLayoutMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*bindGroupLayoutMock, DestroyImpl).Times(1);
|
||||
{
|
||||
BindGroupLayoutDescriptor desc = {};
|
||||
Ref<BindGroupLayoutBase> bindGroupLayout;
|
||||
|
@ -157,10 +158,10 @@ namespace dawn_native { namespace {
|
|||
TEST_F(DestroyObjectTests, BufferExplicit) {
|
||||
{
|
||||
BufferMock bufferMock(&mDevice, BufferBase::BufferState::Unmapped);
|
||||
EXPECT_CALL(bufferMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(bufferMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(bufferMock.IsAlive());
|
||||
bufferMock.DestroyApiObject();
|
||||
bufferMock.Destroy();
|
||||
EXPECT_FALSE(bufferMock.IsAlive());
|
||||
}
|
||||
{
|
||||
|
@ -168,11 +169,11 @@ namespace dawn_native { namespace {
|
|||
{
|
||||
InSequence seq;
|
||||
EXPECT_CALL(bufferMock, UnmapImpl).Times(1);
|
||||
EXPECT_CALL(bufferMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(bufferMock, DestroyImpl).Times(1);
|
||||
}
|
||||
|
||||
EXPECT_TRUE(bufferMock.IsAlive());
|
||||
bufferMock.DestroyApiObject();
|
||||
bufferMock.Destroy();
|
||||
EXPECT_FALSE(bufferMock.IsAlive());
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ namespace dawn_native { namespace {
|
|||
TEST_F(DestroyObjectTests, BufferImplicit) {
|
||||
{
|
||||
BufferMock* bufferMock = new BufferMock(&mDevice, BufferBase::BufferState::Unmapped);
|
||||
EXPECT_CALL(*bufferMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*bufferMock, DestroyImpl).Times(1);
|
||||
{
|
||||
BufferDescriptor desc = {};
|
||||
Ref<BufferBase> buffer;
|
||||
|
@ -198,7 +199,7 @@ namespace dawn_native { namespace {
|
|||
{
|
||||
InSequence seq;
|
||||
EXPECT_CALL(*bufferMock, UnmapImpl).Times(1);
|
||||
EXPECT_CALL(*bufferMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*bufferMock, DestroyImpl).Times(1);
|
||||
}
|
||||
{
|
||||
BufferDescriptor desc = {};
|
||||
|
@ -212,12 +213,37 @@ namespace dawn_native { namespace {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(DestroyObjectTests, CommandBufferExplicit) {
|
||||
CommandBufferMock commandBufferMock(&mDevice);
|
||||
EXPECT_CALL(commandBufferMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(commandBufferMock.IsAlive());
|
||||
commandBufferMock.Destroy();
|
||||
EXPECT_FALSE(commandBufferMock.IsAlive());
|
||||
}
|
||||
|
||||
// If the reference count on API objects reach 0, they should delete themselves. Note that GTest
|
||||
// will also complain if there is a memory leak.
|
||||
TEST_F(DestroyObjectTests, CommandBufferImplicit) {
|
||||
CommandBufferMock* commandBufferMock = new CommandBufferMock(&mDevice);
|
||||
EXPECT_CALL(*commandBufferMock, DestroyImpl).Times(1);
|
||||
{
|
||||
CommandBufferDescriptor desc = {};
|
||||
Ref<CommandBufferBase> commandBuffer;
|
||||
EXPECT_CALL(mDevice, CreateCommandBuffer)
|
||||
.WillOnce(Return(ByMove(AcquireRef(commandBufferMock))));
|
||||
DAWN_ASSERT_AND_ASSIGN(commandBuffer, mDevice.CreateCommandBuffer(nullptr, &desc));
|
||||
|
||||
EXPECT_TRUE(commandBuffer->IsAlive());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DestroyObjectTests, ComputePipelineExplicit) {
|
||||
ComputePipelineMock computePipelineMock(&mDevice);
|
||||
EXPECT_CALL(computePipelineMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(computePipelineMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(computePipelineMock.IsAlive());
|
||||
computePipelineMock.DestroyApiObject();
|
||||
computePipelineMock.Destroy();
|
||||
EXPECT_FALSE(computePipelineMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -233,7 +259,7 @@ namespace dawn_native { namespace {
|
|||
|
||||
// Compute pipelines are initialized during their creation via the device.
|
||||
EXPECT_CALL(*computePipelineMock, Initialize).Times(1);
|
||||
EXPECT_CALL(*computePipelineMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*computePipelineMock, DestroyImpl).Times(1);
|
||||
|
||||
{
|
||||
ComputePipelineDescriptor desc = {};
|
||||
|
@ -252,10 +278,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, ExternalTextureExplicit) {
|
||||
ExternalTextureMock externalTextureMock(&mDevice);
|
||||
EXPECT_CALL(externalTextureMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(externalTextureMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(externalTextureMock.IsAlive());
|
||||
externalTextureMock.DestroyApiObject();
|
||||
externalTextureMock.Destroy();
|
||||
EXPECT_FALSE(externalTextureMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -270,10 +296,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, PipelineLayoutExplicit) {
|
||||
PipelineLayoutMock pipelineLayoutMock(&mDevice);
|
||||
EXPECT_CALL(pipelineLayoutMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(pipelineLayoutMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(pipelineLayoutMock.IsAlive());
|
||||
pipelineLayoutMock.DestroyApiObject();
|
||||
pipelineLayoutMock.Destroy();
|
||||
EXPECT_FALSE(pipelineLayoutMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -281,7 +307,7 @@ namespace dawn_native { namespace {
|
|||
// will also complain if there is a memory leak.
|
||||
TEST_F(DestroyObjectTests, PipelineLayoutImplicit) {
|
||||
PipelineLayoutMock* pipelineLayoutMock = new PipelineLayoutMock(&mDevice);
|
||||
EXPECT_CALL(*pipelineLayoutMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*pipelineLayoutMock, DestroyImpl).Times(1);
|
||||
{
|
||||
PipelineLayoutDescriptor desc = {};
|
||||
Ref<PipelineLayoutBase> pipelineLayout;
|
||||
|
@ -296,10 +322,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, QuerySetExplicit) {
|
||||
QuerySetMock querySetMock(&mDevice);
|
||||
EXPECT_CALL(querySetMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(querySetMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(querySetMock.IsAlive());
|
||||
querySetMock.DestroyApiObject();
|
||||
querySetMock.Destroy();
|
||||
EXPECT_FALSE(querySetMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -307,7 +333,7 @@ namespace dawn_native { namespace {
|
|||
// will also complain if there is a memory leak.
|
||||
TEST_F(DestroyObjectTests, QuerySetImplicit) {
|
||||
QuerySetMock* querySetMock = new QuerySetMock(&mDevice);
|
||||
EXPECT_CALL(*querySetMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*querySetMock, DestroyImpl).Times(1);
|
||||
{
|
||||
QuerySetDescriptor desc = {};
|
||||
Ref<QuerySetBase> querySet;
|
||||
|
@ -321,10 +347,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, RenderPipelineExplicit) {
|
||||
RenderPipelineMock renderPipelineMock(&mDevice);
|
||||
EXPECT_CALL(renderPipelineMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(renderPipelineMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(renderPipelineMock.IsAlive());
|
||||
renderPipelineMock.DestroyApiObject();
|
||||
renderPipelineMock.Destroy();
|
||||
EXPECT_FALSE(renderPipelineMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -340,7 +366,7 @@ namespace dawn_native { namespace {
|
|||
|
||||
// Render pipelines are initialized during their creation via the device.
|
||||
EXPECT_CALL(*renderPipelineMock, Initialize).Times(1);
|
||||
EXPECT_CALL(*renderPipelineMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*renderPipelineMock, DestroyImpl).Times(1);
|
||||
|
||||
{
|
||||
RenderPipelineDescriptor desc = {};
|
||||
|
@ -359,10 +385,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, SamplerExplicit) {
|
||||
SamplerMock samplerMock(&mDevice);
|
||||
EXPECT_CALL(samplerMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(samplerMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(samplerMock.IsAlive());
|
||||
samplerMock.DestroyApiObject();
|
||||
samplerMock.Destroy();
|
||||
EXPECT_FALSE(samplerMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -370,7 +396,7 @@ namespace dawn_native { namespace {
|
|||
// will also complain if there is a memory leak.
|
||||
TEST_F(DestroyObjectTests, SamplerImplicit) {
|
||||
SamplerMock* samplerMock = new SamplerMock(&mDevice);
|
||||
EXPECT_CALL(*samplerMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*samplerMock, DestroyImpl).Times(1);
|
||||
{
|
||||
SamplerDescriptor desc = {};
|
||||
Ref<SamplerBase> sampler;
|
||||
|
@ -385,10 +411,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, ShaderModuleExplicit) {
|
||||
ShaderModuleMock shaderModuleMock(&mDevice);
|
||||
EXPECT_CALL(shaderModuleMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(shaderModuleMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(shaderModuleMock.IsAlive());
|
||||
shaderModuleMock.DestroyApiObject();
|
||||
shaderModuleMock.Destroy();
|
||||
EXPECT_FALSE(shaderModuleMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -396,7 +422,7 @@ namespace dawn_native { namespace {
|
|||
// will also complain if there is a memory leak.
|
||||
TEST_F(DestroyObjectTests, ShaderModuleImplicit) {
|
||||
ShaderModuleMock* shaderModuleMock = new ShaderModuleMock(&mDevice);
|
||||
EXPECT_CALL(*shaderModuleMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*shaderModuleMock, DestroyImpl).Times(1);
|
||||
{
|
||||
ShaderModuleWGSLDescriptor wgslDesc;
|
||||
wgslDesc.source = R"(
|
||||
|
@ -417,10 +443,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, SwapChainExplicit) {
|
||||
SwapChainMock swapChainMock(&mDevice);
|
||||
EXPECT_CALL(swapChainMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(swapChainMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(swapChainMock.IsAlive());
|
||||
swapChainMock.DestroyApiObject();
|
||||
swapChainMock.Destroy();
|
||||
EXPECT_FALSE(swapChainMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -428,7 +454,7 @@ namespace dawn_native { namespace {
|
|||
// will also complain if there is a memory leak.
|
||||
TEST_F(DestroyObjectTests, SwapChainImplicit) {
|
||||
SwapChainMock* swapChainMock = new SwapChainMock(&mDevice);
|
||||
EXPECT_CALL(*swapChainMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*swapChainMock, DestroyImpl).Times(1);
|
||||
{
|
||||
SwapChainDescriptor desc = {};
|
||||
Ref<SwapChainBase> swapChain;
|
||||
|
@ -443,18 +469,18 @@ namespace dawn_native { namespace {
|
|||
TEST_F(DestroyObjectTests, TextureExplicit) {
|
||||
{
|
||||
TextureMock textureMock(&mDevice, TextureBase::TextureState::OwnedInternal);
|
||||
EXPECT_CALL(textureMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(textureMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(textureMock.IsAlive());
|
||||
textureMock.DestroyApiObject();
|
||||
textureMock.Destroy();
|
||||
EXPECT_FALSE(textureMock.IsAlive());
|
||||
}
|
||||
{
|
||||
TextureMock textureMock(&mDevice, TextureBase::TextureState::OwnedExternal);
|
||||
EXPECT_CALL(textureMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(textureMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(textureMock.IsAlive());
|
||||
textureMock.DestroyApiObject();
|
||||
textureMock.Destroy();
|
||||
EXPECT_FALSE(textureMock.IsAlive());
|
||||
}
|
||||
}
|
||||
|
@ -465,7 +491,7 @@ namespace dawn_native { namespace {
|
|||
{
|
||||
TextureMock* textureMock =
|
||||
new TextureMock(&mDevice, TextureBase::TextureState::OwnedInternal);
|
||||
EXPECT_CALL(*textureMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*textureMock, DestroyImpl).Times(1);
|
||||
{
|
||||
TextureDescriptor desc = {};
|
||||
Ref<TextureBase> texture;
|
||||
|
@ -479,7 +505,7 @@ namespace dawn_native { namespace {
|
|||
{
|
||||
TextureMock* textureMock =
|
||||
new TextureMock(&mDevice, TextureBase::TextureState::OwnedExternal);
|
||||
EXPECT_CALL(*textureMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*textureMock, DestroyImpl).Times(1);
|
||||
{
|
||||
TextureDescriptor desc = {};
|
||||
Ref<TextureBase> texture;
|
||||
|
@ -494,10 +520,10 @@ namespace dawn_native { namespace {
|
|||
|
||||
TEST_F(DestroyObjectTests, TextureViewExplicit) {
|
||||
TextureViewMock textureViewMock(GetTexture().Get());
|
||||
EXPECT_CALL(textureViewMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(textureViewMock, DestroyImpl).Times(1);
|
||||
|
||||
EXPECT_TRUE(textureViewMock.IsAlive());
|
||||
textureViewMock.DestroyApiObject();
|
||||
textureViewMock.Destroy();
|
||||
EXPECT_FALSE(textureViewMock.IsAlive());
|
||||
}
|
||||
|
||||
|
@ -505,7 +531,7 @@ namespace dawn_native { namespace {
|
|||
// will also complain if there is a memory leak.
|
||||
TEST_F(DestroyObjectTests, TextureViewImplicit) {
|
||||
TextureViewMock* textureViewMock = new TextureViewMock(GetTexture().Get());
|
||||
EXPECT_CALL(*textureViewMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*textureViewMock, DestroyImpl).Times(1);
|
||||
{
|
||||
TextureViewDescriptor desc = {};
|
||||
Ref<TextureViewBase> textureView;
|
||||
|
@ -524,6 +550,7 @@ namespace dawn_native { namespace {
|
|||
BindGroupMock* bindGroupMock = new BindGroupMock(&mDevice);
|
||||
BindGroupLayoutMock* bindGroupLayoutMock = new BindGroupLayoutMock(&mDevice);
|
||||
BufferMock* bufferMock = new BufferMock(&mDevice, BufferBase::BufferState::Unmapped);
|
||||
CommandBufferMock* commandBufferMock = new CommandBufferMock(&mDevice);
|
||||
ComputePipelineMock* computePipelineMock = new ComputePipelineMock(&mDevice);
|
||||
PipelineLayoutMock* pipelineLayoutMock = new PipelineLayoutMock(&mDevice);
|
||||
QuerySetMock* querySetMock = new QuerySetMock(&mDevice);
|
||||
|
@ -536,18 +563,19 @@ namespace dawn_native { namespace {
|
|||
TextureViewMock* textureViewMock = new TextureViewMock(GetTexture().Get());
|
||||
{
|
||||
InSequence seq;
|
||||
EXPECT_CALL(*renderPipelineMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*computePipelineMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*pipelineLayoutMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*swapChainMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*bindGroupMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*bindGroupLayoutMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*shaderModuleMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*textureViewMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*textureMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*querySetMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*samplerMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*bufferMock, DestroyApiObjectImpl).Times(1);
|
||||
EXPECT_CALL(*commandBufferMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*renderPipelineMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*computePipelineMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*pipelineLayoutMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*swapChainMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*bindGroupMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*bindGroupLayoutMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*shaderModuleMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*textureViewMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*textureMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*querySetMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*samplerMock, DestroyImpl).Times(1);
|
||||
EXPECT_CALL(*bufferMock, DestroyImpl).Times(1);
|
||||
}
|
||||
|
||||
Ref<BindGroupBase> bindGroup;
|
||||
|
@ -577,6 +605,15 @@ namespace dawn_native { namespace {
|
|||
EXPECT_TRUE(buffer->IsAlive());
|
||||
}
|
||||
|
||||
Ref<CommandBufferBase> commandBuffer;
|
||||
{
|
||||
CommandBufferDescriptor desc = {};
|
||||
EXPECT_CALL(mDevice, CreateCommandBuffer)
|
||||
.WillOnce(Return(ByMove(AcquireRef(commandBufferMock))));
|
||||
DAWN_ASSERT_AND_ASSIGN(commandBuffer, mDevice.CreateCommandBuffer(nullptr, &desc));
|
||||
EXPECT_TRUE(commandBuffer->IsAlive());
|
||||
}
|
||||
|
||||
Ref<ComputePipelineBase> computePipeline;
|
||||
{
|
||||
// Compute pipelines usually set their hash values at construction, but the mock does
|
||||
|
@ -704,6 +741,7 @@ namespace dawn_native { namespace {
|
|||
EXPECT_FALSE(bindGroup->IsAlive());
|
||||
EXPECT_FALSE(bindGroupLayout->IsAlive());
|
||||
EXPECT_FALSE(buffer->IsAlive());
|
||||
EXPECT_FALSE(commandBuffer->IsAlive());
|
||||
EXPECT_FALSE(computePipeline->IsAlive());
|
||||
EXPECT_FALSE(externalTexture->IsAlive());
|
||||
EXPECT_FALSE(pipelineLayout->IsAlive());
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native {
|
|||
}
|
||||
~BindGroupLayoutMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native {
|
|||
}
|
||||
~BindGroupMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native {
|
|||
}
|
||||
~BufferMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
|
||||
MOCK_METHOD(MaybeError, MapAtCreationImpl, (), (override));
|
||||
MOCK_METHOD(MaybeError,
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2021 The Dawn Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef TESTS_UNITTESTS_NATIVE_MOCKS_COMMANDBUFFER_MOCK_H_
|
||||
#define TESTS_UNITTESTS_NATIVE_MOCKS_COMMANDBUFFER_MOCK_H_
|
||||
|
||||
#include "dawn_native/CommandBuffer.h"
|
||||
#include "dawn_native/Device.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
namespace dawn_native {
|
||||
|
||||
class CommandBufferMock : public CommandBufferBase {
|
||||
public:
|
||||
CommandBufferMock(DeviceBase* device) : CommandBufferBase(device) {
|
||||
}
|
||||
~CommandBufferMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
||||
#endif // TESTS_UNITTESTS_NATIVE_MOCKS_COMMANDBUFFER_MOCK_H_
|
|
@ -30,7 +30,7 @@ namespace dawn_native {
|
|||
|
||||
MOCK_METHOD(MaybeError, Initialize, (), (override));
|
||||
MOCK_METHOD(size_t, ComputeContentHash, (), (override));
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native {
|
|||
}
|
||||
~ExternalTextureMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native {
|
|||
}
|
||||
~PipelineLayoutMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native {
|
|||
}
|
||||
~QuerySetMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace dawn_native {
|
|||
|
||||
MOCK_METHOD(MaybeError, Initialize, (), (override));
|
||||
MOCK_METHOD(size_t, ComputeContentHash, (), (override));
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native {
|
|||
}
|
||||
~SamplerMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace dawn_native {
|
|||
}
|
||||
~ShaderModuleMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
|
||||
// Creates a shader module mock based on the wgsl source.
|
||||
static ResultOrError<Ref<ShaderModuleMock>> Create(DeviceBase* device, const char* source);
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native {
|
|||
}
|
||||
~SwapChainMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
|
||||
MOCK_METHOD(void,
|
||||
APIConfigure,
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace dawn_native {
|
|||
}
|
||||
~TextureMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
class TextureViewMock : public TextureViewBase {
|
||||
|
@ -38,7 +38,7 @@ namespace dawn_native {
|
|||
}
|
||||
~TextureViewMock() override = default;
|
||||
|
||||
MOCK_METHOD(void, DestroyApiObjectImpl, (), (override));
|
||||
MOCK_METHOD(void, DestroyImpl, (), (override));
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
|
Loading…
Reference in New Issue