aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-10-20 15:11:35 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-20 20:29:05 +0000
commit2b2936e75c79c61ff04082f5ae7a9738c439caac (patch)
treeefdca053dec922b410dd62206310fbfde95d63f9
parentf04ff7696d34d810a94b7fd98aa0006955f57fc0 (diff)
Make GrRectBlurEffect use bilerp
Bug: skia:7031 Change-Id: I8061f516741bf7efd5020984a5b45a9d57307d43 Reviewed-on: https://skia-review.googlesource.com/62461 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r--src/gpu/effects/GrRectBlurEffect.fp13
-rw-r--r--src/gpu/effects/GrRectBlurEffect.h10
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.cpp2
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.fp2
4 files changed, 19 insertions, 8 deletions
diff --git a/src/gpu/effects/GrRectBlurEffect.fp b/src/gpu/effects/GrRectBlurEffect.fp
index fe5d59ed0b..d20f52b76e 100644
--- a/src/gpu/effects/GrRectBlurEffect.fp
+++ b/src/gpu/effects/GrRectBlurEffect.fp
@@ -7,6 +7,14 @@ in uniform float4 rect;
in float sigma;
in uniform sampler2D blurProfile;
+@constructorParams {
+ GrSamplerState samplerParams
+}
+
+@samplerParams(blurProfile) {
+ samplerParams
+}
+
// in OpenGL ES, mediump floats have a minimum range of 2^14. If we have coordinates bigger than
// that, the shader math will end up with infinities and result in the blur effect not working
// correctly. To avoid this, we switch into highp when the coordinates are too big. As 2^14 is the
@@ -75,8 +83,9 @@ uniform half profileSize;
return nullptr;
}
- return std::unique_ptr<GrFragmentProcessor>(new GrRectBlurEffect(rect, sigma,
- std::move(blurProfile)));
+ return std::unique_ptr<GrFragmentProcessor>(new GrRectBlurEffect(
+ rect, sigma, std::move(blurProfile),
+ GrSamplerState(GrSamplerState::WrapMode::kClamp, GrSamplerState::Filter::kBilerp)));
}
}
diff --git a/src/gpu/effects/GrRectBlurEffect.h b/src/gpu/effects/GrRectBlurEffect.h
index 7a8bc2c005..688bb3d545 100644
--- a/src/gpu/effects/GrRectBlurEffect.h
+++ b/src/gpu/effects/GrRectBlurEffect.h
@@ -71,20 +71,22 @@ public:
return nullptr;
}
- return std::unique_ptr<GrFragmentProcessor>(
- new GrRectBlurEffect(rect, sigma, std::move(blurProfile)));
+ return std::unique_ptr<GrFragmentProcessor>(new GrRectBlurEffect(
+ rect, sigma, std::move(blurProfile),
+ GrSamplerState(GrSamplerState::WrapMode::kClamp, GrSamplerState::Filter::kBilerp)));
}
GrRectBlurEffect(const GrRectBlurEffect& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "RectBlurEffect"; }
private:
- GrRectBlurEffect(SkRect rect, float sigma, sk_sp<GrTextureProxy> blurProfile)
+ GrRectBlurEffect(SkRect rect, float sigma, sk_sp<GrTextureProxy> blurProfile,
+ GrSamplerState samplerParams)
: INHERITED(kGrRectBlurEffect_ClassID,
(OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRect(rect)
, fSigma(sigma)
- , fBlurProfile(std::move(blurProfile)) {
+ , fBlurProfile(std::move(blurProfile), samplerParams) {
this->addTextureSampler(&fBlurProfile);
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 595c5e6324..c0dec230f7 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -75,7 +75,7 @@ std::unique_ptr<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(
: GrSamplerState::Filter::kNearest);
const SkMatrix& matrix = GrTest::TestMatrix(testData->fRandom);
- return GrSimpleTextureEffect::Make(testData->textureProxy(texIdx), matrix);
+ return GrSimpleTextureEffect::Make(testData->textureProxy(texIdx), matrix, params);
}
#endif
#endif
diff --git a/src/gpu/effects/GrSimpleTextureEffect.fp b/src/gpu/effects/GrSimpleTextureEffect.fp
index 9e9685f626..b5bc49fb97 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.fp
+++ b/src/gpu/effects/GrSimpleTextureEffect.fp
@@ -65,5 +65,5 @@ void main() {
: GrSamplerState::Filter::kNearest);
const SkMatrix& matrix = GrTest::TestMatrix(testData->fRandom);
- return GrSimpleTextureEffect::Make(testData->textureProxy(texIdx), matrix);
+ return GrSimpleTextureEffect::Make(testData->textureProxy(texIdx), matrix, params);
}