Greg Daniel | fe71b9d | 2017-03-09 10:41:31 -0500 | [diff] [blame] | 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 | |
Greg Daniel | a5cb781 | 2017-06-16 09:45:32 -0400 | [diff] [blame] | 13 | #include "GrRenderTargetProxy.h" |
Greg Daniel | fe71b9d | 2017-03-09 10:41:31 -0500 | [diff] [blame] | 14 | #include "GrSemaphore.h" |
| 15 | #include "SkRefCnt.h" |
| 16 | |
| 17 | class GrSemaphoreOp : public GrOp { |
| 18 | public: |
Greg Daniel | a5cb781 | 2017-06-16 09:45:32 -0400 | [diff] [blame] | 19 | static std::unique_ptr<GrSemaphoreOp> MakeSignal(sk_sp<GrSemaphore> semaphore, |
Greg Daniel | a2cebd8 | 2017-06-21 16:09:50 -0400 | [diff] [blame] | 20 | GrRenderTargetProxy* proxy, |
| 21 | bool forceFlush); |
Greg Daniel | fe71b9d | 2017-03-09 10:41:31 -0500 | [diff] [blame] | 22 | |
Greg Daniel | a5cb781 | 2017-06-16 09:45:32 -0400 | [diff] [blame] | 23 | static std::unique_ptr<GrSemaphoreOp> MakeWait(sk_sp<GrSemaphore> semaphore, |
| 24 | GrRenderTargetProxy* proxy); |
Greg Daniel | fe71b9d | 2017-03-09 10:41:31 -0500 | [diff] [blame] | 25 | |
| 26 | protected: |
Greg Daniel | a5cb781 | 2017-06-16 09:45:32 -0400 | [diff] [blame] | 27 | GrSemaphoreOp(uint32_t classId, sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy) |
| 28 | : INHERITED(classId), fSemaphore(std::move(semaphore)) { |
Robert Phillips | 65a88fa | 2017-08-08 08:36:22 -0400 | [diff] [blame] | 29 | this->makeFullScreen(proxy); |
Greg Daniel | a5cb781 | 2017-06-16 09:45:32 -0400 | [diff] [blame] | 30 | } |
Greg Daniel | fe71b9d | 2017-03-09 10:41:31 -0500 | [diff] [blame] | 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 |