Flutter Engine
 
Loading...
Searching...
No Matches
test_metal_context.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_TESTING_TEST_METAL_CONTEXT_H_
6#define FLUTTER_TESTING_TEST_METAL_CONTEXT_H_
7
8#include <map>
9#include <memory>
10#include <mutex>
11
12#include <Metal/Metal.h>
13
15#include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
16#include "third_party/skia/include/ports/SkCFObject.h"
17
18namespace flutter::testing {
19
20struct MetalObjCFields;
21
23 public:
24 struct TextureInfo {
25 int64_t texture_id;
26 void* texture;
27 };
28
30
32
33 id<MTLDevice> GetMetalDevice() const;
34
35 id<MTLCommandQueue> GetMetalCommandQueue() const;
36
37 sk_sp<GrDirectContext> GetSkiaContext() const;
38
39 /// Returns texture_id = -1 when texture creation fails.
41
42 bool Present(int64_t texture_id);
43
45
46 private:
47 id<MTLDevice> device_;
48 id<MTLCommandQueue> command_queue_;
49 sk_sp<GrDirectContext> skia_context_;
50 std::mutex textures_mutex_;
51 int64_t texture_id_ctr_ = 1; // guarded by textures_mutex
52 std::map<int64_t, sk_cfp<void*>> textures_; // guarded by textures_mutex
53};
54
55} // namespace flutter::testing
56
57#endif // FLUTTER_TESTING_TEST_METAL_CONTEXT_H_
id< MTLCommandQueue > GetMetalCommandQueue() const
TextureInfo GetTextureInfo(int64_t texture_id)
TextureInfo CreateMetalTexture(const DlISize &size)
Returns texture_id = -1 when texture creation fails.
sk_sp< GrDirectContext > GetSkiaContext() const
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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
int64_t texture_id