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