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: GrSemaphoreOp(uint32_t classId,sk_sp<GrSemaphore> semaphore,GrRenderTargetProxy * proxy)27 GrSemaphoreOp(uint32_t classId, sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy) 28 : INHERITED(classId), fSemaphore(std::move(semaphore)) { 29 this->setBounds(SkRect::MakeIWH(proxy->width(), proxy->height()), 30 HasAABloat::kNo, IsZeroArea::kNo); 31 } 32 33 sk_sp<GrSemaphore> fSemaphore; 34 35 private: onCombineIfPossible(GrOp * that,const GrCaps & caps)36 bool onCombineIfPossible(GrOp* that, const GrCaps& caps) override { return false; } onPrepare(GrOpFlushState *)37 void onPrepare(GrOpFlushState*) override {} 38 39 typedef GrOp INHERITED; 40 }; 41 42 #endif 43