aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProcessorSet.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-16 14:19:07 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-16 19:10:15 +0000
commit2bf4b3a97b770811d9e0558dbbfbdb57cfafbdb7 (patch)
tree3e73ebe67a871db43e4ba9f0a9df3edf15361bca /src/gpu/GrProcessorSet.cpp
parent1165b1ef6f069d512c6d5a43ef431b3be6f8c80f (diff)
Remove GrPipeline from GrDrawOp.
GrDrawOp subclasses are now free to construct their pipelines at flush time and now in theory could use multiple GrPipelines for multipass rendering. GrProcessorSet may be used to retain the processors from a GrPaint with "pending execution" style refs. NVPR and Instanced rendering are updated to create their pipelines at flush time without a GrPipelineBuilder. The monolithic pipeline creation/management that was on GrDrawOp is moved to GrMeshDrawOp. However, this is temporary and will be removed in coming changes. Change-Id: I124282e3cea5d070970b5460c8a679fcaf7a8eff Reviewed-on: https://skia-review.googlesource.com/7279 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrProcessorSet.cpp')
-rw-r--r--src/gpu/GrProcessorSet.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gpu/GrProcessorSet.cpp b/src/gpu/GrProcessorSet.cpp
index c4b82621d1..94e2004546 100644
--- a/src/gpu/GrProcessorSet.cpp
+++ b/src/gpu/GrProcessorSet.cpp
@@ -38,6 +38,44 @@ GrProcessorSet::GrProcessorSet(GrPaint&& paint) {
}
}
+GrProcessorSet::~GrProcessorSet() {
+ if (this->isPendingExecution()) {
+ for (auto fp : fFragmentProcessors) {
+ fp->completedExecution();
+ }
+ } else {
+ for (auto fp : fFragmentProcessors) {
+ fp->unref();
+ }
+ }
+}
+
+void GrProcessorSet::makePendingExecution() {
+ SkASSERT(!(kPendingExecution_Flag & fFlags));
+ fFlags |= kPendingExecution_Flag;
+ for (int i = 0; i < fFragmentProcessors.count(); ++i) {
+ fFragmentProcessors[i]->addPendingExecution();
+ fFragmentProcessors[i]->unref();
+ }
+}
+
+bool GrProcessorSet::operator==(const GrProcessorSet& that) const {
+ if (((fFlags ^ that.fFlags) & ~kPendingExecution_Flag) ||
+ fFragmentProcessors.count() != that.fFragmentProcessors.count() ||
+ fColorFragmentProcessorCnt != that.fColorFragmentProcessorCnt) {
+ return false;
+ }
+ for (int i = 0; i < fFragmentProcessors.count(); ++i) {
+ if (!fFragmentProcessors[i]->isEqual(*that.fFragmentProcessors[i])) {
+ return false;
+ }
+ }
+ if (fXPFactory != that.fXPFactory) {
+ return false;
+ }
+ return true;
+}
+
//////////////////////////////////////////////////////////////////////////////
void GrProcessorSet::FragmentProcessorAnalysis::internalInit(const GrPipelineInput& colorInput,