blob: 0a511c649a280694886acb939ccb9317dc97e74e [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:
Chris Daltone2a903e2019-09-18 13:41:50 -060015 GrTextureResolveRenderTask() : GrRenderTask(nullptr) {}
16 ~GrTextureResolveRenderTask() override;
Chris Dalton3d770272019-08-14 09:24:37 -060017
Chris Daltone2a903e2019-09-18 13:41:50 -060018 void addProxy(sk_sp<GrSurfaceProxy>, GrSurfaceProxy::ResolveFlags, const GrCaps&);
Chris Dalton6aeb8e82019-08-27 11:52:19 -060019
20private:
Chris Dalton3d770272019-08-14 09:24:37 -060021 void onPrepare(GrOpFlushState*) override {}
22 bool onIsUsed(GrSurfaceProxy* proxy) const override {
23 SkASSERT(proxy != fTarget.get()); // This case should be handled by GrRenderTask.
24 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
31 ExpectedOutcome onMakeClosed(const GrCaps&) override {
32 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 {
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 };
47
48 SkSTArray<4, Resolve> fResolves;
Chris Dalton3d770272019-08-14 09:24:37 -060049};
50
51#endif