blob: 18e715755c8497187879af634a9fa9df9d4332a9 [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
Robert Phillips44e2c5f2020-04-14 13:00:04 -040039 const char* name() const final { return "Wait"; }
Greg Danielc30f1a92019-09-06 15:28:58 -040040 // No non-dst proxies.
Michael Ludwigfcdd0612019-11-25 08:34:31 -050041 void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override {}
Greg Danielc30f1a92019-09-06 15:28:58 -040042#endif
Greg Daniel301015c2019-11-18 14:06:46 -050043 std::unique_ptr<std::unique_ptr<GrSemaphore>[]> fSemaphores;
Greg Danielc30f1a92019-09-06 15:28:58 -040044 int fNumSemaphores;
45};
46
47#endif