Revert "Revert "Remove GrPipeline from GrDrawOp.""
This reverts commit c48af934608bbb65650641f66adb51f2102d4274.
Change-Id: I4ba78fd7e5a7d406b88223ca6f7245c029b60f76
Reviewed-on: https://skia-review.googlesource.com/9981
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrProcessorSet.cpp b/src/gpu/GrProcessorSet.cpp
index c4b8262..94e2004 100644
--- a/src/gpu/GrProcessorSet.cpp
+++ b/src/gpu/GrProcessorSet.cpp
@@ -38,6 +38,44 @@
}
}
+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,