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