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: |
| 16 | GrWaitRenderTask(sk_sp<GrSurfaceProxy> proxy, std::unique_ptr<sk_sp<GrSemaphore>[]> semaphores, |
| 17 | int numSemaphores) |
| 18 | : GrRenderTask(std::move(proxy)) |
| 19 | , fSemaphores(std::move(semaphores)) |
| 20 | , fNumSemaphores(numSemaphores){} |
| 21 | |
| 22 | private: |
| 23 | void onPrepare(GrOpFlushState*) override {} |
| 24 | bool onIsUsed(GrSurfaceProxy* proxy) const override { |
| 25 | SkASSERT(proxy != fTarget.get()); // This case should be handled by GrRenderTask. |
| 26 | return false; |
| 27 | } |
| 28 | void handleInternalAllocationFailure() override {} |
| 29 | void gatherProxyIntervals(GrResourceAllocator*) const override; |
| 30 | |
| 31 | ExpectedOutcome onMakeClosed(const GrCaps&) override { |
| 32 | return ExpectedOutcome::kTargetUnchanged; |
| 33 | } |
| 34 | |
| 35 | bool onExecute(GrOpFlushState*) override; |
| 36 | |
| 37 | #ifdef SK_DEBUG |
| 38 | // No non-dst proxies. |
| 39 | void visitProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const override {} |
| 40 | #endif |
| 41 | std::unique_ptr<sk_sp<GrSemaphore>[]> fSemaphores; |
| 42 | int fNumSemaphores; |
| 43 | }; |
| 44 | |
| 45 | #endif |