/* * Copyright 2021 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef skgpu_MtlMemoryAllocatorImpl_DEFINED #define skgpu_MtlMemoryAllocatorImpl_DEFINED #include "include/core/SkRefCnt.h" #include "include/gpu/mtl/MtlMemoryAllocator.h" #import namespace skgpu { class MtlMemoryAllocatorImpl : public MtlMemoryAllocator { public: static sk_sp Make(id); ~MtlMemoryAllocatorImpl() override {} id newBufferWithLength(NSUInteger length, MTLResourceOptions options, sk_sp* allocation) override; id newTextureWithDescriptor(MTLTextureDescriptor* texDesc, sk_sp* allocation) override; class Alloc : public MtlAlloc { public: Alloc() {} ~Alloc() override { // TODO: free allocation } private: friend class MtlMemoryAllocatorImpl; // TODO: allocation data goes here }; private: MtlMemoryAllocatorImpl(id device) : fDevice(device) {} id fDevice; }; } // namespace skgpu #endif // skgpu_MtlMemoryAllocatorImpl_DEFINED