blob: fa6b02c4dec2032bb867565aab92bb3f5c8b9a75 [file] [log] [blame]
Greg Danielc30f1a92019-09-06 15:28:58 -04001/*
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
14class GrWaitRenderTask final : public GrRenderTask {
15public:
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
22private:
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