Fix cloning of Runtime Blend fragment processors.
Previously, a cloned Runtime Blend FP would lose its
kIsBlendFunction_Flag, causing invalid code to be generated.
This broke the `filltypespersp` slide when "Force Runtime Blends" is on.
Change-Id: I9a140bc6467536e5ebeb2ca47eca6f013462dd58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/434919
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/effects/GrSkSLFP.cpp b/src/gpu/effects/GrSkSLFP.cpp
index 49bc7a4..290a2be 100644
--- a/src/gpu/effects/GrSkSLFP.cpp
+++ b/src/gpu/effects/GrSkSLFP.cpp
@@ -270,14 +270,11 @@
size_t uniformSize = uniforms->size();
size_t uniformFlagSize = effect->uniforms().count() * sizeof(UniformFlags);
std::unique_ptr<GrSkSLFP> fp(new (uniformSize + uniformFlagSize)
- GrSkSLFP(effect, name, OptFlags::kNone));
+ GrSkSLFP(std::move(effect), name, OptFlags::kNone));
sk_careful_memcpy(fp->uniformData(), uniforms->data(), uniformSize);
for (auto& childFP : childFPs) {
fp->addChild(std::move(childFP), /*mergeOptFlags=*/true);
}
- if (effect->allowBlender()) {
- fp->setIsBlendFunction();
- }
if (inputFP) {
fp->setInput(std::move(inputFP));
}
@@ -300,6 +297,9 @@
if (fEffect->usesSampleCoords()) {
this->setUsesSampleCoordsDirectly();
}
+ if (fEffect->allowBlender()) {
+ this->setIsBlendFunction();
+ }
}
GrSkSLFP::GrSkSLFP(const GrSkSLFP& other)
@@ -316,6 +316,9 @@
if (fEffect->usesSampleCoords()) {
this->setUsesSampleCoordsDirectly();
}
+ if (fEffect->allowBlender()) {
+ this->setIsBlendFunction();
+ }
this->cloneAndRegisterAllChildProcessors(other);
}
diff --git a/src/gpu/effects/GrSkSLFP.h b/src/gpu/effects/GrSkSLFP.h
index 67c262a..b7affa6 100644
--- a/src/gpu/effects/GrSkSLFP.h
+++ b/src/gpu/effects/GrSkSLFP.h
@@ -147,11 +147,9 @@
#endif
size_t uniformPayloadSize = UniformPayloadSize(effect.get());
- std::unique_ptr<GrSkSLFP> fp(new (uniformPayloadSize) GrSkSLFP(effect, name, optFlags));
+ std::unique_ptr<GrSkSLFP> fp(new (uniformPayloadSize)
+ GrSkSLFP(std::move(effect), name, optFlags));
fp->appendArgs(fp->uniformData(), fp->uniformFlags(), std::forward<Args>(args)...);
- if (effect->allowBlender()) {
- fp->setIsBlendFunction();
- }
if (inputFP) {
fp->setInput(std::move(inputFP));
}