Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
include
private
gpu
graphite
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
11
#include "
include/core/SkString.h
"
12
#include "
include/gpu/graphite/GraphiteTypes.h
"
13
#include "
include/gpu/graphite/mtl/MtlGraphiteTypes.h
"
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
46
namespace
skgpu::graphite
{
47
48
struct
MtlTextureSpec
{
49
MtlTextureSpec
()
50
:
fFormat
(0)
51
,
fUsage
(0)
52
,
fStorageMode
(0)
53
,
fFramebufferOnly
(false) {}
54
MtlTextureSpec
(
const
MtlTextureInfo
&
info
)
55
:
fFormat
(
info
.
fFormat
)
56
,
fUsage
(
info
.
fUsage
)
57
,
fStorageMode
(
info
.
fStorageMode
)
58
,
fFramebufferOnly
(
info
.
fFramebufferOnly
) {}
59
60
bool
operator==
(
const
MtlTextureSpec
& that)
const
{
61
return
fFormat
== that.
fFormat
&&
62
fUsage
== that.
fUsage
&&
63
fStorageMode
== that.
fStorageMode
&&
64
fFramebufferOnly
== that.
fFramebufferOnly
;
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
&&
71
fFramebufferOnly
== that.
fFramebufferOnly
&&
72
(
fUsage
& that.
fUsage
) ==
fUsage
;
73
}
74
75
SkString
toString
()
const
{
76
return
SkStringPrintf
(
"format=%u,usage=0x%04X,storageMode=%u,framebufferOnly=%d"
,
77
fFormat
,
78
fUsage
,
79
fStorageMode
,
80
fFramebufferOnly
);
81
}
82
83
MtlPixelFormat
fFormat
;
84
MtlTextureUsage
fUsage
;
85
MtlStorageMode
fStorageMode
;
86
bool
fFramebufferOnly
;
87
};
88
89
MtlTextureInfo
MtlTextureSpecToTextureInfo
(
const
MtlTextureSpec
& mtlSpec,
90
uint32_t sampleCount,
91
Mipmapped
mipmapped);
92
93
}
// namespace skgpu::graphite
94
95
#endif
// skgpu_graphite_MtlGraphiteTypesPriv_DEFINED
info
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition
DM.cpp:213
GraphiteTypes.h
MtlGraphiteTypes.h
SkString.h
SkStringPrintf
SK_API SkString static SkString SkStringPrintf()
Definition
SkString.h:287
SkString
Definition
SkString.h:118
skgpu::graphite
Definition
BoundsManagerBench.cpp:27
skgpu::graphite::MtlPixelFormat
unsigned int MtlPixelFormat
Definition
MtlGraphiteTypes.h:35
skgpu::graphite::MtlStorageMode
unsigned int MtlStorageMode
Definition
MtlGraphiteTypes.h:37
skgpu::graphite::MtlTextureUsage
unsigned int MtlTextureUsage
Definition
MtlGraphiteTypes.h:36
skgpu::graphite::MtlTextureSpecToTextureInfo
MtlTextureInfo MtlTextureSpecToTextureInfo(const MtlTextureSpec &mtlSpec, uint32_t sampleCount, Mipmapped mipmapped)
Definition
MtlGraphiteTypes.mm:27
skgpu::Mipmapped
Mipmapped
Definition
GpuTypes.h:53
skgpu::graphite::MtlTextureInfo
Definition
MtlGraphiteTypes.h:39
skgpu::graphite::MtlTextureSpec
Definition
MtlGraphiteTypesPriv.h:48
skgpu::graphite::MtlTextureSpec::MtlTextureSpec
MtlTextureSpec()
Definition
MtlGraphiteTypesPriv.h:49
skgpu::graphite::MtlTextureSpec::fFormat
MtlPixelFormat fFormat
Definition
MtlGraphiteTypesPriv.h:83
skgpu::graphite::MtlTextureSpec::fFramebufferOnly
bool fFramebufferOnly
Definition
MtlGraphiteTypesPriv.h:86
skgpu::graphite::MtlTextureSpec::toString
SkString toString() const
Definition
MtlGraphiteTypesPriv.h:75
skgpu::graphite::MtlTextureSpec::MtlTextureSpec
MtlTextureSpec(const MtlTextureInfo &info)
Definition
MtlGraphiteTypesPriv.h:54
skgpu::graphite::MtlTextureSpec::operator==
bool operator==(const MtlTextureSpec &that) const
Definition
MtlGraphiteTypesPriv.h:60
skgpu::graphite::MtlTextureSpec::fUsage
MtlTextureUsage fUsage
Definition
MtlGraphiteTypesPriv.h:84
skgpu::graphite::MtlTextureSpec::isCompatible
bool isCompatible(const MtlTextureSpec &that) const
Definition
MtlGraphiteTypesPriv.h:67
skgpu::graphite::MtlTextureSpec::fStorageMode
MtlStorageMode fStorageMode
Definition
MtlGraphiteTypesPriv.h:85
Generated on Fri Apr 26 2024 06:16:14 for Flutter Engine by
1.9.8