blob: e7f55c9463c34c240e14107a3abcf9a58fedb95f [file] [log] [blame]
Chris Dalton3d770272019-08-14 09:24:37 -06001/*
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:
Greg Daniel16f5c652019-10-29 11:26:01 -040015 GrTextureResolveRenderTask() : GrRenderTask() {}
Chris Dalton3d770272019-08-14 09:24:37 -060016
Adlai Hollerd71b7b02020-06-08 15:55:00 -040017 void disown(GrDrawingManager*) override;
18
19 void addProxy(GrDrawingManager*, sk_sp<GrSurfaceProxy> proxy,
20 GrSurfaceProxy::ResolveFlags, const GrCaps&);
Chris Dalton6aeb8e82019-08-27 11:52:19 -060021
22private:
Chris Dalton3d770272019-08-14 09:24:37 -060023 bool onIsUsed(GrSurfaceProxy* proxy) const override {
Greg Daniel16f5c652019-10-29 11:26:01 -040024 // This case should be handled by GrRenderTask.
25 SkASSERT(proxy != fTargetView.proxy());
Chris Dalton3d770272019-08-14 09:24:37 -060026 return false;
27 }
Chris Daltone2a903e2019-09-18 13:41:50 -060028 void handleInternalAllocationFailure() override {
29 // No need to do anything special here. We just double check the proxies during onExecute.
30 }
Chris Dalton3d770272019-08-14 09:24:37 -060031 void gatherProxyIntervals(GrResourceAllocator*) const override;
Chris Daltonaa3cbb82019-08-21 00:01:21 -060032
Chris Dalton16a33c62019-09-24 22:19:17 -060033 ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override {
Chris Daltonaa3cbb82019-08-21 00:01:21 -060034 return ExpectedOutcome::kTargetUnchanged;
35 }
36
Chris Dalton3d770272019-08-14 09:24:37 -060037 bool onExecute(GrOpFlushState*) override;
38
Chris Daltonc4b47352019-08-23 10:10:36 -060039#ifdef SK_DEBUG
Robert Phillips44e2c5f2020-04-14 13:00:04 -040040 const char* name() const final { return "TextureResolve"; }
41 void visitProxies_debugOnly(const GrOp::VisitProxyFunc&) const override;
Chris Daltonc4b47352019-08-23 10:10:36 -060042#endif
43
Chris Daltone2a903e2019-09-18 13:41:50 -060044 struct Resolve {
Greg Daniel242536f2020-02-13 14:12:46 -050045 Resolve(sk_sp<GrSurfaceProxy> proxy, GrSurfaceProxy::ResolveFlags flags)
46 : fProxy(std::move(proxy)), fFlags(flags) {}
47 sk_sp<GrSurfaceProxy> fProxy;
Chris Daltone2a903e2019-09-18 13:41:50 -060048 GrSurfaceProxy::ResolveFlags fFlags;
Chris Dalton16a33c62019-09-24 22:19:17 -060049 SkIRect fMSAAResolveRect;
Chris Daltone2a903e2019-09-18 13:41:50 -060050 };
51
52 SkSTArray<4, Resolve> fResolves;
Chris Dalton3d770272019-08-14 09:24:37 -060053};
54
55#endif