Flutter Engine
The Flutter Engine
allocator_mtl.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_ALLOCATOR_MTL_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_ALLOCATOR_MTL_H_
7
8#include <Metal/Metal.h>
9
11
12namespace impeller {
13
14class AllocatorMTL final : public Allocator {
15 public:
17
18 // |Allocator|
19 ~AllocatorMTL() override;
20
21 private:
22 friend class ContextMTL;
23
24 id<MTLDevice> device_;
25 std::string allocator_label_;
26 bool supports_memoryless_targets_ = false;
27 bool supports_uma_ = false;
28 bool is_valid_ = false;
29 ISize max_texture_supported_;
30
31 AllocatorMTL(id<MTLDevice> device, std::string label);
32
33 // |Allocator|
34 bool IsValid() const;
35
36 // |Allocator|
37 std::shared_ptr<DeviceBuffer> OnCreateBuffer(
38 const DeviceBufferDescriptor& desc) override;
39
40 // |Allocator|
41 std::shared_ptr<Texture> OnCreateTexture(
42 const TextureDescriptor& desc) override;
43
44 // |Allocator|
45 uint16_t MinimumBytesPerRow(PixelFormat format) const override;
46
47 // |Allocator|
48 ISize GetMaxTextureSizeSupported() const override;
49
50 AllocatorMTL(const AllocatorMTL&) = delete;
51
52 AllocatorMTL& operator=(const AllocatorMTL&) = delete;
53};
54
55} // namespace impeller
56
57#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_ALLOCATOR_MTL_H_
An object that allocates device memory.
Definition: allocator.h:22
VkDevice device
Definition: main.cc:53
uint32_t uint32_t * format
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...