Flutter Engine
The Flutter Engine
GrMtlTypes.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrMtlTypes_DEFINED
9#define GrMtlTypes_DEFINED
10
13
14/**
15 * Declares typedefs for Metal types used in Ganesh cpp code
16 */
17using GrMTLPixelFormat = unsigned int;
18using GrMTLTextureUsage = unsigned int;
19using GrMTLStorageMode = unsigned int;
20using GrMTLHandle = const void*;
21
22///////////////////////////////////////////////////////////////////////////////
23
24#ifdef __APPLE__
25
26#include <TargetConditionals.h>
27
28#if TARGET_OS_SIMULATOR
29#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0), tvos(13.0))
30#else // TARGET_OS_SIMULATOR
31#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0), tvos(9.0))
32#endif // TARGET_OS_SIMULATOR
33
34/**
35 * Types for interacting with Metal resources created externally to Skia.
36 * This is used by GrBackendObjects.
37 */
38struct GrMtlTextureInfo {
39public:
40 GrMtlTextureInfo() {}
41
42 sk_cfp<GrMTLHandle> fTexture;
43
44 bool operator==(const GrMtlTextureInfo& that) const { return fTexture == that.fTexture; }
45};
46
47struct GrMtlSurfaceInfo {
48 uint32_t fSampleCount = 1;
49 uint32_t fLevelCount = 0;
51
52 // Since we aren't in an Obj-C header we can't directly use Mtl types here. Each of these can
53 // cast to their mapped Mtl types list below.
54 GrMTLPixelFormat fFormat = 0; // MTLPixelFormat fFormat = MTLPixelFormatInvalid;
55 GrMTLTextureUsage fUsage = 0; // MTLTextureUsage fUsage = MTLTextureUsageUnknown;
56 GrMTLStorageMode fStorageMode = 0; // MTLStorageMode fStorageMode = MTLStorageModeShared;
57};
58
59#endif
60
61#endif
unsigned int GrMTLStorageMode
Definition: GrMtlTypes.h:19
unsigned int GrMTLPixelFormat
Definition: GrMtlTypes.h:17
const void * GrMTLHandle
Definition: GrMtlTypes.h:20
unsigned int GrMTLTextureUsage
Definition: GrMtlTypes.h:18
bool operator==(C p1, const scoped_nsprotocol< C > &p2)
Protected
Definition: GpuTypes.h:61