Define sample(null) as returning the inputColor unchanged.
This is more useful than returning half4(1), and there was no existing
code that passed null to sample(), so this will not be a breaking
change.
This change will allow us to replace this boilerplate:
half4 color = (inputFP != null) ? sample(inputFP, sk_InColor)
: sk_InColor;
With:
half4 color = sample(inputFP, sk_InColor);
Change-Id: I7bb1580299af99afccbd3a5fdf4cb1d5c4c96da9
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295002
Reviewed-by: Brian Osman <brianosman@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 fea85f4..7a4a832 100644
--- a/src/gpu/effects/generated/GrMixerEffect.cpp
+++ b/src/gpu/effects/generated/GrMixerEffect.cpp
@@ -36,7 +36,7 @@
if (_outer.fp1_index >= 0) {
_sample1335 = this->invokeChild(_outer.fp1_index, _input1335.c_str(), args);
} else {
- _sample1335 = "half4(1)";
+ _sample1335 = _input1335;
}
fragBuilder->codeAppendf("\nhalf4 in1 = %s ? %s : %s;\n%s = mix(in0, in1, %s);\n",
_outer.fp1_index >= 0 ? "true" : "false", _sample1335.c_str(),