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 "src/gpu/GrRenderTask.h" |
12 | |
13 | class GrTextureResolveRenderTask final : public GrRenderTask { |
14 | public: |
15 | GrTextureResolveRenderTask() : GrRenderTask() {} |
16 | ~GrTextureResolveRenderTask() override; |
17 | |
18 | void addProxy(sk_sp<GrSurfaceProxy> proxy, GrSurfaceProxy::ResolveFlags, const GrCaps&); |
19 | |
20 | private: |
21 | bool onIsUsed(GrSurfaceProxy* proxy) const override { |
22 | // This case should be handled by GrRenderTask. |
23 | SkASSERT(proxy != fTargetView.proxy()); |
24 | return false; |
25 | } |
26 | void handleInternalAllocationFailure() override { |
27 | // No need to do anything special here. We just double check the proxies during onExecute. |
28 | } |
29 | void gatherProxyIntervals(GrResourceAllocator*) const override; |
30 | |
31 | ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override { |
32 | return ExpectedOutcome::kTargetUnchanged; |
33 | } |
34 | |
35 | bool onExecute(GrOpFlushState*) override; |
36 | |
37 | #ifdef SK_DEBUG |
38 | SkDEBUGCODE(void visitProxies_debugOnly(const GrOp::VisitProxyFunc&) const override;) |
39 | #endif |
40 | |
41 | struct Resolve { |
42 | Resolve(sk_sp<GrSurfaceProxy> proxy, GrSurfaceProxy::ResolveFlags flags) |
43 | : fProxy(std::move(proxy)), fFlags(flags) {} |
44 | sk_sp<GrSurfaceProxy> fProxy; |
45 | GrSurfaceProxy::ResolveFlags fFlags; |
46 | SkIRect fMSAAResolveRect; |
47 | }; |
48 | |
49 | SkSTArray<4, Resolve> fResolves; |
50 | }; |
51 | |
52 | #endif |
53 |