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: |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame^] | 19 | static std::unique_ptr<GrOp> MakeSignal(GrContext*, |
| 20 | sk_sp<GrSemaphore>, |
| 21 | GrRenderTargetProxy*, |
| 22 | bool forceFlush); |
Greg Daniel | fe71b9d | 2017-03-09 10:41:31 -0500 | [diff] [blame] | 23 | |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame^] | 24 | static std::unique_ptr<GrOp> MakeWait(GrContext*, |
| 25 | sk_sp<GrSemaphore>, |
| 26 | GrRenderTargetProxy*); |
Greg Daniel | fe71b9d | 2017-03-09 10:41:31 -0500 | [diff] [blame] | 27 | |
| 28 | protected: |
Greg Daniel | a5cb781 | 2017-06-16 09:45:32 -0400 | [diff] [blame] | 29 | GrSemaphoreOp(uint32_t classId, sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy) |
| 30 | : INHERITED(classId), fSemaphore(std::move(semaphore)) { |
Robert Phillips | 65a88fa | 2017-08-08 08:36:22 -0400 | [diff] [blame] | 31 | this->makeFullScreen(proxy); |
Greg Daniel | a5cb781 | 2017-06-16 09:45:32 -0400 | [diff] [blame] | 32 | } |
Greg Daniel | fe71b9d | 2017-03-09 10:41:31 -0500 | [diff] [blame] | 33 | |
| 34 | sk_sp<GrSemaphore> fSemaphore; |
| 35 | |
| 36 | private: |
| 37 | bool onCombineIfPossible(GrOp* that, const GrCaps& caps) override { return false; } |
| 38 | void onPrepare(GrOpFlushState*) override {} |
| 39 | |
| 40 | typedef GrOp INHERITED; |
| 41 | }; |
| 42 | |
| 43 | #endif |