Don't erase child optimization flags
The matrix effect and the device-space effect only change the coordinates the child FP is evaluated at. Any optimization based on the child's color behavior is still valid. Change-Id: Ib92fb0c627ec18c7eac85e9d4162e47866694d4f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298065 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
17b12095eb
commit
e6c33eabe0
@ -14,6 +14,16 @@ void main() {
|
||||
sk_OutColor = sample(fp, sk_InColor, p.xy / p.z);
|
||||
}
|
||||
|
||||
@optimizationFlags {
|
||||
ProcessorOptimizationFlags(fp.get())
|
||||
}
|
||||
|
||||
@class {
|
||||
SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& inColor) const override {
|
||||
return ConstantOutputForConstantInput(this->childProcessor(0), inColor);
|
||||
}
|
||||
}
|
||||
|
||||
@make{
|
||||
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> fp,
|
||||
const SkMatrix& matrix = SkMatrix::I()) {
|
||||
|
@ -35,7 +35,7 @@ private:
|
||||
GrMatrixEffect(const GrMatrixEffect& src);
|
||||
|
||||
GrMatrixEffect(SkMatrix matrix, std::unique_ptr<GrFragmentProcessor> child)
|
||||
: INHERITED(kGrMatrixEffect_ClassID, kNone_OptimizationFlags)
|
||||
: INHERITED(kGrMatrixEffect_ClassID, ProcessorOptimizationFlags(child.get()))
|
||||
, fMatrix(matrix) {
|
||||
SkASSERT(child);
|
||||
this->registerChild(std::move(child),
|
||||
@ -46,6 +46,9 @@ private:
|
||||
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
|
||||
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& inputColor) const override {
|
||||
return ConstantOutputForConstantInput(this->childProcessor(0), inputColor);
|
||||
}
|
||||
|
||||
SkMatrix fMatrix;
|
||||
|
||||
|
@ -19,6 +19,10 @@
|
||||
|
||||
class GrDeviceSpaceEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& inColor) const override {
|
||||
return ConstantOutputForConstantInput(this->childProcessor(0), inColor);
|
||||
}
|
||||
|
||||
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> fp,
|
||||
const SkMatrix& matrix = SkMatrix::I()) {
|
||||
return std::unique_ptr<GrFragmentProcessor>(new GrDeviceSpaceEffect(std::move(fp), matrix));
|
||||
@ -31,7 +35,9 @@ public:
|
||||
|
||||
private:
|
||||
GrDeviceSpaceEffect(std::unique_ptr<GrFragmentProcessor> fp, SkMatrix matrix)
|
||||
: INHERITED(kGrDeviceSpaceEffect_ClassID, kNone_OptimizationFlags), matrix(matrix) {
|
||||
: INHERITED(kGrDeviceSpaceEffect_ClassID,
|
||||
(OptimizationFlags)ProcessorOptimizationFlags(fp.get()))
|
||||
, matrix(matrix) {
|
||||
SkASSERT(fp);
|
||||
fp_index = this->registerExplicitlySampledChild(std::move(fp));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user