Pass input stage color to child processors.
This will allow multi-stage draw operations which use these FPs to
honor the input color.
Change-Id: I96ba3ff8720ed9fbd58b07bbe6315ffbbc7cf5b6
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294656
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 05b9a31..d887681 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -212,7 +212,7 @@
class GLFP : public GrGLSLFragmentProcessor {
public:
void emitCode(EmitArgs& args) override {
- SkString childColor = this->invokeChild(0, args);
+ SkString childColor = this->invokeChild(0, args.fInputColor, args);
const SwizzleFragmentProcessor& sfp = args.fFp.cast<SwizzleFragmentProcessor>();
const GrSwizzle& swizzle = sfp.swizzle();
diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp
index df06e55..589e6b3 100644
--- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp
+++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp
@@ -14,7 +14,7 @@
layout(key) in Mode mode;
void main() {
- half inputAlpha = (inputFP != null) ? sample(inputFP).a : sk_InColor.a;
+ half inputAlpha = (inputFP != null) ? sample(inputFP, sk_InColor).a : sk_InColor.a;
half factor = 1.0 - inputAlpha;
@switch (mode) {
case Mode::kGaussian:
diff --git a/src/gpu/effects/GrClampFragmentProcessor.fp b/src/gpu/effects/GrClampFragmentProcessor.fp
index eb3deb3..c7420b0 100644
--- a/src/gpu/effects/GrClampFragmentProcessor.fp
+++ b/src/gpu/effects/GrClampFragmentProcessor.fp
@@ -15,7 +15,7 @@
}
void main() {
- half4 inputColor = (inputFP != null) ? sample(inputFP) : sk_InColor;
+ half4 inputColor = (inputFP != null) ? sample(inputFP, sk_InColor) : sk_InColor;
@if (clampToPremul) {
half alpha = saturate(inputColor.a);
sk_OutColor = half4(clamp(inputColor.rgb, 0, alpha), alpha);
diff --git a/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp b/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp
index 736ceba..006e51e 100644
--- a/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp
+++ b/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp
@@ -26,9 +26,10 @@
(void)_outer;
auto mode = _outer.mode;
(void)mode;
+ SkString _input328 = SkStringPrintf("%s", args.fInputColor);
SkString _sample328;
if (_outer.inputFP_index >= 0) {
- _sample328 = this->invokeChild(_outer.inputFP_index, args);
+ _sample328 = this->invokeChild(_outer.inputFP_index, _input328.c_str(), args);
} else {
_sample328 = "half4(1)";
}
diff --git a/src/gpu/effects/generated/GrClampFragmentProcessor.cpp b/src/gpu/effects/generated/GrClampFragmentProcessor.cpp
index 9eb218b..82cb002 100644
--- a/src/gpu/effects/generated/GrClampFragmentProcessor.cpp
+++ b/src/gpu/effects/generated/GrClampFragmentProcessor.cpp
@@ -25,9 +25,10 @@
(void)_outer;
auto clampToPremul = _outer.clampToPremul;
(void)clampToPremul;
+ SkString _input484 = SkStringPrintf("%s", args.fInputColor);
SkString _sample484;
if (_outer.inputFP_index >= 0) {
- _sample484 = this->invokeChild(_outer.inputFP_index, args);
+ _sample484 = this->invokeChild(_outer.inputFP_index, _input484.c_str(), args);
} else {
_sample484 = "half4(1)";
}