Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
10#include "flutter/fml/macros.h"
12
13namespace impeller {
14
15class AllocatorMTL final : public Allocator {
16 public:
18
19 // |Allocator|
20 ~AllocatorMTL() override;
21
22 private:
23 friend class ContextMTL;
24
25 id<MTLDevice> device_;
26 std::string allocator_label_;
27 bool supports_memoryless_targets_ = false;
28 bool supports_uma_ = false;
29 bool is_valid_ = false;
30 ISize max_texture_supported_;
31
32 AllocatorMTL(id<MTLDevice> device, std::string label);
33
34 // |Allocator|
35 bool IsValid() const;
36
37 // |Allocator|
38 std::shared_ptr<DeviceBuffer> OnCreateBuffer(
39 const DeviceBufferDescriptor& desc) override;
40
41 // |Allocator|
42 std::shared_ptr<Texture> OnCreateTexture(
43 const TextureDescriptor& desc) override;
44
45 // |Allocator|
46 uint16_t MinimumBytesPerRow(PixelFormat format) const override;
47
48 // |Allocator|
49 ISize GetMaxTextureSizeSupported() const override;
50
51 AllocatorMTL(const AllocatorMTL&) = delete;
52
53 AllocatorMTL& operator=(const AllocatorMTL&) = delete;
54};
55
56} // namespace impeller
57
58#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_ALLOCATOR_MTL_H_
std::shared_ptr< Texture > OnCreateTexture(const TextureDescriptor &desc) override
std::shared_ptr< DeviceBuffer > OnCreateBuffer(const DeviceBufferDescriptor &desc) override
ISize GetMaxTextureSizeSupported() const override
uint16_t MinimumBytesPerRow(PixelFormat format) const override
Minimum value for row_bytes on a Texture. The row bytes parameter of that method must be aligned to t...
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:100
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...