Update simple gradient functions to use only a single return.
By avoiding the introduction of a temporary variable, they can remain
candidates for inlining even after we pare back the inliner logic.
More info: http://go/optimization-in-sksl-inliner
Change-Id: If58c757b8754036b0b0530379b639c09953744ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384859
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/gradients/generated/GrRadialGradientLayout.cpp b/src/gpu/gradients/generated/GrRadialGradientLayout.cpp
index df1d123..be83898 100644
--- a/src/gpu/gradients/generated/GrRadialGradientLayout.cpp
+++ b/src/gpu/gradients/generated/GrRadialGradientLayout.cpp
@@ -25,8 +25,7 @@
const GrRadialGradientLayout& _outer = args.fFp.cast<GrRadialGradientLayout>();
(void)_outer;
fragBuilder->codeAppendf(
- R"SkSL(half t = half(length(%s));
-return half4(t, 1.0, 0.0, 0.0);
+ R"SkSL(return half4(half(length(%s)), 1.0, 0.0, 0.0);
)SkSL",
args.fSampleCoord);
}