diff options
author | Robert Phillips <robertphillips@google.com> | 2017-08-08 08:36:22 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-08-08 13:23:20 +0000 |
commit | 65a88fadab72abd104fdf4cc4a97488b2e901c60 (patch) | |
tree | f18907298553a9a72faa01361950a9c633398895 /src/gpu/ops | |
parent | bdc3afa577718c657da6eaffba6ae90ec1c26ca2 (diff) |
Add GrDebugMarkerOp
Change-Id: I948838dea13d2f36194ca1043ab37e72759794e0
Reviewed-on: https://skia-review.googlesource.com/31740
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ops')
-rw-r--r-- | src/gpu/ops/GrDebugMarkerOp.h | 58 | ||||
-rw-r--r-- | src/gpu/ops/GrDiscardOp.h | 3 | ||||
-rw-r--r-- | src/gpu/ops/GrOp.h | 5 | ||||
-rw-r--r-- | src/gpu/ops/GrSemaphoreOp.h | 3 |
4 files changed, 65 insertions, 4 deletions
diff --git a/src/gpu/ops/GrDebugMarkerOp.h b/src/gpu/ops/GrDebugMarkerOp.h new file mode 100644 index 0000000000..326aa75bdd --- /dev/null +++ b/src/gpu/ops/GrDebugMarkerOp.h @@ -0,0 +1,58 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrDebugMarkerOp_DEFINED +#define GrDebugMarkerOp_DEFINED + +#include "GrGpuCommandBuffer.h" +#include "GrOp.h" +#include "GrOpFlushState.h" +#include "GrRenderTargetProxy.h" + +class GrDebugMarkerOp final : public GrOp { +public: + DEFINE_OP_CLASS_ID + + static std::unique_ptr<GrOp> Make(GrRenderTargetProxy* proxy, const SkString& str) { + return std::unique_ptr<GrOp>(new GrDebugMarkerOp(proxy, str)); + } + + const char* name() const override { return "DebugMarker"; } + + SkString dumpInfo() const override { + SkString string; + string.append(INHERITED::dumpInfo()); + return string; + } + +private: + GrDebugMarkerOp(GrRenderTargetProxy* proxy, const SkString& str) + : INHERITED(ClassID()) + , fStr(str) { + // Make this cover the whole screen so it can't be reordered around + this->makeFullScreen(proxy); + } + + bool onCombineIfPossible(GrOp* that, const GrCaps& caps) override { return false; } + + void onPrepare(GrOpFlushState*) override {} + + void onExecute(GrOpFlushState* state) override { + SkASSERT(state->drawOpArgs().renderTarget()); + + //SkDebugf("%s\n", fStr.c_str()); + if (state->caps().gpuTracingSupport()) { + state->commandBuffer()->insertEventMarker(state->drawOpArgs().fProxy, fStr.c_str()); + } + } + + SkString fStr; + + typedef GrOp INHERITED; +}; + +#endif diff --git a/src/gpu/ops/GrDiscardOp.h b/src/gpu/ops/GrDiscardOp.h index 6f8ff5e89e..4fb481ca74 100644 --- a/src/gpu/ops/GrDiscardOp.h +++ b/src/gpu/ops/GrDiscardOp.h @@ -31,8 +31,7 @@ public: private: GrDiscardOp(GrRenderTargetProxy* proxy) : INHERITED(ClassID()) { - this->setBounds(SkRect::MakeIWH(proxy->width(), proxy->height()), - HasAABloat::kNo, IsZeroArea::kNo); + this->makeFullScreen(proxy); } bool onCombineIfPossible(GrOp* that, const GrCaps& caps) override { return false; } diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h index 953a9147aa..254fc44237 100644 --- a/src/gpu/ops/GrOp.h +++ b/src/gpu/ops/GrOp.h @@ -172,6 +172,7 @@ protected: kYes, kNo }; + void setBounds(const SkRect& newBounds, HasAABloat aabloat, IsZeroArea zeroArea) { fBounds = newBounds; this->setBoundsFlags(aabloat, zeroArea); @@ -181,6 +182,10 @@ protected: m.mapRect(&fBounds, srcBounds); this->setBoundsFlags(aabloat, zeroArea); } + void makeFullScreen(GrSurfaceProxy* proxy) { + this->setBounds(SkRect::MakeIWH(proxy->width(), proxy->height()), + HasAABloat::kNo, IsZeroArea::kNo); + } void joinBounds(const GrOp& that) { if (that.hasAABloat()) { diff --git a/src/gpu/ops/GrSemaphoreOp.h b/src/gpu/ops/GrSemaphoreOp.h index 4df09e8fbd..1acc6a7825 100644 --- a/src/gpu/ops/GrSemaphoreOp.h +++ b/src/gpu/ops/GrSemaphoreOp.h @@ -26,8 +26,7 @@ public: protected: 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); + this->makeFullScreen(proxy); } sk_sp<GrSemaphore> fSemaphore; |