diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp index 4ee0c4505f..7092dc04fd 100644 --- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp +++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp @@ -5,24 +5,11 @@ * found in the LICENSE file. */ -enum class Mode { - kGaussian = 0, - kSmoothStep = 1 -}; - in fragmentProcessor inputFP; -layout(key) in Mode mode; half4 main() { half inputAlpha = sample(inputFP).a; half factor = 1.0 - inputAlpha; - @switch (mode) { - case Mode::kGaussian: - factor = half(exp(-factor * factor * 4.0) - 0.018); - break; - case Mode::kSmoothStep: - factor = smoothstep(1.0, 0.0, factor); - break; - } + factor = half(exp(-factor * factor * 4.0) - 0.018); return half4(factor); } diff --git a/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp b/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp index 6cb5b13d7d..71789b52b8 100644 --- a/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp +++ b/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp @@ -25,23 +25,14 @@ public: const GrBlurredEdgeFragmentProcessor& _outer = args.fFp.cast(); (void)_outer; - auto mode = _outer.mode; - (void)mode; SkString _sample0 = this->invokeChild(0, args); fragBuilder->codeAppendf( R"SkSL(half inputAlpha = %s.w; half factor = 1.0 - inputAlpha; -@switch (%d) { - case 0: - factor = exp((-factor * factor) * 4.0) - 0.017999999225139618; - break; - case 1: - factor = smoothstep(1.0, 0.0, factor); - break; -} +factor = exp((-factor * factor) * 4.0) - 0.017999999225139618; return half4(factor); )SkSL", - _sample0.c_str(), (int)_outer.mode); + _sample0.c_str()); } private: @@ -52,26 +43,20 @@ std::unique_ptr GrBlurredEdgeFragmentProcessor::onMakeP return std::make_unique(); } void GrBlurredEdgeFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps, - GrProcessorKeyBuilder* b) const { - b->add32((uint32_t)mode); -} + GrProcessorKeyBuilder* b) const {} bool GrBlurredEdgeFragmentProcessor::onIsEqual(const GrFragmentProcessor& other) const { const GrBlurredEdgeFragmentProcessor& that = other.cast(); (void)that; - if (mode != that.mode) return false; return true; } GrBlurredEdgeFragmentProcessor::GrBlurredEdgeFragmentProcessor( const GrBlurredEdgeFragmentProcessor& src) - : INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, src.optimizationFlags()) - , mode(src.mode) { + : INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, src.optimizationFlags()) { this->cloneAndRegisterAllChildProcessors(src); } std::unique_ptr GrBlurredEdgeFragmentProcessor::clone() const { return std::make_unique(*this); } #if GR_TEST_UTILS -SkString GrBlurredEdgeFragmentProcessor::onDumpInfo() const { - return SkStringPrintf("(mode=%d)", (int)mode); -} +SkString GrBlurredEdgeFragmentProcessor::onDumpInfo() const { return SkString(); } #endif diff --git a/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.h b/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.h index b29cb45f2f..b37cde9a68 100644 --- a/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.h +++ b/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.h @@ -18,21 +18,17 @@ class GrBlurredEdgeFragmentProcessor : public GrFragmentProcessor { public: - enum class Mode { kGaussian = 0, kSmoothStep = 1 }; - static std::unique_ptr Make(std::unique_ptr inputFP, - Mode mode) { + static std::unique_ptr Make(std::unique_ptr inputFP) { return std::unique_ptr( - new GrBlurredEdgeFragmentProcessor(std::move(inputFP), mode)); + new GrBlurredEdgeFragmentProcessor(std::move(inputFP))); } GrBlurredEdgeFragmentProcessor(const GrBlurredEdgeFragmentProcessor& src); std::unique_ptr clone() const override; const char* name() const override { return "BlurredEdgeFragmentProcessor"; } - Mode mode; private: - GrBlurredEdgeFragmentProcessor(std::unique_ptr inputFP, Mode mode) - : INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, kNone_OptimizationFlags) - , mode(mode) { + GrBlurredEdgeFragmentProcessor(std::unique_ptr inputFP) + : INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, kNone_OptimizationFlags) { this->registerChild(std::move(inputFP), SkSL::SampleUsage::PassThrough()); } std::unique_ptr onMakeProgramImpl() const override; diff --git a/src/utils/SkShadowUtils.cpp b/src/utils/SkShadowUtils.cpp index 4e30c40348..e46e7a6c4a 100644 --- a/src/utils/SkShadowUtils.cpp +++ b/src/utils/SkShadowUtils.cpp @@ -87,8 +87,7 @@ sk_sp SkGaussianColorFilter::CreateProc(SkReadBuffer&) { GrFPResult SkGaussianColorFilter::asFragmentProcessor(std::unique_ptr inputFP, GrRecordingContext*, const GrColorInfo&) const { - return GrFPSuccess(GrBlurredEdgeFragmentProcessor::Make( - std::move(inputFP), GrBlurredEdgeFragmentProcessor::Mode::kGaussian)); + return GrFPSuccess(GrBlurredEdgeFragmentProcessor::Make(std::move(inputFP))); } #endif