blob: 1acc6a7825170c6a79756b781773dab7aa666312 [file] [log] [blame]
Greg Danielfe71b9d2017-03-09 10:41:31 -05001/*
2 * Copyright 2017 Google Inc.
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 GrSemaphoreOp_DEFINED
9#define GrSemaphoreOp_DEFINED
10
11#include "GrOp.h"
12
Greg Daniela5cb7812017-06-16 09:45:32 -040013#include "GrRenderTargetProxy.h"
Greg Danielfe71b9d2017-03-09 10:41:31 -050014#include "GrSemaphore.h"
15#include "SkRefCnt.h"
16
17class GrSemaphoreOp : public GrOp {
18public:
Greg Daniela5cb7812017-06-16 09:45:32 -040019 static std::unique_ptr<GrSemaphoreOp> MakeSignal(sk_sp<GrSemaphore> semaphore,
Greg Daniela2cebd82017-06-21 16:09:50 -040020 GrRenderTargetProxy* proxy,
21 bool forceFlush);
Greg Danielfe71b9d2017-03-09 10:41:31 -050022
Greg Daniela5cb7812017-06-16 09:45:32 -040023 static std::unique_ptr<GrSemaphoreOp> MakeWait(sk_sp<GrSemaphore> semaphore,
24 GrRenderTargetProxy* proxy);
Greg Danielfe71b9d2017-03-09 10:41:31 -050025
26protected:
Greg Daniela5cb7812017-06-16 09:45:32 -040027 GrSemaphoreOp(uint32_t classId, sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy)
28 : INHERITED(classId), fSemaphore(std::move(semaphore)) {
Robert Phillips65a88fa2017-08-08 08:36:22 -040029 this->makeFullScreen(proxy);
Greg Daniela5cb7812017-06-16 09:45:32 -040030 }
Greg Danielfe71b9d2017-03-09 10:41:31 -050031
32 sk_sp<GrSemaphore> fSemaphore;
33
34private:
35 bool onCombineIfPossible(GrOp* that, const GrCaps& caps) override { return false; }
36 void onPrepare(GrOpFlushState*) override {}
37
38 typedef GrOp INHERITED;
39};
40
41#endif