5#include "flutter/testing/test_metal_context.h"
7#include <Metal/Metal.h>
10#include "flutter/fml/logging.h"
11#include "flutter/fml/platform/darwin/scoped_nsobject.h"
28 FML_LOG(
ERROR) <<
"Could not create the default command queue.";
32 [command_queue.get() setLabel:
@"Flutter Test Queue"];
38 backendContext.
fQueue.reset([command_queue.get() retain]);
41 FML_LOG(
ERROR) <<
"Could not create the GrDirectContext from the Metal Device "
45 device_ = [
device.get() retain];
46 command_queue_ = [command_queue.get() retain];
50 std::scoped_lock lock(textures_mutex_);
53 [(__bridge
id)device_ release];
56 [(__bridge
id)command_queue_ release];
65 return command_queue_;
73 std::scoped_lock lock(textures_mutex_);
75 [[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatBGRA8Unorm
78 mipmapped:NO] retain]};
83 texture_descriptor.
get().usage = MTLTextureUsageUnknown;
85 if (!texture_descriptor) {
86 FML_CHECK(
false) <<
"Invalid texture descriptor.";
87 return {.texture_id = -1, .texture =
nullptr};
91 sk_cfp<void*>
texture = sk_cfp<void*>{[
device newTextureWithDescriptor:texture_descriptor.get()]};
94 FML_CHECK(
false) <<
"Could not create texture from texture descriptor.";
95 return {.texture_id = -1, .texture =
nullptr};
109 std::scoped_lock lock(textures_mutex_);
110 if (textures_.find(
texture_id) == textures_.end()) {
118 std::scoped_lock lock(textures_mutex_);
119 if (textures_.find(
texture_id) == textures_.end()) {
121 return {.texture_id = -1, .texture =
nullptr};
TextureInfo GetTextureInfo(int64_t texture_id)
void * GetMetalCommandQueue() const
sk_sp< GrDirectContext > GetSkiaContext() const
TextureInfo CreateMetalTexture(const SkISize &size)
Returns texture_id = -1 when texture creation fails.
void * GetMetalDevice() const
bool Present(int64_t texture_id)
T get() const __attribute((ns_returns_not_retained))
#define FML_LOG(severity)
#define FML_CHECK(condition)
SK_API sk_sp< GrDirectContext > MakeMetal(const GrMtlBackendContext &, const GrContextOptions &)
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
sk_cfp< GrMTLHandle > fDevice
sk_cfp< GrMTLHandle > fQueue