Improve inputColor handling in fragment processor implementations.
EmitArgs explicitly checks for null constructor arguments and uses
"half4(1)" for fInputColor to ensure its fields are non-null.
Cleans up accesses of fInputColor in existing fragment processors to no
longer check for null and hardcode a "half4(1)".
Updates .fp CPP generation to remove the null check for fInputArgs.
Updates the internals of emitChild() to emit an extra local variable
with a mangled variable name for storing the provided input expression.
Bug: skia:
Change-Id: Iad807f269655689dcb2e8d58f2eb506685ba2757
Reviewed-on: https://skia-review.googlesource.com/149231
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index d2967fe..6493fcb 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -32,9 +32,9 @@
"0.5)) / 255.0);\n break;\n case 1:\n %s.xyz = float(%s.w) <= 0.0 "
"? half3(0.0) : half3(floor(float3(float3((%s.xyz / %s.w) * 255.0) + 0.5)) / "
"255.0);\n break;\n}\n",
- args.fOutputColor, args.fInputColor ? args.fInputColor : "half4(1)",
- (int)_outer.pmConversion(), args.fOutputColor, args.fOutputColor, args.fOutputColor,
- args.fOutputColor, args.fOutputColor, args.fOutputColor, args.fOutputColor);
+ args.fOutputColor, args.fInputColor, (int)_outer.pmConversion(), args.fOutputColor,
+ args.fOutputColor, args.fOutputColor, args.fOutputColor, args.fOutputColor,
+ args.fOutputColor, args.fOutputColor);
}
private: