Flutter Engine
The Flutter Engine
GrMtlAttachment.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 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 GrMtlAttachment_DEFINED
9#define GrMtlAttachment_DEFINED
10
13
14#import <Metal/Metal.h>
15
16class GrBackendFormat;
17class GrMtlGpu;
18
20public:
23 int sampleCnt,
24 MTLPixelFormat format);
25
28 int sampleCnt,
29 MTLPixelFormat format);
30
33 MTLPixelFormat format,
34 uint32_t mipLevels,
35 GrRenderable renderable,
36 int numSamples,
37 skgpu::Budgeted budgeted);
38
41 id<MTLTexture>,
42 UsageFlags attachmentUsages,
44 std::string_view label);
45
46 ~GrMtlAttachment() override;
47
48 GrBackendFormat backendFormat() const override;
49
50 MTLPixelFormat mtlFormat() const { return fTexture.pixelFormat; }
51
52 id<MTLTexture> mtlTexture() const { return fTexture; }
53
54 unsigned int sampleCount() const { return SkToU32(fTexture.sampleCount); }
55
56 bool framebufferOnly() const { return fTexture.framebufferOnly; }
57
58protected:
59 void onRelease() override;
60 void onAbandon() override;
61
62private:
63 static sk_sp<GrMtlAttachment> Make(GrMtlGpu* gpu,
65 UsageFlags attachmentUsages,
66 int sampleCnt,
67 MTLPixelFormat format,
68 uint32_t mipLevels,
69 int mtlTextureUsage,
70 int mtlStorageMode,
72
76 id<MTLTexture> texture,
78 std::string_view label);
79
83 id<MTLTexture> texture,
85 std::string_view label);
86
87 GrMtlGpu* getMtlGpu() const;
88
89 void onSetLabel() override;
90
91 id<MTLTexture> fTexture;
92};
93
94#endif
GrWrapCacheable
Definition: GrTypesPriv.h:85
constexpr uint32_t SkToU32(S x)
Definition: SkTo.h:26
int numSamples() const
Definition: GrAttachment.h:38
UsageFlags supportedUsages() const
Definition: GrAttachment.h:36
GrBackendFormat backendFormat() const override
~GrMtlAttachment() override
void onAbandon() override
static sk_sp< GrMtlAttachment > MakeTexture(GrMtlGpu *gpu, SkISize dimensions, MTLPixelFormat format, uint32_t mipLevels, GrRenderable renderable, int numSamples, skgpu::Budgeted budgeted)
MTLPixelFormat mtlFormat() const
static sk_sp< GrMtlAttachment > MakeWrapped(GrMtlGpu *gpu, SkISize dimensions, id< MTLTexture >, UsageFlags attachmentUsages, GrWrapCacheable, std::string_view label)
bool framebufferOnly() const
unsigned int sampleCount() const
void onRelease() override
id< MTLTexture > mtlTexture() const
static sk_sp< GrMtlAttachment > MakeStencil(GrMtlGpu *gpu, SkISize dimensions, int sampleCnt, MTLPixelFormat format)
static sk_sp< GrMtlAttachment > MakeMSAA(GrMtlGpu *gpu, SkISize dimensions, int sampleCnt, MTLPixelFormat format)
SkISize dimensions() const
Definition: GrSurface.h:27
uint32_t uint32_t * format
FlTexture * texture
Budgeted
Definition: GpuTypes.h:35
Renderable
Definition: GpuTypes.h:69
Definition: SkSize.h:16