SkSL: Salt inline identifiers in PipelineStage and FragmentProcessor passes

Fixes a bug with name conflicts in the final SkSL.

Bug: skia:10526
Change-Id: Ic238f89dd778c186e775ecbaabfbaed9e426274f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305563
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index 9ec8234..e39c16c 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -196,6 +196,10 @@
     effect.test(0xFF000000, 0xFF00007F, 0xFF007F00, 0xFF007F7F,
                 [](SkCanvas* canvas, SkPaint*) { canvas->rotate(45.0f); });
 
+    //
+    // Sampling children
+    //
+
     // Sampling a null child should return the paint color
     effect.build("in shader child;",
                  "color = sample(child);");
@@ -222,6 +226,16 @@
                  "color = sample(child, float3x3(0, 1, 0, 1, 0, 0, 0, 0, 1));");
     effect.child("child") = rgbwShader;
     effect.test(0xFF0000FF, 0xFFFF0000, 0xFF00FF00, 0xFFFFFFFF);
+
+    //
+    // Helper functions
+    //
+
+    // Test case for inlining in the pipeline-stage and fragment-shader passes (skbug.com/10526):
+    effect.build("float2 helper(float2 x) { return x + 1; }",
+                 "float2 v = helper(p);"
+                 "color = half4(half2(v), 0, 1);");
+    effect.test(0xFF00FFFF);
 }
 
 DEF_TEST(SkRuntimeEffectSimple, r) {