Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
MtlGraphiteTypesPriv.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 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 skgpu_graphite_MtlGraphiteTypesPriv_DEFINED
9#define skgpu_graphite_MtlGraphiteTypesPriv_DEFINED
10
14
15///////////////////////////////////////////////////////////////////////////////
16
17#ifdef __APPLE__
18
19#include <TargetConditionals.h>
20
21// We're using the MSL version as shorthand for the Metal SDK version here
22#if defined(SK_BUILD_FOR_MAC)
23#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000
24#define SKGPU_GRAPHITE_METAL_SDK_VERSION 300
25#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
26#define SKGPU_GRAPHITE_METAL_SDK_VERSION 240
27#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
28#define SKGPU_GRAPHITE_METAL_SDK_VERSION 230
29#else
30#error Must use at least 11.00 SDK to build Metal backend for MacOS
31#endif
32#else
33#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 160000 || __TV_OS_VERSION_MAX_ALLOWED >= 160000
34#define SKGPU_GRAPHITE_METAL_SDK_VERSION 300
35#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 || __TV_OS_VERSION_MAX_ALLOWED >= 150000
36#define SKGPU_GRAPHITE_METAL_SDK_VERSION 240
37#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 || __TV_OS_VERSION_MAX_ALLOWED >= 140000
38#define SKGPU_GRAPHITE_METAL_SDK_VERSION 230
39#else
40#error Must use at least 14.00 SDK to build Metal backend for iOS
41#endif
42#endif
43
44#endif // __APPLE__
45
46namespace skgpu::graphite {
47
50 : fFormat(0)
51 , fUsage(0)
52 , fStorageMode(0)
53 , fFramebufferOnly(false) {}
59
60 bool operator==(const MtlTextureSpec& that) const {
61 return fFormat == that.fFormat &&
62 fUsage == that.fUsage &&
63 fStorageMode == that.fStorageMode &&
65 }
66
67 bool isCompatible(const MtlTextureSpec& that) const {
68 // The usages may match or the usage passed in may be a superset of the usage stored within.
69 return fFormat == that.fFormat &&
70 fStorageMode == that.fStorageMode &&
72 (fUsage & that.fUsage) == fUsage;
73 }
74
76 return SkStringPrintf("format=%u,usage=0x%04X,storageMode=%u,framebufferOnly=%d",
77 fFormat,
78 fUsage,
81 }
82
87};
88
90 uint32_t sampleCount,
91 Mipmapped mipmapped);
92
93} // namespace skgpu::graphite
94
95#endif // skgpu_graphite_MtlGraphiteTypesPriv_DEFINED
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
SK_API SkString static SkString SkStringPrintf()
Definition SkString.h:287
unsigned int MtlPixelFormat
unsigned int MtlStorageMode
unsigned int MtlTextureUsage
MtlTextureInfo MtlTextureSpecToTextureInfo(const MtlTextureSpec &mtlSpec, uint32_t sampleCount, Mipmapped mipmapped)
Mipmapped
Definition GpuTypes.h:53
MtlTextureSpec(const MtlTextureInfo &info)
bool operator==(const MtlTextureSpec &that) const
bool isCompatible(const MtlTextureSpec &that) const