Flutter Engine
The Flutter Engine
MtlMemoryAllocator.h
Go to the documentation of this file.
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
12
13#ifdef __APPLE__
14
15#ifdef __OBJC__
16#import <Metal/Metal.h>
17#endif
18
19namespace skgpu {
20
21// interface classes for the GPU memory allocator
22class MtlAlloc : public SkRefCnt {
23public:
24 ~MtlAlloc() override = default;
25};
26
27#ifdef __OBJC__
28class MtlMemoryAllocator : public SkRefCnt {
29public:
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
const char * options
size_t length
Definition: GpuTools.h:21