Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
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:84
GrIOType
GrMipmapStatus
virtual void onAbandon()
virtual void onRelease()
id< MTLTexture > mtlTexture() const
void onRelease() override
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)
void textureParamsModified() override
GrBackendTexture getBackendTexture() const override
void onSetLabel() override
bool onStealBackendTexture(GrBackendTexture *, SkImages::BackendTextureReleaseProc *) override
id< MTLTexture > mtlTexture() const
GrMtlAttachment * attachment() const
GrBackendFormat backendFormat() const override
static sk_sp< GrMtlTexture > MakeWrappedTexture(GrMtlGpu *, SkISize, id< MTLTexture >, GrWrapCacheable, GrIOType)
void onAbandon() override
bool reallocForMipmap(GrMtlGpu *gpu, uint32_t mipLevels)
SkISize dimensions() const
Definition GrSurface.h:27
T * get() const
Definition SkRefCnt.h:303
uint32_t uint32_t * format
std::function< void(GrBackendTexture)> BackendTextureReleaseProc
Budgeted
Definition GpuTypes.h:35