aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-01-26 17:35:06 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-27 14:56:48 +0000
commit85eb4226a4cd8c10a0e3f3ba2f3a60efbb2dd61b (patch)
tree0f740e811d6360b4c5ae059e6a80431e8567ee43 /experimental
parentbcda1f07d5e1b8d080e0134a24c5bc1707ef3985 (diff)
Start of rewrite of GrFragmentProcessor optimizations.
This adds a replacement for computeInvariantOutput buts does not use it yet. The replacement allows for three types of optimizations: * known input color -> known output color for GrFP elimination * tracking of whether all color processors modulate their input for the "tweak alpha" optimziation * opaqueness tracking This loses some of the generality of computInvariantOutput. It does not track the known output status of individual color components (other than opaque alpha). It does not track whether GrFragmentProcessors read their input color. It doesn't allow a processor that will receive non-constant output to advertise that it produces a constant output. These could probably be added back in the unlikely case that they prove valuable. Unlike computeInvariantOutput the optimizations are decided at instantiation time and constant colors are expressed as GrColor4f rather than GrColor. Change-Id: I684d3f9050693dde2d28154fa695e049ed8cf61a Reviewed-on: https://skia-review.googlesource.com/7481 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'experimental')
-rw-r--r--experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
index de5cfab039..c9fca4bd55 100644
--- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
+++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
@@ -675,17 +675,17 @@ private:
inout->setToUnknown();
}
- GrPerlinNoise2Effect(SkPerlinNoiseShader2::Type type,
- int numOctaves, bool stitchTiles,
- SkPerlinNoiseShader2::PaintingData* paintingData,
- GrTexture* permutationsTexture, GrTexture* noiseTexture,
- const SkMatrix& matrix)
- : fType(type)
- , fNumOctaves(numOctaves)
- , fStitchTiles(stitchTiles)
- , fPermutationsSampler(permutationsTexture)
- , fNoiseSampler(noiseTexture)
- , fPaintingData(paintingData) {
+ GrPerlinNoise2Effect(SkPerlinNoiseShader2::Type type, int numOctaves, bool stitchTiles,
+ SkPerlinNoiseShader2::PaintingData* paintingData,
+ GrTexture* permutationsTexture, GrTexture* noiseTexture,
+ const SkMatrix& matrix)
+ : INHERITED(kNone_OptimizationFlags)
+ , fType(type)
+ , fNumOctaves(numOctaves)
+ , fStitchTiles(stitchTiles)
+ , fPermutationsSampler(permutationsTexture)
+ , fNoiseSampler(noiseTexture)
+ , fPaintingData(paintingData) {
this->initClassID<GrPerlinNoise2Effect>();
this->addTextureSampler(&fPermutationsSampler);
this->addTextureSampler(&fNoiseSampler);
@@ -703,7 +703,6 @@ private:
TextureSampler fNoiseSampler;
SkPerlinNoiseShader2::PaintingData* fPaintingData;
-private:
typedef GrFragmentProcessor INHERITED;
};
@@ -1087,15 +1086,16 @@ private:
inout->setToUnknown();
}
- GrImprovedPerlinNoiseEffect(int octaves, SkScalar z,
+ GrImprovedPerlinNoiseEffect(int octaves, SkScalar z,
SkPerlinNoiseShader2::PaintingData* paintingData,
GrTexture* permutationsTexture, GrTexture* gradientTexture,
const SkMatrix& matrix)
- : fOctaves(octaves)
- , fZ(z)
- , fPermutationsSampler(permutationsTexture)
- , fGradientSampler(gradientTexture)
- , fPaintingData(paintingData) {
+ : INHERITED(kNone_OptimizationFlags)
+ , fOctaves(octaves)
+ , fZ(z)
+ , fPermutationsSampler(permutationsTexture)
+ , fGradientSampler(gradientTexture)
+ , fPaintingData(paintingData) {
this->initClassID<GrImprovedPerlinNoiseEffect>();
this->addTextureSampler(&fPermutationsSampler);
this->addTextureSampler(&fGradientSampler);
@@ -1112,7 +1112,6 @@ private:
TextureSampler fGradientSampler;
SkPerlinNoiseShader2::PaintingData* fPaintingData;
-private:
typedef GrFragmentProcessor INHERITED;
};