aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-06 16:36:49 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-07 18:34:10 +0000
commitd543e0a835002cc423de0d09c86eea99a0c0a2ba (patch)
treeba384d0f7785a184897a79cda88e9b946b56c1f9 /src/gpu
parente9ed07de16de59959d18ab56a8f62b66f210955d (diff)
Add GrOp::wasRecorded and use in instanced rendering for tracking.
BUG=skia: Change-Id: I4c5cdf47d42b7adae3649c7f96caabe68f45acbf Reviewed-on: https://skia-review.googlesource.com/9308 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp1
-rw-r--r--src/gpu/instanced/InstancedRendering.cpp3
-rw-r--r--src/gpu/instanced/InstancedRendering.h3
-rw-r--r--src/gpu/ops/GrOp.h8
4 files changed, 15 insertions, 0 deletions
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 1826689ef3..1c9835389e 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -274,6 +274,7 @@ GrOp* GrRenderTargetOpList::recordOp(std::unique_ptr<GrOp> op,
}
GR_AUDIT_TRAIL_OP_RESULT_NEW(fAuditTrail, op);
fRecordedOps.emplace_back(std::move(op), renderTarget);
+ fRecordedOps.back().fOp->wasRecorded();
fLastFullClearOp = nullptr;
fLastFullClearRenderTargetID.makeInvalid();
return fRecordedOps.back().fOp.get();
diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp
index 1ffaaa44d4..ef2264b0ef 100644
--- a/src/gpu/instanced/InstancedRendering.cpp
+++ b/src/gpu/instanced/InstancedRendering.cpp
@@ -369,7 +369,10 @@ void InstancedRendering::Op::applyPipelineOptimizations(
}
fInfo.fUsesLocalCoords = optimizations.readsLocalCoords();
fInfo.fCannotTweakAlphaForCoverage = !optimizations.canTweakAlphaForCoverage();
+}
+void InstancedRendering::Op::wasRecorded() {
+ SkASSERT(!fIsTracked);
fInstancedRendering->fTrackedOps.addToTail(this);
fIsTracked = true;
}
diff --git a/src/gpu/instanced/InstancedRendering.h b/src/gpu/instanced/InstancedRendering.h
index 8002d5046b..778e8b4511 100644
--- a/src/gpu/instanced/InstancedRendering.h
+++ b/src/gpu/instanced/InstancedRendering.h
@@ -141,6 +141,9 @@ protected:
void appendParamsTexel(SkScalar x, SkScalar y, SkScalar z, SkScalar w);
void appendParamsTexel(SkScalar x, SkScalar y, SkScalar z);
+ // Registers the op with the InstancedRendering list of tracked ops.
+ void wasRecorded() override;
+
protected:
Op(uint32_t classID, InstancedRendering* ir);
diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h
index 11198dd9d7..c1bf7f7555 100644
--- a/src/gpu/ops/GrOp.h
+++ b/src/gpu/ops/GrOp.h
@@ -126,6 +126,14 @@ public:
}
/**
+ * This is called to notify the op that it has been recorded into a GrOpList. Ops can use this
+ * to begin preparations for the flush of the op list. Note that the op still may either be
+ * combined into another op or have another op combined into it via combineIfPossible() after
+ * this call is made.
+ */
+ virtual void wasRecorded() {}
+
+ /**
* Called prior to executing. The op should perform any resource creation or data transfers
* necessary before execute() is called.
*/