#include <test_metal_context.h>
Definition at line 16 of file test_metal_context.h.
◆ TestMetalContext()
flutter::TestMetalContext::TestMetalContext |
( |
| ) |
|
Definition at line 19 of file test_metal_context.mm.
19 {
23 return;
24 }
25
27 if (!command_queue) {
28 FML_LOG(
ERROR) <<
"Could not create the default command queue.";
29 return;
30 }
31
32 [command_queue.get() setLabel:@"Flutter Test Queue"];
33
35
36
38 backendContext.
fQueue.reset([command_queue.get() retain]);
40 if (!skia_context_) {
41 FML_LOG(
ERROR) <<
"Could not create the GrDirectContext from the Metal Device "
42 "and command queue.";
43 }
44
45 device_ = [
device.get() retain];
46 command_queue_ = [command_queue.get() retain];
47}
#define FML_LOG(severity)
SK_API sk_sp< GrDirectContext > MakeMetal(const GrMtlBackendContext &, const GrContextOptions &)
sk_cfp< GrMTLHandle > fDevice
sk_cfp< GrMTLHandle > fQueue
◆ ~TestMetalContext()
flutter::TestMetalContext::~TestMetalContext |
( |
| ) |
|
Definition at line 49 of file test_metal_context.mm.
49 {
50 std::scoped_lock lock(textures_mutex_);
51 textures_.clear();
52 if (device_) {
53 [(__bridge
id)device_ release];
54 }
55 if (command_queue_) {
56 [(__bridge
id)command_queue_ release];
57 }
58}
◆ CreateMetalTexture()
Returns texture_id = -1 when texture creation fails.
Definition at line 72 of file test_metal_context.mm.
72 {
73 std::scoped_lock lock(textures_mutex_);
75 [[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatBGRA8Unorm
78 mipmapped:NO] retain]};
79
80
81
82
83 texture_descriptor.
get().usage = MTLTextureUsageUnknown;
84
85 if (!texture_descriptor) {
86 FML_CHECK(
false) <<
"Invalid texture descriptor.";
87 return {.texture_id = -1, .texture = nullptr};
88 }
89
91 sk_cfp<void*>
texture = sk_cfp<void*>{[
device newTextureWithDescriptor:texture_descriptor.get()]};
92
94 FML_CHECK(
false) <<
"Could not create texture from texture descriptor.";
95 return {.texture_id = -1, .texture = nullptr};
96 }
97
100
101 return {
104 };
105}
void * GetMetalDevice() const
T get() const __attribute((ns_returns_not_retained))
#define FML_CHECK(condition)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
◆ GetMetalCommandQueue()
void * flutter::TestMetalContext::GetMetalCommandQueue |
( |
| ) |
const |
◆ GetMetalDevice()
void * flutter::TestMetalContext::GetMetalDevice |
( |
| ) |
const |
◆ GetSkiaContext()
◆ GetTextureInfo()
Definition at line 117 of file test_metal_context.mm.
117 {
118 std::scoped_lock lock(textures_mutex_);
119 if (textures_.find(
texture_id) == textures_.end()) {
121 return {.texture_id = -1, .texture = nullptr};
122 } else {
123 return {
126 };
127 }
128}
◆ Present()
bool flutter::TestMetalContext::Present |
( |
int64_t |
texture_id | ) |
|
Definition at line 108 of file test_metal_context.mm.
108 {
109 std::scoped_lock lock(textures_mutex_);
110 if (textures_.find(
texture_id) == textures_.end()) {
111 return false;
112 } else {
113 return true;
114 }
115}
The documentation for this class was generated from the following files: