29 this->initGPUFamily(
device);
31 this->initShaderCaps();
33 this->initFormatTable(
device);
40bool MtlCaps::GetGPUFamily(id<MTLDevice>
device, GPUFamily* gpuFamily,
int*
group) {
41#if SKGPU_GRAPHITE_METAL_SDK_VERSION >= 220
42 if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
44#if SKGPU_GRAPHITE_METAL_SDK_VERSION >= 230
45 if ([
device supportsFamily:MTLGPUFamilyApple7]) {
46 *gpuFamily = GPUFamily::kApple;
51#ifdef SK_BUILD_FOR_IOS
52 if ([
device supportsFamily:MTLGPUFamilyApple6]) {
53 *gpuFamily = GPUFamily::kApple;
57 if ([
device supportsFamily:MTLGPUFamilyApple5]) {
58 *gpuFamily = GPUFamily::kApple;
62 if ([
device supportsFamily:MTLGPUFamilyApple4]) {
63 *gpuFamily = GPUFamily::kApple;
67 if ([
device supportsFamily:MTLGPUFamilyApple3]) {
68 *gpuFamily = GPUFamily::kApple;
72 if ([
device supportsFamily:MTLGPUFamilyApple2]) {
73 *gpuFamily = GPUFamily::kApple;
77 if ([
device supportsFamily:MTLGPUFamilyApple1]) {
78 *gpuFamily = GPUFamily::kApple;
85#if SKGPU_GRAPHITE_METAL_SDK_VERSION >= 300
88 *gpuFamily = GPUFamily::kMac;
94 if ([
device supportsFamily:MTLGPUFamilyMac2] ||
95 [
device supportsFamily:MTLGPUFamilyMacCatalyst2]) {
96 *gpuFamily = GPUFamily::kMac;
100 if ([
device supportsFamily:MTLGPUFamilyMac1] ||
101 [
device supportsFamily:MTLGPUFamilyMacCatalyst1]) {
102 *gpuFamily = GPUFamily::kMac;
114void MtlCaps::initGPUFamily(id<MTLDevice>
device) {
115 if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
116 if (GetGPUFamily(
device, &fGPUFamily, &fFamilyGroup)) {
122#ifdef SK_BUILD_FOR_MAC
123 fGPUFamily = GPUFamily::kMac;
126 fGPUFamily = GPUFamily::kApple;
131void MtlCaps::initCaps(
const id<MTLDevice>
device) {
132#if defined(GRAPHITE_TEST_UTILS)
133 this->setDeviceName([[
device name] UTF8String]);
136 if (this->
isMac() || fFamilyGroup >= 3) {
168 if (@available(macOS 10.12, iOS 14.0, tvOS 14.0, *)) {
175 fColorSampleCounts.push_back(1);
176 if (![
device.name containsString:
@"Intel"]) {
177 if (@available(macOS 10.11, iOS 9.0, tvOS 9.0, *)) {
178 for (
auto sampleCnt : {2, 4, 8}) {
179 if ([
device supportsTextureSampleCount:sampleCnt]) {
180 fColorSampleCounts.push_back(sampleCnt);
187void MtlCaps::initShaderCaps() {
191 if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, *)) {
203 if (@available(macOS 11.0, *)) {
222#define kMTLPixelFormatB5G6R5Unorm MTLPixelFormat(40)
223#define kMTLPixelFormatABGR4Unorm MTLPixelFormat(42)
224#define kMTLPixelFormatETC2_RGB8 MTLPixelFormat(180)
229 MTLPixelFormatRGBA8Unorm,
230 MTLPixelFormatR8Unorm,
231 MTLPixelFormatA8Unorm,
232 MTLPixelFormatBGRA8Unorm,
234 MTLPixelFormatRGBA16Float,
235 MTLPixelFormatR16Float,
236 MTLPixelFormatRG8Unorm,
237 MTLPixelFormatRGB10A2Unorm,
240 MTLPixelFormatRGBA8Unorm_sRGB,
241 MTLPixelFormatR16Unorm,
242 MTLPixelFormatRG16Unorm,
244#ifdef SK_BUILD_FOR_MAC
245 MTLPixelFormatBC1_RGBA,
247 MTLPixelFormatRGBA16Unorm,
248 MTLPixelFormatRG16Float,
250 MTLPixelFormatStencil8,
251 MTLPixelFormatDepth16Unorm,
252 MTLPixelFormatDepth32Float,
253#ifdef SK_BUILD_FOR_MAC
254 MTLPixelFormatDepth24Unorm_Stencil8,
256 MTLPixelFormatDepth32Float_Stencil8,
258 MTLPixelFormatInvalid,
261void MtlCaps::setColorType(
SkColorType colorType, std::initializer_list<MTLPixelFormat> formats) {
263 for (
auto it = formats.begin(); it != formats.end(); ++it) {
264 const auto&
info = this->getFormatInfo(*it);
265 for (
int i = 0;
i <
info.fColorTypeInfoCount; ++
i) {
267 fColorTypeToFormatTable[idx] = *it;
274size_t MtlCaps::GetFormatIndex(MTLPixelFormat pixelFormat) {
276 "Size of kMtlFormats array must match static value in header");
277 for (
size_t i = 0;
i < MtlCaps::kNumMtlFormats; ++
i) {
282 return GetFormatIndex(MTLPixelFormatInvalid);
285void MtlCaps::initFormatTable(
const id<MTLDevice>
device) {
288 if (@available(macOS 11.0, iOS 8.0, tvOS 9.0, *)) {
297 info = &fFormatTable[GetFormatIndex(MTLPixelFormatRGBA8Unorm)];
298 info->fFlags = FormatInfo::kAllFlags;
299 info->fColorTypeInfoCount = 2;
300 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
304 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
310 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
319 info = &fFormatTable[GetFormatIndex(MTLPixelFormatR8Unorm)];
320 info->fFlags = FormatInfo::kAllFlags;
321 info->fColorTypeInfoCount = 3;
322 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
326 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
332 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
340 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
349 info = &fFormatTable[GetFormatIndex(MTLPixelFormatA8Unorm)];
350 info->fFlags = FormatInfo::kTexturable_Flag;
351 info->fColorTypeInfoCount = 1;
352 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
356 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
364 info = &fFormatTable[GetFormatIndex(MTLPixelFormatBGRA8Unorm)];
365 info->fFlags = FormatInfo::kAllFlags;
366 info->fColorTypeInfoCount = 1;
367 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
371 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
377 if (@available(macOS 11.0, iOS 8.0, tvOS 9.0, *)) {
381 info = &fFormatTable[GetFormatIndex(MTLPixelFormatB5G6R5Unorm)];
382 info->fFlags = FormatInfo::kAllFlags;
383 info->fColorTypeInfoCount = 1;
384 info->fColorTypeInfos =
385 std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
389 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
398 info = &fFormatTable[GetFormatIndex(MTLPixelFormatABGR4Unorm)];
399 info->fFlags = FormatInfo::kAllFlags;
400 info->fColorTypeInfoCount = 1;
401 info->fColorTypeInfos =
402 std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
406 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
417 info = &fFormatTable[GetFormatIndex(MTLPixelFormatRGBA8Unorm_sRGB)];
418 info->fFlags = FormatInfo::kAllFlags;
419 info->fColorTypeInfoCount = 1;
420 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
424 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
432 info = &fFormatTable[GetFormatIndex(MTLPixelFormatRGB10A2Unorm)];
433 if (this->
isMac() || fFamilyGroup >= 3) {
434 info->fFlags = FormatInfo::kAllFlags;
436 info->fFlags = FormatInfo::kTexturable_Flag;
438 info->fColorTypeInfoCount = 1;
439 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
443 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
451 info = &fFormatTable[GetFormatIndex(MTLPixelFormatRGBA16Float)];
452 info->fFlags = FormatInfo::kAllFlags;
453 info->fColorTypeInfoCount = 2;
454 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
458 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
464 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
472 info = &fFormatTable[GetFormatIndex(MTLPixelFormatR16Float)];
473 info->fFlags = FormatInfo::kAllFlags;
474 info->fColorTypeInfoCount = 1;
475 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
479 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
489 info = &fFormatTable[GetFormatIndex(MTLPixelFormatRG8Unorm)];
490 info->fFlags = FormatInfo::kAllFlags;
491 info->fColorTypeInfoCount = 1;
492 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
496 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
504 info = &fFormatTable[GetFormatIndex(MTLPixelFormatRGBA16Unorm)];
506 info->fFlags = FormatInfo::kAllFlags;
508 info->fFlags = FormatInfo::kTexturable_Flag | FormatInfo::kRenderable_Flag;
510 info->fColorTypeInfoCount = 1;
511 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
515 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
523 info = &fFormatTable[GetFormatIndex(MTLPixelFormatRG16Float)];
524 info->fFlags = FormatInfo::kAllFlags;
525 info->fColorTypeInfoCount = 1;
526 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
530 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
538 info = &fFormatTable[GetFormatIndex(MTLPixelFormatR16Unorm)];
540 info->fFlags = FormatInfo::kAllFlags;
542 info->fFlags = FormatInfo::kTexturable_Flag | FormatInfo::kRenderable_Flag;
544 info->fColorTypeInfoCount = 1;
545 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
549 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
559 info = &fFormatTable[GetFormatIndex(MTLPixelFormatRG16Unorm)];
561 info->fFlags = FormatInfo::kAllFlags;
563 info->fFlags = FormatInfo::kTexturable_Flag | FormatInfo::kRenderable_Flag;
565 info->fColorTypeInfoCount = 1;
566 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
570 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
578 if (@available(macOS 11.0, iOS 8.0, tvOS 9.0, *)) {
580 info = &fFormatTable[GetFormatIndex(MTLPixelFormatETC2_RGB8)];
581 info->fFlags = FormatInfo::kTexturable_Flag;
582 info->fColorTypeInfoCount = 1;
583 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
587 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
597#ifdef SK_BUILD_FOR_MAC
599 info = &fFormatTable[GetFormatIndex(MTLPixelFormatBC1_RGBA)];
600 info->fFlags = FormatInfo::kTexturable_Flag;
601 info->fColorTypeInfoCount = 1;
602 info->fColorTypeInfos = std::make_unique<ColorTypeInfo[]>(
info->fColorTypeInfoCount);
606 auto& ctInfo =
info->fColorTypeInfos[ctIdx++];
620 info = &fFormatTable[GetFormatIndex(MTLPixelFormatStencil8)];
621 info->fFlags = FormatInfo::kMSAA_Flag;
622 info->fColorTypeInfoCount = 0;
627 info = &fFormatTable[GetFormatIndex(MTLPixelFormatDepth16Unorm)];
628 info->fFlags = FormatInfo::kMSAA_Flag;
629 if (this->
isMac() || fFamilyGroup >= 3) {
630 info->fFlags |= FormatInfo::kResolve_Flag;
632 info->fColorTypeInfoCount = 0;
637 info = &fFormatTable[GetFormatIndex(MTLPixelFormatDepth32Float)];
638 info->fFlags = FormatInfo::kMSAA_Flag;
639 if (this->
isMac() || fFamilyGroup >= 3) {
640 info->fFlags |= FormatInfo::kResolve_Flag;
642 info->fColorTypeInfoCount = 0;
647#ifdef SK_BUILD_FOR_MAC
648 if (this->
isMac() && [device isDepth24Stencil8PixelFormatSupported]) {
649 info = &fFormatTable[GetFormatIndex(MTLPixelFormatDepth24Unorm_Stencil8)];
650 info->fFlags = FormatInfo::kMSAA_Flag | FormatInfo::kResolve_Flag;
651 info->fColorTypeInfoCount = 0;
658 info = &fFormatTable[GetFormatIndex(MTLPixelFormatDepth32Float_Stencil8)];
659 info->fFlags = FormatInfo::kMSAA_Flag;
660 if (this->
isMac() || fFamilyGroup >= 3) {
661 info->fFlags |= FormatInfo::kResolve_Flag;
663 info->fColorTypeInfoCount = 0;
671 std::fill_n(fColorTypeToFormatTable,
kSkColorTypeCnt, MTLPixelFormatInvalid);
674 MTLPixelFormatA8Unorm });
675 if (@available(macOS 11.0, iOS 8.0, tvOS 9.0, *)) {
709 MTLTextureUsage
usage = MTLTextureUsageShaderRead;
711 usage |= MTLTextureUsageRenderTarget;
715 if (
format == MTLPixelFormatInvalid) {
720 info.fSampleCount = 1;
721 info.fMipmapped = mipmapped;
724 info.fStorageMode = MTLStorageModePrivate;
725 info.fFramebufferOnly =
false;
733 if (!textureInfo.getMtlTextureInfo(&
info)) {
737 info.fSampleCount = 1;
738 info.fMipmapped = mipmapped;
739 info.fUsage = MTLTextureUsageShaderRead;
740 info.fStorageMode = MTLStorageModePrivate;
741 info.fFramebufferOnly =
false;
748 switch (compression) {
752#ifdef SK_BUILD_FOR_MAC
753 return MTLPixelFormatBC1_RGBA;
756 return MTLPixelFormatInvalid;
764 MTLTextureUsage
usage = MTLTextureUsageShaderRead;
767 if (
format == MTLPixelFormatInvalid) {
772 info.fSampleCount = 1;
773 info.fMipmapped = mipmapped;
776 info.fStorageMode = MTLStorageModePrivate;
777 info.fFramebufferOnly =
false;
782MTLStorageMode MtlCaps::getDefaultMSAAStorageMode(
Discardable discardable)
const {
785 if (@available(macOS 11.0, iOS 10.0, tvOS 10.0, *)) {
786 return MTLStorageModeMemoryless;
790 return MTLStorageModePrivate;
798 const MtlTextureSpec& singleSpec = singleSampledInfo.mtlTextureSpec();
803 MTLTextureUsage
usage = MTLTextureUsageRenderTarget;
810 info.fStorageMode = this->getDefaultMSAAStorageMode(discardable);
811 info.fFramebufferOnly =
false;
816MTLPixelFormat MtlCaps::getFormatFromDepthStencilFlags(
823 return MTLPixelFormatDepth16Unorm;
825 return MTLPixelFormatStencil8;
827#if defined(SK_BUILD_FOR_MAC)
828 if (
SkToBool(this->getFormatInfo(MTLPixelFormatDepth24Unorm_Stencil8).
fFlags)) {
829 return MTLPixelFormatDepth24Unorm_Stencil8;
832 return MTLPixelFormatDepth32Float_Stencil8;
835 return MTLPixelFormatInvalid;
840 uint32_t sampleCount,
843 info.fSampleCount = sampleCount;
845 info.fFormat = this->getFormatFromDepthStencilFlags(depthStencilType);
846 info.fUsage = MTLTextureUsageRenderTarget;
848 info.fFramebufferOnly =
false;
855 MTLPixelFormat
format =
static_cast<MTLPixelFormat
>(this->getFormatFromColorType(
colorType));
856 if (
format == MTLPixelFormatInvalid) {
860 const FormatInfo& formatInfo = this->getFormatInfo(
format);
861 if (!
SkToBool(FormatInfo::kStorage_Flag & formatInfo.fFlags)) {
865 MTLTextureUsage
usage = MTLTextureUsageShaderWrite | MTLTextureUsageShaderRead;
867 info.fSampleCount = 1;
871 info.fStorageMode = MTLStorageModePrivate;
872 info.fFramebufferOnly =
false;
879 MTLPixelFormat mtlFormat =
static_cast<MTLPixelFormat
>(textureInfo.mtlTextureSpec().fFormat);
880 if (mtlFormat == MTLPixelFormatInvalid) {
884 const FormatInfo&
info = this->getFormatInfo(mtlFormat);
885 for (
int i = 0;
i <
info.fColorTypeInfoCount; ++
i) {
886 const ColorTypeInfo& ctInfo =
info.fColorTypeInfos[
i];
887 if (ctInfo.fColorType == ct) {
911 builder[2] = renderPassKey & 0xFFFFFFFF;
912 builder[3] = (renderPassKey >> 32) & 0xFFFFFFFF;
925 struct UnpackedKeyData {
927 uint32_t fRenderStepID = 0;
932 uint32_t fColorSampleCount = 1;
935 uint32_t fDSSampleCount = 1;
943 const uint32_t* rawKeyData =
key.data();
945 keyData.fRenderStepID = rawKeyData[0];
949 keyData.fDSFormat =
static_cast<MtlPixelFormat>((rawKeyData[2] >> 16) & 0xFFFF);
950 keyData.fDSSampleCount = rawKeyData[2] & 0xFFFF;
952 keyData.fColorFormat =
static_cast<MtlPixelFormat>((rawKeyData[3] >> 16) & 0xFFFF);
953 keyData.fColorSampleCount = rawKeyData[3] & 0xFFFF;
958 SkASSERT(keyData.fColorSampleCount == keyData.fDSSampleCount);
960 MTLPixelFormat dsFormat = (MTLPixelFormat) keyData.fDSFormat;
971 keyData.fColorFormat,
972 MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget,
973 MTLStorageModePrivate,
982 { .0f, .0f, .0f, .0f },
983 keyData.fColorSampleCount > 1,
984 keyData.fWriteSwizzle);
987 const RenderStep* renderStep = rendererProvider->
lookup(keyData.fRenderStepID);
1003 uint32_t dsAttachmentKey = depthStencilInfo.
fFormat << 16 | depthStencilInfo.
fSampleCount;
1004 return (((uint64_t) colorAttachmentKey) << 32) | dsAttachmentKey;
1029 if (!
info.isValid()) {
1032 if (!(
info.mtlTextureSpec().fUsage & MTLTextureUsageShaderRead)) {
1035 if (
info.mtlTextureSpec().fFramebufferOnly) {
1038 return this->isTexturable((MTLPixelFormat)
info.mtlTextureSpec().fFormat);
1041bool MtlCaps::isTexturable(MTLPixelFormat
format)
const {
1042 const FormatInfo& formatInfo = this->getFormatInfo(
format);
1043 return SkToBool(FormatInfo::kTexturable_Flag & formatInfo.fFlags);
1047 return info.isValid() &&
1048 (
info.mtlTextureSpec().fUsage & MTLTextureUsageRenderTarget) &&
1053 return sampleCount <= this->maxRenderTargetSampleCount(
format);
1057 if (!
info.isValid()) {
1060 if (!(
info.mtlTextureSpec().fUsage & MTLTextureUsageShaderWrite)) {
1063 if (
info.mtlTextureSpec().fFramebufferOnly) {
1066 const FormatInfo& formatInfo =
1067 this->getFormatInfo((MTLPixelFormat)
info.mtlTextureSpec().fFormat);
1068 return info.numSamples() == 1 &&
SkToBool(FormatInfo::kStorage_Flag & formatInfo.fFlags);
1071uint32_t MtlCaps::maxRenderTargetSampleCount(MTLPixelFormat
format)
const {
1072 const FormatInfo& formatInfo = this->getFormatInfo(
format);
1073 if (!
SkToBool(formatInfo.fFlags & FormatInfo::kRenderable_Flag)) {
1076 if (
SkToBool(formatInfo.fFlags & FormatInfo::kMSAA_Flag)) {
1077 return fColorSampleCounts[fColorSampleCounts.size() - 1];
1083bool MtlCaps::supportsWritePixels(
const TextureInfo& texInfo)
const {
1084 MtlTextureInfo mtlInfo;
1085 texInfo.getMtlTextureInfo(&mtlInfo);
1086 if (mtlInfo.fFramebufferOnly) {
1090 if (texInfo.numSamples() > 1) {
1097bool MtlCaps::supportsReadPixels(
const TextureInfo& texInfo)
const {
1098 MtlTextureInfo mtlInfo;
1099 texInfo.getMtlTextureInfo(&mtlInfo);
1100 if (mtlInfo.fFramebufferOnly) {
1109 if (texInfo.numSamples() > 1) {
1116std::pair<
SkColorType,
bool > MtlCaps::supportedWritePixelsColorType(
1118 const TextureInfo& dstTextureInfo,
1120 MtlTextureInfo mtlInfo;
1121 dstTextureInfo.getMtlTextureInfo(&mtlInfo);
1123 const FormatInfo&
info = this->getFormatInfo((MTLPixelFormat)mtlInfo.fFormat);
1124 for (
int i = 0;
i <
info.fColorTypeInfoCount; ++
i) {
1125 const auto& ctInfo =
info.fColorTypeInfos[
i];
1126 if (ctInfo.fColorType == dstColorType) {
1127 return {dstColorType,
false};
1133std::pair<
SkColorType,
bool > MtlCaps::supportedReadPixelsColorType(
1135 const TextureInfo& srcTextureInfo,
1137 MtlTextureInfo mtlInfo;
1138 srcTextureInfo.getMtlTextureInfo(&mtlInfo);
1142 SkASSERT(this->isTexturable((MTLPixelFormat)mtlInfo.fFormat));
1146 const FormatInfo&
info = this->getFormatInfo((MTLPixelFormat)mtlInfo.fFormat);
1147 for (
int i = 0;
i <
info.fColorTypeInfoCount; ++
i) {
1148 const auto& ctInfo =
info.fColorTypeInfos[
i];
1149 if (ctInfo.fColorType == srcColorType) {
1150 return {srcColorType,
false};
1168 static_assert(
sizeof(MTLPixelFormat) <=
sizeof(uint64_t));
1170 uint64_t formatKey =
static_cast<uint64_t
>(mtlSpec.
fFormat);
1182 SkASSERT(
static_cast<uint32_t
>(isMipped) < (1u << 1));
1183 SkASSERT(
static_cast<uint32_t
>(isProtected) < (1u << 1));
1186 SkASSERT(
static_cast<uint32_t
>(isFBOnly) < (1u << 1));
1189 static int kNum32DataCnt = 2 + 2 + 1;
1195 builder[2] = formatKey & 0xFFFFFFFF;
1196 builder[3] = (formatKey >> 32) & 0xFFFFFFFF;
1197 builder[4] = (samplesKey << 0) |
1198 (
static_cast<uint32_t
>(isMipped) << 3) |
1199 (
static_cast<uint32_t
>(isProtected) << 4) |
1200 (
static_cast<uint32_t
>(mtlSpec.
fUsage) << 5) |
1202 (
static_cast<uint32_t
>(isFBOnly) << 12);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define kMTLPixelFormatB5G6R5Unorm
#define kMTLPixelFormatETC2_RGB8
#define kMTLPixelFormatABGR4Unorm
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kSRGBA_8888_SkColorType
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
@ kA16_float_SkColorType
pixel with a half float for alpha
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
@ kUnknown_SkColorType
uninitialized
@ kR16G16_float_SkColorType
pixel with a half float for red and green
static constexpr int kSkColorTypeCnt
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static constexpr bool SkToBool(const T &x)
static Swizzle Make(uint16_t key)
constexpr uint16_t asKey() const
static constexpr Swizzle RGB1()
static Domain GenerateDomain()
size_t fRequiredStorageBufferAlignment
size_t fRequiredUniformBufferAlignment
bool fStorageBufferPreferred
bool fClampToBorderSupport
std::unique_ptr< SkSL::ShaderCaps > fShaderCaps
bool fStorageBufferSupport
static uint32_t SamplesToKey(uint32_t numSamples)
void finishInitialization(const ContextOptions &)
size_t fRequiredTransferBufferAlignment
const SkSL::ShaderCaps * shaderCaps() const
ResourceBindingRequirements fResourceBindingReqs
const ComputeStep * computeStep() const
uint32_t uniqueID() const
UniquePaintParamsID paintParamsID() const
uint32_t renderStepID() const
void buildKeyForTexture(SkISize dimensions, const TextureInfo &, ResourceType, Shareable, GraphiteResourceKey *) const override
TextureInfo getDefaultMSAATextureInfo(const TextureInfo &singleSampledInfo, Discardable discardable) const override
TextureInfo getTextureInfoForSampledCopy(const TextureInfo &textureInfo, Mipmapped mipmapped) const override
TextureInfo getDefaultCompressedTextureInfo(SkTextureCompressionType, Mipmapped mipmapped, Protected) const override
bool extractGraphicsDescs(const UniqueKey &, GraphicsPipelineDesc *, RenderPassDesc *, const RendererProvider *) const override
bool isStorage(const TextureInfo &) const override
TextureInfo getDefaultSampledTextureInfo(SkColorType, Mipmapped mipmapped, Protected, Renderable) const override
MtlCaps(const id< MTLDevice >, const ContextOptions &)
TextureInfo getDefaultDepthStencilTextureInfo(SkEnumBitMask< DepthStencilFlags >, uint32_t sampleCount, Protected) const override
TextureInfo getDefaultStorageTextureInfo(SkColorType) const override
UniqueKey makeComputePipelineKey(const ComputePipelineDesc &) const override
uint64_t getRenderPassDescKey(const RenderPassDesc &) const
bool isRenderable(const TextureInfo &) const override
uint32_t channelMask(const TextureInfo &) const override
UniqueKey makeGraphicsPipelineKey(const GraphicsPipelineDesc &, const RenderPassDesc &) const override
const RenderStep * lookup(uint32_t uniqueID) const
static UniquePaintParamsID InvalidID()
uint32_t uint32_t * format
DEF_SWITCHES_START aot vmservice shared library name
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
unsigned int MtlPixelFormat
static const int kGraphicsPipelineKeyData32Count
static constexpr MTLPixelFormat kMtlFormats[]
static const skgpu::UniqueKey::Domain kGraphicsPipelineDomain
uint32_t MtlFormatChannels(MTLPixelFormat mtlFormat)
bool MtlFormatIsStencil(MTLPixelFormat format)
bool MtlFormatIsDepth(MTLPixelFormat format)
bool MtlFormatIsCompressed(MTLPixelFormat mtlFormat)
static void usage(char *argv0)
constexpr int32_t width() const
constexpr int32_t height() const
bool fDualSourceBlendingSupport
const char * fFloatBufferArrayName
const char * fFBFetchColorName
bool fShaderDerivativeSupport
bool fFlatInterpolationSupport
bool fInverseHyperbolicSupport
bool fNonsquareMatrixSupport
bool fUsesPrecisionModifiers
MtlStorageMode fStorageMode
AttachmentDesc fDepthStencilAttachment
AttachmentDesc fColorAttachment
static RenderPassDesc Make(const Caps *caps, const TextureInfo &targetInfo, LoadOp loadOp, StoreOp storeOp, SkEnumBitMask< DepthStencilFlags > depthStencilFlags, const std::array< float, 4 > &clearColor, bool requiresMSAA, Swizzle writeSwizzle)
Layout fUniformBufferLayout
bool fDistinctIndexRanges
Layout fStorageBufferLayout