#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 222 of file TextureInfo.cpp.
222 {
225 }
226
227 switch (fBackend) {
228#ifdef SK_DAWN
231#endif
232#ifdef SK_METAL
235#endif
236#ifdef SK_VULKAN
239#endif
240 default:
242 }
243}
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}
◆ toRPAttachmentString()
SkString skgpu::graphite::TextureInfo::toRPAttachmentString |
( |
| ) |
const |
Definition at line 174 of file TextureInfo.cpp.
174 {
175
176 switch (fBackend) {
177#ifdef SK_DAWN
180 static_cast<unsigned int>(fDawnSpec.fViewFormat), fSampleCount);
181#endif
182#ifdef SK_METAL
185 static_cast<unsigned int>(fMtlSpec.fFormat), fSampleCount);
186#endif
187#ifdef SK_VULKAN
190 static_cast<unsigned int>(fVkSpec.fFormat), fSampleCount);
191#endif
194 default:
196 }
197}
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
◆ 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 this->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 535 of file TextureUtils.cpp.
536 {
537
539
540 size_t colorSize = 0;
541
544 dimensions,
546 } else {
547
548
549 size_t bytesPerPixel =
info.bytesPerPixel();
550
551 colorSize = (size_t)dimensions.
width() * dimensions.
height() * bytesPerPixel;
552 }
553
554 size_t finalSize = colorSize *
info.numSamples();
555
557 finalSize += colorSize/3;
558 }
559 return finalSize;
560}
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: