Honor return value of `registerChildProcessor` when creating child FPs.
The current implementation ignores return value from
`registerChildProcessor` and, surprisingly, assumes that a cloned FP
index will match the original FP index. This version honors the return
value.
(In practice, I have not seen any cases where the current implementation
has caused actual breakage.)
Updating common code-gen had large ripple effects in the SkSL unit
tests. While repairing the tests, I also took the opportunity to use
raw-strings to pass the source SkSL text, and annotated the `expectedH`
and `expectedCPP` blocks to make the tests easier to understand at a
glance.
Change-Id: I71be69d9e4620963b3ef49ad8e0dba3b40af7f4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295452
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/effects/generated/GrCircleEffect.cpp b/src/gpu/effects/generated/GrCircleEffect.cpp
index ecce8a9..64ee932 100644
--- a/src/gpu/effects/generated/GrCircleEffect.cpp
+++ b/src/gpu/effects/generated/GrCircleEffect.cpp
@@ -108,16 +108,15 @@
}
GrCircleEffect::GrCircleEffect(const GrCircleEffect& src)
: INHERITED(kGrCircleEffect_ClassID, src.optimizationFlags())
- , inputFP_index(src.inputFP_index)
, edgeType(src.edgeType)
, center(src.center)
, radius(src.radius) {
- if (inputFP_index >= 0) {
- auto clone = src.childProcessor(inputFP_index).clone();
- if (src.childProcessor(inputFP_index).isSampledWithExplicitCoords()) {
- clone->setSampledWithExplicitCoords();
+ if (src.inputFP_index >= 0) {
+ auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
+ if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
+ inputFP_clone->setSampledWithExplicitCoords();
}
- this->registerChildProcessor(std::move(clone));
+ inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
}
}
std::unique_ptr<GrFragmentProcessor> GrCircleEffect::clone() const {