#include <TextureInfo.h>
Definition at line 31 of file TextureInfo.h.
◆ TextureInfo() [1/2]
skgpu::graphite::TextureInfo::TextureInfo |
( |
| ) |
|
|
inline |
◆ ~TextureInfo()
skgpu::graphite::TextureInfo::~TextureInfo |
( |
| ) |
|
|
inline |
◆ TextureInfo() [2/2]
skgpu::graphite::TextureInfo::TextureInfo |
( |
const TextureInfo & |
| ) |
|
|
default |
◆ backend()
BackendApi skgpu::graphite::TextureInfo::backend |
( |
| ) |
const |
|
inline |
◆ compressionType()
Definition at line 197 of file TextureInfo.cpp.
197 {
200 }
201
202 switch (fBackend) {
203#ifdef SK_DAWN
206#endif
207#ifdef SK_METAL
210#endif
211#ifdef SK_VULKAN
214#endif
215 default:
217 }
218}
SkTextureCompressionType DawnFormatToCompressionType(wgpu::TextureFormat format)
SkTextureCompressionType MtlFormatToCompressionType(MtlPixelFormat format)
static constexpr SkTextureCompressionType VkFormatToCompressionType(VkFormat vkFormat)
◆ isCompatible()
bool skgpu::graphite::TextureInfo::isCompatible |
( |
const TextureInfo & |
that | ) |
const |
Definition at line 98 of file TextureInfo.cpp.
98 {
99 if (!this->
isValid() || !that.isValid()) {
100 return false;
101 }
102
103 if (fSampleCount != that.fSampleCount ||
104 fMipmapped != that.fMipmapped ||
105 fProtected != that.fProtected) {
106 return false;
107 }
108
109 if (fBackend != that.fBackend) {
110 return false;
111 }
112
113 switch (fBackend) {
114#ifdef SK_DAWN
116 return fDawnSpec.isCompatible(that.fDawnSpec);
117#endif
118#ifdef SK_METAL
120 return fMtlSpec.isCompatible(that.fMtlSpec);
121#endif
122#ifdef SK_VULKAN
124 return fVkSpec.isCompatible(that.fVkSpec);
125#endif
126 default:
127 return false;
128 }
129}
◆ isProtected()
Protected skgpu::graphite::TextureInfo::isProtected |
( |
| ) |
const |
|
inline |
◆ isValid()
bool skgpu::graphite::TextureInfo::isValid |
( |
| ) |
const |
|
inline |
◆ mipmapped()
Mipmapped skgpu::graphite::TextureInfo::mipmapped |
( |
| ) |
const |
|
inline |
◆ numSamples()
uint32_t skgpu::graphite::TextureInfo::numSamples |
( |
| ) |
const |
|
inline |
◆ operator!=()
bool skgpu::graphite::TextureInfo::operator!= |
( |
const TextureInfo & |
that | ) |
const |
|
inline |
Definition at line 73 of file TextureInfo.h.
73{ return !(*this == that); }
◆ operator=()
Definition at line 28 of file TextureInfo.cpp.
28 {
29 if (!that.isValid()) {
30 fValid = false;
31 return *this;
32 }
33 fBackend = that.fBackend;
34 fSampleCount = that.fSampleCount;
35 fMipmapped = that.fMipmapped;
36 fProtected = that.fProtected;
37
38 switch (that.backend()) {
39#ifdef SK_DAWN
41 fDawnSpec = that.fDawnSpec;
42 break;
43#endif
44#ifdef SK_METAL
46 fMtlSpec = that.fMtlSpec;
47 break;
48#endif
49#ifdef SK_VULKAN
51 fVkSpec = that.fVkSpec;
52 break;
53#endif
54 default:
56 }
57
58 fValid = true;
59 return *this;
60}
#define SK_ABORT(message,...)
◆ operator==()
bool skgpu::graphite::TextureInfo::operator== |
( |
const TextureInfo & |
that | ) |
const |
Definition at line 62 of file TextureInfo.cpp.
62 {
63 if (!this->
isValid() && !that.isValid()) {
64 return true;
65 }
66 if (!this->
isValid() || !that.isValid()) {
67 return false;
68 }
69
70 if (fBackend != that.fBackend) {
71 return false;
72 }
73
74 if (fSampleCount != that.fSampleCount ||
75 fMipmapped != that.fMipmapped ||
76 fProtected != that.fProtected) {
77 return false;
78 }
79
80 switch (fBackend) {
81#ifdef SK_DAWN
83 return fDawnSpec == that.fDawnSpec;
84#endif
85#ifdef SK_METAL
87 return fMtlSpec == that.fMtlSpec;
88#endif
89#ifdef SK_VULKAN
91 return fVkSpec == that.fVkSpec;
92#endif
93 default:
94 return false;
95 }
96}
◆ toString()
SkString skgpu::graphite::TextureInfo::toString |
( |
| ) |
const |
Definition at line 141 of file TextureInfo.cpp.
141 {
143 switch (fBackend) {
144#ifdef SK_DAWN
146 ret.
appendf(
"Dawn(%s,", fDawnSpec.toString().c_str());
147 break;
148#endif
149#ifdef SK_METAL
151 ret.
appendf(
"Metal(%s,", fMtlSpec.toString().c_str());
152 break;
153#endif
154#ifdef SK_VULKAN
156 ret.
appendf(
"Vulkan(%s,", fVkSpec.toString().c_str());
157 break;
158#endif
160 ret += "Mock(";
161 break;
162 default:
163 ret += "Invalid(";
164 break;
165 }
166 ret.
appendf(
"bytesPerPixel=%zu,sampleCount=%u,mipmapped=%d,protected=%d)",
167 bytesPerPixel(),
168 fSampleCount,
169 static_cast<int>(fMipmapped),
170 static_cast<int>(fProtected));
171 return ret;
172}
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
◆ ComputeSize
Definition at line 516 of file TextureUtils.cpp.
517 {
518
520
521 size_t colorSize = 0;
522
525 dimensions,
526 info.mipmapped() == Mipmapped::kYes);
527 } else {
528
529
530 size_t bytesPerPixel =
info.bytesPerPixel();
531
532 colorSize = (size_t)dimensions.
width() * dimensions.
height() * bytesPerPixel;
533 }
534
535 size_t finalSize = colorSize *
info.numSamples();
536
537 if (
info.mipmapped() == Mipmapped::kYes) {
538 finalSize += colorSize/3;
539 }
540 return finalSize;
541}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
size_t SkCompressedFormatDataSize(SkTextureCompressionType compressionType, SkISize dimensions, bool mipmapped)
constexpr int32_t width() const
constexpr int32_t height() const
◆ fEnsureUnionNonEmpty
void* skgpu::graphite::TextureInfo::fEnsureUnionNonEmpty |
The documentation for this class was generated from the following files: