1 /*
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 
13 #include "GrRenderTargetProxy.h"
14 #include "GrSemaphore.h"
15 #include "SkRefCnt.h"
16 
17 class GrSemaphoreOp : public GrOp {
18 public:
19     static std::unique_ptr<GrSemaphoreOp> MakeSignal(sk_sp<GrSemaphore> semaphore,
20                                                      GrRenderTargetProxy* proxy,
21                                                      bool forceFlush);
22 
23     static std::unique_ptr<GrSemaphoreOp> MakeWait(sk_sp<GrSemaphore> semaphore,
24                                                    GrRenderTargetProxy* proxy);
25 
26 protected:
27     GrSemaphoreOp(uint32_t classId, sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy)
28         : INHERITED(classId), fSemaphore(std::move(semaphore)) {
29         this->makeFullScreen(proxy);
30     }
31 
32     sk_sp<GrSemaphore> fSemaphore;
33 
34 private:
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
42