Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [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 GrWaitRenderTask_DEFINED |
| 9 | #define GrWaitRenderTask_DEFINED |
| 10 | |
| 11 | #include "src/gpu/GrRenderTask.h" |
| 12 | #include "src/gpu/GrSemaphore.h" |
| 13 | |
| 14 | class GrWaitRenderTask final : public GrRenderTask { |
| 15 | public: |
Greg Daniel | 16f5c65 | 2019-10-29 11:26:01 -0400 | [diff] [blame] | 16 | GrWaitRenderTask(GrSurfaceProxyView surfaceView, |
Greg Daniel | 301015c | 2019-11-18 14:06:46 -0500 | [diff] [blame] | 17 | std::unique_ptr<std::unique_ptr<GrSemaphore>[]> semaphores, |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 18 | int numSemaphores) |
Greg Daniel | 16f5c65 | 2019-10-29 11:26:01 -0400 | [diff] [blame] | 19 | : GrRenderTask(std::move(surfaceView)) |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 20 | , fSemaphores(std::move(semaphores)) |
Greg Daniel | 301015c | 2019-11-18 14:06:46 -0500 | [diff] [blame] | 21 | , fNumSemaphores(numSemaphores) {} |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 22 | |
| 23 | private: |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 24 | bool onIsUsed(GrSurfaceProxy* proxy) const override { |
Greg Daniel | 16f5c65 | 2019-10-29 11:26:01 -0400 | [diff] [blame] | 25 | // This case should be handled by GrRenderTask. |
| 26 | SkASSERT(proxy != fTargetView.proxy()); |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 27 | return false; |
| 28 | } |
| 29 | void handleInternalAllocationFailure() override {} |
| 30 | void gatherProxyIntervals(GrResourceAllocator*) const override; |
| 31 | |
Chris Dalton | 16a33c6 | 2019-09-24 22:19:17 -0600 | [diff] [blame] | 32 | ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override { |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 33 | return ExpectedOutcome::kTargetUnchanged; |
| 34 | } |
| 35 | |
| 36 | bool onExecute(GrOpFlushState*) override; |
| 37 | |
| 38 | #ifdef SK_DEBUG |
Robert Phillips | 44e2c5f | 2020-04-14 13:00:04 -0400 | [diff] [blame^] | 39 | const char* name() const final { return "Wait"; } |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 40 | // No non-dst proxies. |
Michael Ludwig | fcdd061 | 2019-11-25 08:34:31 -0500 | [diff] [blame] | 41 | void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override {} |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 42 | #endif |
Greg Daniel | 301015c | 2019-11-18 14:06:46 -0500 | [diff] [blame] | 43 | std::unique_ptr<std::unique_ptr<GrSemaphore>[]> fSemaphores; |
Greg Daniel | c30f1a9 | 2019-09-06 15:28:58 -0400 | [diff] [blame] | 44 | int fNumSemaphores; |
| 45 | }; |
| 46 | |
| 47 | #endif |