Debian Codegraph @

include/gpu/mtl/MtlMemoryAllocator.h

raw
1 /*
2 * Copyright 2022 Google Inc.
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_MtlMemoryAllocator_DEFINED
9 #define skgpu_MtlMemoryAllocator_DEFINED
10
11 #include "include/core/SkRefCnt.h"
12
13 #ifdef __APPLE__
14
15 #ifdef __OBJC__
16 #import <Metal/Metal.h>
17 #endif
18
19 namespace skgpu {
20
21 // interface classes for the GPU memory allocator
22 class MtlAlloc : public SkRefCnt {
23 public:
24 ~MtlAlloc() override = default;
25 };
26
27 #ifdef __OBJC__
28 class MtlMemoryAllocator : public SkRefCnt {
29 public:
30 virtual id<MTLBuffer> newBufferWithLength(NSUInteger length, MTLResourceOptions options,
31 sk_sp<MtlAlloc>* allocation) = 0;
32 virtual id<MTLTexture> newTextureWithDescriptor(MTLTextureDescriptor* texDesc,
33 sk_sp<MtlAlloc>* allocation) = 0;
34 };
35 #endif
36
37 } // namespace skgpu
38
39 #endif // __APPLE__
40
41 #endif // skgpu_MtlMemoryAllocator_DEFINED