blob: 1a3aed001f2a4401ce9ff86f00cbff9d89dace2c [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 Daltone2a903e2019-09-18 13:41:50 -060016 ~GrTextureResolveRenderTask() override;
Chris Dalton3d770272019-08-14 09:24:37 -060017
Greg Daniel16f5c652019-10-29 11:26:01 -040018 void addProxy(GrSurfaceProxyView proxyView, GrSurfaceProxy::ResolveFlags, const GrCaps&);
Chris Dalton6aeb8e82019-08-27 11:52:19 -060019
20private:
Chris Dalton3d770272019-08-14 09:24:37 -060021 bool onIsUsed(GrSurfaceProxy* proxy) const override {
Greg Daniel16f5c652019-10-29 11:26:01 -040022 // This case should be handled by GrRenderTask.
23 SkASSERT(proxy != fTargetView.proxy());
Chris Dalton3d770272019-08-14 09:24:37 -060024 return false;
25 }
Chris Daltone2a903e2019-09-18 13:41:50 -060026 void handleInternalAllocationFailure() override {
27 // No need to do anything special here. We just double check the proxies during onExecute.
28 }
Chris Dalton3d770272019-08-14 09:24:37 -060029 void gatherProxyIntervals(GrResourceAllocator*) const override;
Chris Daltonaa3cbb82019-08-21 00:01:21 -060030
Chris Dalton16a33c62019-09-24 22:19:17 -060031 ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override {
Chris Daltonaa3cbb82019-08-21 00:01:21 -060032 return ExpectedOutcome::kTargetUnchanged;
33 }
34
Chris Dalton3d770272019-08-14 09:24:37 -060035 bool onExecute(GrOpFlushState*) override;
36
Chris Daltonc4b47352019-08-23 10:10:36 -060037#ifdef SK_DEBUG
Chris Daltone2a903e2019-09-18 13:41:50 -060038 SkDEBUGCODE(void visitProxies_debugOnly(const VisitSurfaceProxyFunc&) const override;)
Chris Daltonc4b47352019-08-23 10:10:36 -060039#endif
40
Chris Daltone2a903e2019-09-18 13:41:50 -060041 struct Resolve {
Greg Daniel16f5c652019-10-29 11:26:01 -040042 Resolve(GrSurfaceProxyView proxyView, GrSurfaceProxy::ResolveFlags flags)
43 : fProxyView(std::move(proxyView)), fFlags(flags) {}
44 GrSurfaceProxyView fProxyView;
Chris Daltone2a903e2019-09-18 13:41:50 -060045 GrSurfaceProxy::ResolveFlags fFlags;
Chris Dalton16a33c62019-09-24 22:19:17 -060046 SkIRect fMSAAResolveRect;
Chris Daltone2a903e2019-09-18 13:41:50 -060047 };
48
49 SkSTArray<4, Resolve> fResolves;
Chris Dalton3d770272019-08-14 09:24:37 -060050};
51
52#endif