xref: /aosp_15_r20/external/skia/src/gpu/ganesh/GrTextureResolveRenderTask.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2019 Google LLC
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 GrTextureResolveRenderTask_DEFINED
9 #define GrTextureResolveRenderTask_DEFINED
10 
11 #include "include/core/SkRect.h"
12 #include "include/core/SkRefCnt.h"
13 #include "include/private/base/SkDebug.h"
14 #include "include/private/base/SkTArray.h"
15 #include "include/private/gpu/ganesh/GrTypesPriv.h"
16 #include "src/gpu/ganesh/GrCaps.h"
17 #include "src/gpu/ganesh/GrRenderTask.h"
18 #include "src/gpu/ganesh/GrSurfaceProxy.h"
19 
20 class GrDrawingManager;
21 class GrOpFlushState;
22 class GrRecordingContext;
23 class GrResourceAllocator;
24 
25 class GrTextureResolveRenderTask final : public GrRenderTask {
26 public:
GrTextureResolveRenderTask()27     GrTextureResolveRenderTask() : GrRenderTask() {}
28 
29     void addProxy(GrDrawingManager*, sk_sp<GrSurfaceProxy> proxy,
30                   GrSurfaceProxy::ResolveFlags, const GrCaps&);
31 #if defined(GPU_TEST_UTILS)
32     GrSurfaceProxy::ResolveFlags flagsForProxy(sk_sp<GrSurfaceProxy>) const;
33 #endif
34 
35 private:
onIsUsed(GrSurfaceProxy * proxy)36     bool onIsUsed(GrSurfaceProxy* proxy) const override {
37         return false;
38     }
39     void gatherProxyIntervals(GrResourceAllocator*) const override;
40 
onMakeClosed(GrRecordingContext *,SkIRect *)41     ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect*) override {
42         return ExpectedOutcome::kTargetUnchanged;
43     }
44 
45     bool onExecute(GrOpFlushState*) override;
46 
47 #if defined(GPU_TEST_UTILS)
name()48     const char* name() const final { return "TextureResolve"; }
49 #endif
50 #ifdef SK_DEBUG
51     void visitProxies_debugOnly(const GrVisitProxyFunc&) const override;
52 #endif
53 
54     struct Resolve {
ResolveResolve55         Resolve(GrSurfaceProxy::ResolveFlags flags) : fFlags(flags) {}
56         GrSurfaceProxy::ResolveFlags fFlags;
57         SkIRect fMSAAResolveRect;
58     };
59 
60     skia_private::STArray<4, Resolve> fResolves;
61 };
62 
63 #endif
64