Chris Dalton | 3d77027 | 2019-08-14 09:24:37 -0600 | [diff] [blame] | 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: |
Greg Daniel | 16f5c65 | 2019-10-29 11:26:01 -0400 | [diff] [blame] | 15 | GrTextureResolveRenderTask() : GrRenderTask() {} |
Chris Dalton | 3d77027 | 2019-08-14 09:24:37 -0600 | [diff] [blame] | 16 | |
Adlai Holler | d71b7b0 | 2020-06-08 15:55:00 -0400 | [diff] [blame^] | 17 | void disown(GrDrawingManager*) override; |
| 18 | |
| 19 | void addProxy(GrDrawingManager*, sk_sp<GrSurfaceProxy> proxy, |
| 20 | GrSurfaceProxy::ResolveFlags, const GrCaps&); |
Chris Dalton | 6aeb8e8 | 2019-08-27 11:52:19 -0600 | [diff] [blame] | 21 | |
| 22 | private: |
Chris Dalton | 3d77027 | 2019-08-14 09:24:37 -0600 | [diff] [blame] | 23 | bool onIsUsed(GrSurfaceProxy* proxy) const override { |
Greg Daniel | 16f5c65 | 2019-10-29 11:26:01 -0400 | [diff] [blame] | 24 | // This case should be handled by GrRenderTask. |
| 25 | SkASSERT(proxy != fTargetView.proxy()); |
Chris Dalton | 3d77027 | 2019-08-14 09:24:37 -0600 | [diff] [blame] | 26 | return false; |
| 27 | } |
Chris Dalton | e2a903e | 2019-09-18 13:41:50 -0600 | [diff] [blame] | 28 | void handleInternalAllocationFailure() override { |
| 29 | // No need to do anything special here. We just double check the proxies during onExecute. |
| 30 | } |
Chris Dalton | 3d77027 | 2019-08-14 09:24:37 -0600 | [diff] [blame] | 31 | void gatherProxyIntervals(GrResourceAllocator*) const override; |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 32 | |
Chris Dalton | 16a33c6 | 2019-09-24 22:19:17 -0600 | [diff] [blame] | 33 | ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override { |
Chris Dalton | aa3cbb8 | 2019-08-21 00:01:21 -0600 | [diff] [blame] | 34 | return ExpectedOutcome::kTargetUnchanged; |
| 35 | } |
| 36 | |
Chris Dalton | 3d77027 | 2019-08-14 09:24:37 -0600 | [diff] [blame] | 37 | bool onExecute(GrOpFlushState*) override; |
| 38 | |
Chris Dalton | c4b4735 | 2019-08-23 10:10:36 -0600 | [diff] [blame] | 39 | #ifdef SK_DEBUG |
Robert Phillips | 44e2c5f | 2020-04-14 13:00:04 -0400 | [diff] [blame] | 40 | const char* name() const final { return "TextureResolve"; } |
| 41 | void visitProxies_debugOnly(const GrOp::VisitProxyFunc&) const override; |
Chris Dalton | c4b4735 | 2019-08-23 10:10:36 -0600 | [diff] [blame] | 42 | #endif |
| 43 | |
Chris Dalton | e2a903e | 2019-09-18 13:41:50 -0600 | [diff] [blame] | 44 | struct Resolve { |
Greg Daniel | 242536f | 2020-02-13 14:12:46 -0500 | [diff] [blame] | 45 | Resolve(sk_sp<GrSurfaceProxy> proxy, GrSurfaceProxy::ResolveFlags flags) |
| 46 | : fProxy(std::move(proxy)), fFlags(flags) {} |
| 47 | sk_sp<GrSurfaceProxy> fProxy; |
Chris Dalton | e2a903e | 2019-09-18 13:41:50 -0600 | [diff] [blame] | 48 | GrSurfaceProxy::ResolveFlags fFlags; |
Chris Dalton | 16a33c6 | 2019-09-24 22:19:17 -0600 | [diff] [blame] | 49 | SkIRect fMSAAResolveRect; |
Chris Dalton | e2a903e | 2019-09-18 13:41:50 -0600 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | SkSTArray<4, Resolve> fResolves; |
Chris Dalton | 3d77027 | 2019-08-14 09:24:37 -0600 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | #endif |