blob: bc6ddc38a4f51d8f6c04bb5fd3158b97712b0d7a [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:
Greg Daniel16f5c652019-10-29 11:26:01 -040016 GrWaitRenderTask(GrSurfaceProxyView surfaceView,
Greg Daniel301015c2019-11-18 14:06:46 -050017 std::unique_ptr<std::unique_ptr<GrSemaphore>[]> semaphores,
Greg Danielc30f1a92019-09-06 15:28:58 -040018 int numSemaphores)
Greg Daniel16f5c652019-10-29 11:26:01 -040019 : GrRenderTask(std::move(surfaceView))
Greg Danielc30f1a92019-09-06 15:28:58 -040020 , fSemaphores(std::move(semaphores))
Greg Daniel301015c2019-11-18 14:06:46 -050021 , fNumSemaphores(numSemaphores) {}
Greg Danielc30f1a92019-09-06 15:28:58 -040022
23private:
Greg Danielc30f1a92019-09-06 15:28:58 -040024 bool onIsUsed(GrSurfaceProxy* proxy) const override {
Greg Daniel16f5c652019-10-29 11:26:01 -040025 // This case should be handled by GrRenderTask.
26 SkASSERT(proxy != fTargetView.proxy());
Greg Danielc30f1a92019-09-06 15:28:58 -040027 return false;
28 }
29 void handleInternalAllocationFailure() override {}
30 void gatherProxyIntervals(GrResourceAllocator*) const override;
31
Chris Dalton16a33c62019-09-24 22:19:17 -060032 ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect*) override {
Greg Danielc30f1a92019-09-06 15:28:58 -040033 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 VisitSurfaceProxyFunc& fn) const override {}
41#endif
Greg Daniel301015c2019-11-18 14:06:46 -050042 std::unique_ptr<std::unique_ptr<GrSemaphore>[]> fSemaphores;
Greg Danielc30f1a92019-09-06 15:28:58 -040043 int fNumSemaphores;
44};
45
46#endif