Honor return value of `registerChildProcessor` when creating child FPs.

The current implementation ignores return value from
`registerChildProcessor` and, surprisingly, assumes that a cloned FP
index will match the original FP index. This version honors the return
value.

(In practice, I have not seen any cases where the current implementation
has caused actual breakage.)

Updating common code-gen had large ripple effects in the SkSL unit
tests. While repairing the tests, I also took the opportunity to use
raw-strings to pass the source SkSL text, and annotated the `expectedH`
and `expectedCPP` blocks to make the tests easier to understand at a
glance.

Change-Id: I71be69d9e4620963b3ef49ad8e0dba3b40af7f4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295452
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/effects/generated/GrMixerEffect.cpp b/src/gpu/effects/generated/GrMixerEffect.cpp
index 7a4a832..ceb665e 100644
--- a/src/gpu/effects/generated/GrMixerEffect.cpp
+++ b/src/gpu/effects/generated/GrMixerEffect.cpp
@@ -64,23 +64,20 @@
     return true;
 }
 GrMixerEffect::GrMixerEffect(const GrMixerEffect& src)
-        : INHERITED(kGrMixerEffect_ClassID, src.optimizationFlags())
-        , fp0_index(src.fp0_index)
-        , fp1_index(src.fp1_index)
-        , weight(src.weight) {
+        : INHERITED(kGrMixerEffect_ClassID, src.optimizationFlags()), weight(src.weight) {
     {
-        auto clone = src.childProcessor(fp0_index).clone();
-        if (src.childProcessor(fp0_index).isSampledWithExplicitCoords()) {
-            clone->setSampledWithExplicitCoords();
+        auto fp0_clone = src.childProcessor(src.fp0_index).clone();
+        if (src.childProcessor(src.fp0_index).isSampledWithExplicitCoords()) {
+            fp0_clone->setSampledWithExplicitCoords();
         }
-        this->registerChildProcessor(std::move(clone));
+        fp0_index = this->registerChildProcessor(std::move(fp0_clone));
     }
-    if (fp1_index >= 0) {
-        auto clone = src.childProcessor(fp1_index).clone();
-        if (src.childProcessor(fp1_index).isSampledWithExplicitCoords()) {
-            clone->setSampledWithExplicitCoords();
+    if (src.fp1_index >= 0) {
+        auto fp1_clone = src.childProcessor(src.fp1_index).clone();
+        if (src.childProcessor(src.fp1_index).isSampledWithExplicitCoords()) {
+            fp1_clone->setSampledWithExplicitCoords();
         }
-        this->registerChildProcessor(std::move(clone));
+        fp1_index = this->registerChildProcessor(std::move(fp1_clone));
     }
 }
 std::unique_ptr<GrFragmentProcessor> GrMixerEffect::clone() const {