Debian Codegraph @

include/gpu/ganesh/mtl/GrMtlTypes.h

raw
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
11 #include "include/gpu/GpuTypes.h"
12 #include "include/ports/SkCFObject.h"
13
14 /**
15 * Declares typedefs for Metal types used in Ganesh cpp code
16 */
17 using GrMTLPixelFormat = unsigned int;
18 using GrMTLTextureUsage = unsigned int;
19 using GrMTLStorageMode = unsigned int;
20 using 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 */
38 struct GrMtlTextureInfo {
39 public:
40 GrMtlTextureInfo() {}
41
42 sk_cfp<GrMTLHandle> fTexture;
43
44 bool operator==(const GrMtlTextureInfo& that) const { return fTexture == that.fTexture; }
45 };
46
47 struct GrMtlSurfaceInfo {
48 uint32_t fSampleCount = 1;
49 uint32_t fLevelCount = 0;
50 skgpu::Protected fProtected = skgpu::Protected::kNo;
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