Flutter Engine
The Flutter Engine
MtlMemoryAllocatorImpl.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef skgpu_MtlMemoryAllocatorImpl_DEFINED
9#define skgpu_MtlMemoryAllocatorImpl_DEFINED
10
13
14#import <Metal/Metal.h>
15
16namespace skgpu {
17
18class MtlMemoryAllocatorImpl : public MtlMemoryAllocator {
19public:
20 static sk_sp<MtlMemoryAllocator> Make(id<MTLDevice>);
21
23
24 id<MTLBuffer> newBufferWithLength(NSUInteger length, MTLResourceOptions options,
25 sk_sp<skgpu::MtlAlloc>* allocation) override;
26 id<MTLTexture> newTextureWithDescriptor(MTLTextureDescriptor* texDesc,
27 sk_sp<skgpu::MtlAlloc>* allocation) override;
28
29 class Alloc : public MtlAlloc {
30 public:
31 Alloc() {}
32 ~Alloc() override {
33 // TODO: free allocation
34 }
35 private:
37 // TODO: allocation data goes here
38 };
39
40private:
41 MtlMemoryAllocatorImpl(id<MTLDevice> device) : fDevice(device) {}
42
43 id<MTLDevice> fDevice;
44};
45
46} // namespace skgpu
47
48#endif // skgpu_MtlMemoryAllocatorImpl_DEFINED
const char * options
id< MTLTexture > newTextureWithDescriptor(MTLTextureDescriptor *texDesc, sk_sp< skgpu::MtlAlloc > *allocation) override
id< MTLBuffer > newBufferWithLength(NSUInteger length, MTLResourceOptions options, sk_sp< skgpu::MtlAlloc > *allocation) override
static sk_sp< MtlMemoryAllocator > Make(id< MTLDevice >)
VkDevice device
Definition: main.cc:53
size_t length
Definition: GpuTools.h:21