Flutter Engine
The Flutter Engine
GrMtlTexture.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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 GrMtlTexture_DEFINED
9#define GrMtlTexture_DEFINED
10
11#import <Metal/Metal.h>
15
16class GrMtlGpu;
17
18class GrMtlTexture : public GrTexture {
19public:
21 skgpu::Budgeted budgeted,
23 MTLPixelFormat format,
24 uint32_t mipLevels,
26 std::string_view label);
27
29 SkISize,
30 id<MTLTexture>,
32 GrIOType);
33
34 ~GrMtlTexture() override;
35
36 GrMtlAttachment* attachment() const { return fTexture.get(); }
37 id<MTLTexture> mtlTexture() const { return fTexture->mtlTexture(); }
38
39 GrBackendTexture getBackendTexture() const override;
40
41 GrBackendFormat backendFormat() const override;
42
43 void textureParamsModified() override {}
44
45 bool reallocForMipmap(GrMtlGpu* gpu, uint32_t mipLevels);
46
47protected:
49 SkISize,
52 std::string_view label);
53
54 GrMtlGpu* getMtlGpu() const;
55
56 void onAbandon() override {
57 fTexture = nil;
59 }
60 void onRelease() override {
61 fTexture = nil;
63 }
64
66 return false;
67 }
68
69 void onSetLabel() override;
70
71private:
72 enum Wrapped { kWrapped };
73
76 SkISize,
79 std::string_view label);
80
82 Wrapped,
83 SkISize,
88 std::string_view label);
89
91
92 using INHERITED = GrTexture;
93};
94
95#endif
GrWrapCacheable
Definition: GrTypesPriv.h:85
GrIOType
Definition: GrTypesPriv.h:402
GrMipmapStatus
Definition: GrTypesPriv.h:523
id< MTLTexture > mtlTexture() const
void onRelease() override
Definition: GrMtlTexture.h:60
GrMtlGpu * getMtlGpu() const
~GrMtlTexture() override
static sk_sp< GrMtlTexture > MakeNewTexture(GrMtlGpu *, skgpu::Budgeted budgeted, SkISize dimensions, MTLPixelFormat format, uint32_t mipLevels, GrMipmapStatus, std::string_view label)
Definition: GrMtlTexture.mm:81
void textureParamsModified() override
Definition: GrMtlTexture.h:43
GrBackendTexture getBackendTexture() const override
void onSetLabel() override
bool onStealBackendTexture(GrBackendTexture *, SkImages::BackendTextureReleaseProc *) override
Definition: GrMtlTexture.h:65
id< MTLTexture > mtlTexture() const
Definition: GrMtlTexture.h:37
GrMtlAttachment * attachment() const
Definition: GrMtlTexture.h:36
GrBackendFormat backendFormat() const override
static sk_sp< GrMtlTexture > MakeWrappedTexture(GrMtlGpu *, SkISize, id< MTLTexture >, GrWrapCacheable, GrIOType)
Definition: GrMtlTexture.mm:98
void onAbandon() override
Definition: GrMtlTexture.h:56
GrMtlTexture(GrMtlGpu *, SkISize, sk_sp< GrMtlAttachment >, GrMipmapStatus, std::string_view label)
Definition: GrMtlTexture.mm:65
bool reallocForMipmap(GrMtlGpu *gpu, uint32_t mipLevels)
SkISize dimensions() const
Definition: GrSurface.h:27
void onAbandon() override
Definition: GrSurface.cpp:86
void onRelease() override
Definition: GrSurface.cpp:81
GrTexture(GrGpu *, const SkISize &, GrProtected, GrTextureType, GrMipmapStatus, std::string_view label)
Definition: GrTexture.cpp:42
T * get() const
Definition: SkRefCnt.h:303
uint32_t uint32_t * format
std::function< void(GrBackendTexture)> BackendTextureReleaseProc
Definition: SkImageGanesh.h:43
Budgeted
Definition: GpuTypes.h:35
Definition: SkSize.h:16