Add GrGLSLFP::ParallelRange to iterate FP and GLSLFP trees

Bug: skia:10139

Change-Id: I379249758160ad096c9e03f25a41b00bc1987518
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301384
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
index ad9b5ba..6d1ac02 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
@@ -144,6 +144,27 @@
     }
 }
 
+GrGLSLFragmentProcessor::ParallelIter::ParallelIter(const GrFragmentProcessor& fp,
+                                                    GrGLSLFragmentProcessor& glslFP)
+        : fpIter(fp), glslIter(glslFP) {}
+
+GrGLSLFragmentProcessor::ParallelIter& GrGLSLFragmentProcessor::ParallelIter::operator++() {
+    ++fpIter;
+    ++glslIter;
+    SkASSERT(static_cast<bool>(fpIter) == static_cast<bool>(glslIter));
+    return *this;
+}
+
+std::tuple<const GrFragmentProcessor&, GrGLSLFragmentProcessor&>
+GrGLSLFragmentProcessor::ParallelIter::operator*() const {
+    return {*fpIter, *glslIter};
+}
+
+bool GrGLSLFragmentProcessor::ParallelIter::operator==(const ParallelIterEnd& end) const {
+    SkASSERT(static_cast<bool>(fpIter) == static_cast<bool>(glslIter));
+    return !fpIter;
+}
+
 GrGLSLFragmentProcessor& GrGLSLFragmentProcessor::Iter::operator*() const {
     return *fFPStack.back();
 }
@@ -161,3 +182,7 @@
     }
     return *this;
 }
+
+GrGLSLFragmentProcessor::ParallelRange::ParallelRange(const GrFragmentProcessor& fp,
+                                                      GrGLSLFragmentProcessor& glslFP)
+        : fInitialFP(fp), fInitialGLSLFP(glslFP) {}