Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
MtlGraphiteTypes.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google LLC
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 skgpu_graphite_MtlGraphiteTypes_DEFINED
9#define skgpu_graphite_MtlGraphiteTypes_DEFINED
10
13
14///////////////////////////////////////////////////////////////////////////////
15
16#ifdef __APPLE__
17
18#include <CoreFoundation/CoreFoundation.h>
19#include <TargetConditionals.h>
20
21#if TARGET_OS_SIMULATOR
22#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0), tvos(13.0))
23#else // TARGET_OS_SIMULATOR
24#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0), tvos(9.0))
25#endif // TARGET_OS_SIMULATOR
26
27#endif // __APPLE__
28
29
30namespace skgpu::graphite {
31
32/**
33 * Declares typedefs for Metal types used in Graphite cpp code
34 */
35using MtlPixelFormat = unsigned int;
36using MtlTextureUsage = unsigned int;
37using MtlStorageMode = unsigned int;
38
40 uint32_t fSampleCount = 1;
41 skgpu::Mipmapped fMipmapped = skgpu::Mipmapped::kNo;
42
43 // Since we aren't in an Obj-C header we can't directly use Mtl types here. Each of these can
44 // cast to their mapped Mtl types list below.
45 MtlPixelFormat fFormat = 0; // MTLPixelFormat fFormat = MTLPixelFormatInvalid;
46 MtlTextureUsage fUsage = 0; // MTLTextureUsage fUsage = MTLTextureUsageUnknown;
47 MtlStorageMode fStorageMode = 0; // MTLStorageMode fStorageMode = MTLStorageModeShared;
48 bool fFramebufferOnly = false;
49
50 MtlTextureInfo() = default;
51 MtlTextureInfo(CFTypeRef mtlTexture);
52 MtlTextureInfo(uint32_t sampleCount,
53 skgpu::Mipmapped mipmapped,
56 MtlStorageMode storageMode,
57 bool framebufferOnly)
58 : fSampleCount(sampleCount)
59 , fMipmapped(mipmapped)
61 , fUsage(usage)
62 , fStorageMode(storageMode)
63 , fFramebufferOnly(framebufferOnly) {}
64};
65
66} // namespace skgpu::graphite
67
68#endif // skgpu_graphite_MtlGraphiteTypes_DEFINED
Type::kYUV Type::kRGBA() int(0.7 *637)
uint32_t uint32_t * format
unsigned int MtlPixelFormat
unsigned int MtlStorageMode
unsigned int MtlTextureUsage
Mipmapped
Definition GpuTypes.h:53
static void usage(char *argv0)
MtlTextureInfo(uint32_t sampleCount, skgpu::Mipmapped mipmapped, MtlPixelFormat format, MtlTextureUsage usage, MtlStorageMode storageMode, bool framebufferOnly)