Remove GrBlurredEdgeFragmentProcessor, use GrRuntimeFPBuilder
Change-Id: Ia5d849a2ab3fc233c4feacb5198a0684978ca3a9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410794 Reviewed-by: John Stiles <johnstiles@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
0873ac9b1d
commit
9a4c965b2b
@ -323,8 +323,6 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/effects/generated/GrAARectEffect.h",
|
||||
"$_src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.cpp",
|
||||
"$_src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h",
|
||||
"$_src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp",
|
||||
"$_src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.h",
|
||||
"$_src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp",
|
||||
"$_src/gpu/effects/generated/GrCircleBlurFragmentProcessor.h",
|
||||
"$_src/gpu/effects/generated/GrCircleEffect.cpp",
|
||||
|
@ -207,7 +207,6 @@ skia_sksl_gpu_sources = [
|
||||
skia_gpu_processor_sources = [
|
||||
"$_src/gpu/effects/GrAARectEffect.fp",
|
||||
"$_src/gpu/effects/GrAlphaThresholdFragmentProcessor.fp",
|
||||
"$_src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp",
|
||||
"$_src/gpu/effects/GrCircleBlurFragmentProcessor.fp",
|
||||
"$_src/gpu/effects/GrCircleEffect.fp",
|
||||
"$_src/gpu/effects/GrClampFragmentProcessor.fp",
|
||||
|
@ -57,7 +57,6 @@ public:
|
||||
kGrAlphaThresholdFragmentProcessor_ClassID,
|
||||
kGrBicubicEffect_ClassID,
|
||||
kGrBitmapTextGeoProc_ClassID,
|
||||
kGrBlurredEdgeFragmentProcessor_ClassID,
|
||||
kGrCCClipProcessor_ClassID,
|
||||
kGrCCPathProcessor_ClassID,
|
||||
kGrCircleBlurFragmentProcessor_ClassID,
|
||||
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
in fragmentProcessor inputFP;
|
||||
|
||||
half4 main() {
|
||||
half inputAlpha = sample(inputFP).a;
|
||||
half factor = 1.0 - inputAlpha;
|
||||
factor = half(exp(-factor * factor * 4.0) - 0.018);
|
||||
return half4(factor);
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
/**************************************************************************************************
|
||||
*** This file was autogenerated from GrBlurredEdgeFragmentProcessor.fp; do not modify.
|
||||
**************************************************************************************************/
|
||||
#include "GrBlurredEdgeFragmentProcessor.h"
|
||||
|
||||
#include "src/core/SkUtils.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
|
||||
#include "src/sksl/SkSLCPP.h"
|
||||
#include "src/sksl/SkSLUtil.h"
|
||||
class GrGLSLBlurredEdgeFragmentProcessor : public GrGLSLFragmentProcessor {
|
||||
public:
|
||||
GrGLSLBlurredEdgeFragmentProcessor() {}
|
||||
void emitCode(EmitArgs& args) override {
|
||||
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
|
||||
const GrBlurredEdgeFragmentProcessor& _outer =
|
||||
args.fFp.cast<GrBlurredEdgeFragmentProcessor>();
|
||||
(void)_outer;
|
||||
SkString _sample0 = this->invokeChild(0, args);
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(half inputAlpha = %s.w;
|
||||
half factor = 1.0 - inputAlpha;
|
||||
factor = exp((-factor * factor) * 4.0) - 0.017999999225139618;
|
||||
return half4(factor);
|
||||
)SkSL",
|
||||
_sample0.c_str());
|
||||
}
|
||||
|
||||
private:
|
||||
void onSetData(const GrGLSLProgramDataManager& pdman,
|
||||
const GrFragmentProcessor& _proc) override {}
|
||||
};
|
||||
std::unique_ptr<GrGLSLFragmentProcessor> GrBlurredEdgeFragmentProcessor::onMakeProgramImpl() const {
|
||||
return std::make_unique<GrGLSLBlurredEdgeFragmentProcessor>();
|
||||
}
|
||||
void GrBlurredEdgeFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps,
|
||||
GrProcessorKeyBuilder* b) const {}
|
||||
bool GrBlurredEdgeFragmentProcessor::onIsEqual(const GrFragmentProcessor& other) const {
|
||||
const GrBlurredEdgeFragmentProcessor& that = other.cast<GrBlurredEdgeFragmentProcessor>();
|
||||
(void)that;
|
||||
return true;
|
||||
}
|
||||
GrBlurredEdgeFragmentProcessor::GrBlurredEdgeFragmentProcessor(
|
||||
const GrBlurredEdgeFragmentProcessor& src)
|
||||
: INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, src.optimizationFlags()) {
|
||||
this->cloneAndRegisterAllChildProcessors(src);
|
||||
}
|
||||
std::unique_ptr<GrFragmentProcessor> GrBlurredEdgeFragmentProcessor::clone() const {
|
||||
return std::make_unique<GrBlurredEdgeFragmentProcessor>(*this);
|
||||
}
|
||||
#if GR_TEST_UTILS
|
||||
SkString GrBlurredEdgeFragmentProcessor::onDumpInfo() const { return SkString(); }
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
/**************************************************************************************************
|
||||
*** This file was autogenerated from GrBlurredEdgeFragmentProcessor.fp; do not modify.
|
||||
**************************************************************************************************/
|
||||
#ifndef GrBlurredEdgeFragmentProcessor_DEFINED
|
||||
#define GrBlurredEdgeFragmentProcessor_DEFINED
|
||||
|
||||
#include "include/core/SkM44.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
|
||||
class GrBlurredEdgeFragmentProcessor : public GrFragmentProcessor {
|
||||
public:
|
||||
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> inputFP) {
|
||||
return std::unique_ptr<GrFragmentProcessor>(
|
||||
new GrBlurredEdgeFragmentProcessor(std::move(inputFP)));
|
||||
}
|
||||
GrBlurredEdgeFragmentProcessor(const GrBlurredEdgeFragmentProcessor& src);
|
||||
std::unique_ptr<GrFragmentProcessor> clone() const override;
|
||||
const char* name() const override { return "BlurredEdgeFragmentProcessor"; }
|
||||
|
||||
private:
|
||||
GrBlurredEdgeFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP)
|
||||
: INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, kNone_OptimizationFlags) {
|
||||
this->registerChild(std::move(inputFP), SkSL::SampleUsage::PassThrough());
|
||||
}
|
||||
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
|
||||
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
#if GR_TEST_UTILS
|
||||
SkString onDumpInfo() const override;
|
||||
#endif
|
||||
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
|
||||
using INHERITED = GrFragmentProcessor;
|
||||
};
|
||||
#endif
|
@ -32,7 +32,7 @@
|
||||
#include "src/utils/SkShadowTessellator.h"
|
||||
#include <new>
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.h"
|
||||
#include "src/gpu/effects/GrSkSLFP.h"
|
||||
#include "src/gpu/geometry/GrStyledShape.h"
|
||||
#endif
|
||||
|
||||
@ -87,7 +87,15 @@ sk_sp<SkFlattenable> SkGaussianColorFilter::CreateProc(SkReadBuffer&) {
|
||||
GrFPResult SkGaussianColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
|
||||
GrRecordingContext*,
|
||||
const GrColorInfo&) const {
|
||||
return GrFPSuccess(GrBlurredEdgeFragmentProcessor::Make(std::move(inputFP)));
|
||||
static constexpr char kCode[] = R"(
|
||||
half4 main(half4 inColor) {
|
||||
half factor = 1 - inColor.a;
|
||||
factor = exp(-factor * factor * 4) - 0.018;
|
||||
return half4(factor);
|
||||
}
|
||||
)";
|
||||
auto builder = GrRuntimeFPBuilder::Make<kCode, SkRuntimeEffect::MakeForColorFilter>();
|
||||
return GrFPSuccess(GrFragmentProcessor::Compose(builder.makeFP(), std::move(inputFP)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user