diff options
author | 2017-06-15 15:25:38 -0400 | |
---|---|---|
committer | 2017-06-15 19:49:18 +0000 | |
commit | 66366c697853e906d961ae691e2bc5209cdcfa62 (patch) | |
tree | f90de7fef9bd094ded9f6497c0004876694cca61 /src/gpu/ops | |
parent | 000182881a65ef4b12ca3739d47c5e21e79ca919 (diff) |
Add API for flushing surfaces with gpu semaphores
BUG=skia:
Change-Id: Ia4bfef784cd5f2516ceccafce958be18a86f91d1
Reviewed-on: https://skia-review.googlesource.com/11488
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Forrest Reiling <freiling@google.com>
Diffstat (limited to 'src/gpu/ops')
-rw-r--r-- | src/gpu/ops/GrSemaphoreOp.cpp | 30 | ||||
-rw-r--r-- | src/gpu/ops/GrSemaphoreOp.h | 14 |
2 files changed, 28 insertions, 16 deletions
diff --git a/src/gpu/ops/GrSemaphoreOp.cpp b/src/gpu/ops/GrSemaphoreOp.cpp index e83096d52a..f50d9c056d 100644 --- a/src/gpu/ops/GrSemaphoreOp.cpp +++ b/src/gpu/ops/GrSemaphoreOp.cpp @@ -14,15 +14,17 @@ class GrSignalSemaphoreOp final : public GrSemaphoreOp { public: DEFINE_OP_CLASS_ID - static std::unique_ptr<GrSignalSemaphoreOp> Make(sk_sp<GrSemaphore> semaphore) { - return std::unique_ptr<GrSignalSemaphoreOp>(new GrSignalSemaphoreOp(std::move(semaphore))); + static std::unique_ptr<GrSignalSemaphoreOp> Make(sk_sp<GrSemaphore> semaphore, + GrRenderTargetProxy* proxy) { + return std::unique_ptr<GrSignalSemaphoreOp>(new GrSignalSemaphoreOp(std::move(semaphore), + proxy)); } const char* name() const override { return "SignalSemaphore"; } private: - explicit GrSignalSemaphoreOp(sk_sp<GrSemaphore> semaphore) - : INHERITED(ClassID(), std::move(semaphore)) {} + explicit GrSignalSemaphoreOp(sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy) + : INHERITED(ClassID(), std::move(semaphore), proxy) {} void onExecute(GrOpFlushState* state) override { state->gpu()->insertSemaphore(fSemaphore); @@ -35,15 +37,17 @@ class GrWaitSemaphoreOp final : public GrSemaphoreOp { public: DEFINE_OP_CLASS_ID - static std::unique_ptr<GrWaitSemaphoreOp> Make(sk_sp<GrSemaphore> semaphore) { - return std::unique_ptr<GrWaitSemaphoreOp>(new GrWaitSemaphoreOp(std::move(semaphore))); + static std::unique_ptr<GrWaitSemaphoreOp> Make(sk_sp<GrSemaphore> semaphore, + GrRenderTargetProxy* proxy) { + return std::unique_ptr<GrWaitSemaphoreOp>(new GrWaitSemaphoreOp(std::move(semaphore), + proxy)); } const char* name() const override { return "WaitSemaphore"; } private: - explicit GrWaitSemaphoreOp(sk_sp<GrSemaphore> semaphore) - : INHERITED(ClassID(), std::move(semaphore)) {} + explicit GrWaitSemaphoreOp(sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy) + : INHERITED(ClassID(), std::move(semaphore), proxy) {} void onExecute(GrOpFlushState* state) override { state->gpu()->waitSemaphore(fSemaphore); @@ -54,12 +58,14 @@ private: //////////////////////////////////////////////////////////////////////////////// -std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeSignal(sk_sp<GrSemaphore> semaphore) { - return GrSignalSemaphoreOp::Make(std::move(semaphore)); +std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeSignal(sk_sp<GrSemaphore> semaphore, + GrRenderTargetProxy* proxy) { + return GrSignalSemaphoreOp::Make(std::move(semaphore), proxy); } -std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeWait(sk_sp<GrSemaphore> semaphore) { - return GrWaitSemaphoreOp::Make(std::move(semaphore)); +std::unique_ptr<GrSemaphoreOp> GrSemaphoreOp::MakeWait(sk_sp<GrSemaphore> semaphore, + GrRenderTargetProxy* proxy) { + return GrWaitSemaphoreOp::Make(std::move(semaphore), proxy); } diff --git a/src/gpu/ops/GrSemaphoreOp.h b/src/gpu/ops/GrSemaphoreOp.h index a88b66cfc7..af9566aefd 100644 --- a/src/gpu/ops/GrSemaphoreOp.h +++ b/src/gpu/ops/GrSemaphoreOp.h @@ -10,18 +10,24 @@ #include "GrOp.h" +#include "GrRenderTargetProxy.h" #include "GrSemaphore.h" #include "SkRefCnt.h" class GrSemaphoreOp : public GrOp { public: - static std::unique_ptr<GrSemaphoreOp> MakeSignal(sk_sp<GrSemaphore> semaphore); + static std::unique_ptr<GrSemaphoreOp> MakeSignal(sk_sp<GrSemaphore> semaphore, + GrRenderTargetProxy* proxy); - static std::unique_ptr<GrSemaphoreOp> MakeWait(sk_sp<GrSemaphore> semaphore); + static std::unique_ptr<GrSemaphoreOp> MakeWait(sk_sp<GrSemaphore> semaphore, + GrRenderTargetProxy* proxy); protected: - GrSemaphoreOp(uint32_t classId, sk_sp<GrSemaphore> semaphore) - : INHERITED(classId), fSemaphore(std::move(semaphore)) {} + GrSemaphoreOp(uint32_t classId, sk_sp<GrSemaphore> semaphore, GrRenderTargetProxy* proxy) + : INHERITED(classId), fSemaphore(std::move(semaphore)) { + this->setBounds(SkRect::MakeIWH(proxy->width(), proxy->height()), + HasAABloat::kNo, IsZeroArea::kNo); + } sk_sp<GrSemaphore> fSemaphore; |