Debian Codegraph @

src/gpu/ganesh/mtl/GrMtlTextureRenderTarget.h

raw
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 GrMtlTextureRenderTarget_DEFINED
9 #define GrMtlTextureRenderTarget_DEFINED
10
11 #include "src/gpu/ganesh/mtl/GrMtlRenderTarget.h"
12 #include "src/gpu/ganesh/mtl/GrMtlTexture.h"
13
14 class GrMtlTextureRenderTarget: public GrMtlTexture, public GrMtlRenderTarget {
15 public:
16 static sk_sp<GrMtlTextureRenderTarget> MakeNewTextureRenderTarget(GrMtlGpu*,
17 skgpu::Budgeted,
18 SkISize,
19 int sampleCnt,
20 MTLPixelFormat,
21 uint32_t mipLevels,
22 GrMipmapStatus,
23 std::string_view label);
24
25 static sk_sp<GrMtlTextureRenderTarget> MakeWrappedTextureRenderTarget(GrMtlGpu*,
26 SkISize,
27 int sampleCnt,
28 id<MTLTexture>,
29 GrWrapCacheable);
30 GrBackendFormat backendFormat() const override {
31 return GrMtlTexture::backendFormat();
32 }
33
34 protected:
35 void onAbandon() override {
36 GrMtlRenderTarget::onAbandon();
37 GrMtlTexture::onAbandon();
38 }
39
40 void onRelease() override {
41 GrMtlRenderTarget::onRelease();
42 GrMtlTexture::onRelease();
43 }
44
45 private:
46 GrMtlTextureRenderTarget(GrMtlGpu* gpu,
47 skgpu::Budgeted budgeted,
48 SkISize,
49 sk_sp<GrMtlAttachment> texture,
50 sk_sp<GrMtlAttachment> colorAttachment,
51 sk_sp<GrMtlAttachment> resolveAttachment,
52 GrMipmapStatus,
53 std::string_view label);
54
55 GrMtlTextureRenderTarget(GrMtlGpu* gpu,
56 SkISize,
57 sk_sp<GrMtlAttachment> texture,
58 sk_sp<GrMtlAttachment> colorAttachment,
59 sk_sp<GrMtlAttachment> resolveAttachment,
60 GrMipmapStatus,
61 GrWrapCacheable cacheable,
62 std::string_view label);
63
64 size_t onGpuMemorySize() const override;
65
66 void onSetLabel() override;
67 };
68
69 #endif