36 if (mtlSpec.
fUsage & MTLTextureUsageRenderTarget &&
46 if (
info.mipmapped() == Mipmapped::kYes) {
50 sk_cfp<MTLTextureDescriptor*> desc([[MTLTextureDescriptor alloc] init]);
51 (*desc).textureType = (
info.numSamples() > 1) ? MTLTextureType2DMultisample : MTLTextureType2D;
52 (*desc).pixelFormat = (MTLPixelFormat)mtlSpec.
fFormat;
56 (*desc).mipmapLevelCount = numMipLevels;
57 (*desc).sampleCount =
info.numSamples();
58 (*desc).arrayLength = 1;
59 (*desc).usage = mtlSpec.
fUsage;
60 (*desc).storageMode = (MTLStorageMode)mtlSpec.
fStorageMode;
63#ifdef SK_ENABLE_MTL_DEBUG_INFO
64 if (mtlSpec.
fUsage & MTLTextureUsageRenderTarget) {
66 (*texture).label =
@"DepthStencil";
68 if (
info.numSamples() > 1) {
69 if (mtlSpec.
fUsage & MTLTextureUsageShaderRead) {
70 (*texture).label =
@"MSAA SampledTexture-ColorAttachment";
72 (*texture).label =
@"MSAA ColorAttachment";
75 if (mtlSpec.
fUsage & MTLTextureUsageShaderRead) {
76 (*texture).label =
@"SampledTexture-ColorAttachment";
78 (*texture).label =
@"ColorAttachment";
82 }
else if (mtlSpec.
fUsage & MTLTextureUsageShaderWrite) {
84 (*texture).label =
@"StorageTexture";
87 (*texture).label =
@"SampledTexture";
100 :
Texture(sharedContext, dimensions,
info, nullptr, ownership, budgeted)
static sk_sp< Texture > Make(const MtlSharedContext *, SkISize dimensions, const TextureInfo &, skgpu::Budgeted)
void freeGpuData() override
static sk_cfp< id< MTLTexture > > MakeMtlTexture(const MtlSharedContext *, SkISize dimensions, const TextureInfo &)
static sk_sp< Texture > MakeWrapped(const MtlSharedContext *, SkISize dimensions, const TextureInfo &, sk_cfp< id< MTLTexture > >)
const Caps * caps() const
SkISize dimensions() const
MtlStorageMode fStorageMode