aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-06-01 14:43:51 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-01 19:23:10 +0000
commit5df94d508ecfb62d54b757961dba611a00ff563c (patch)
tree3c1d188883c341bc22f712ed5e1508fb52e85224 /src/shaders
parente0f7e164eed88912ee708de57da25ad05933366f (diff)
have shaders that need seed_shader call it themselves
This ought to make compose shader and our sprite blitter a bit more efficient. Compose shader can simply re-seed instead of saving the xy values off to a buffer. The sprite blitter doesn't need xy at all. Change-Id: Ib4b3509288810f74a4c8e2978ce2ca14d8644980 Reviewed-on: https://skia-review.googlesource.com/18405 Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/shaders')
-rw-r--r--src/shaders/SkComposeShader.cpp8
-rw-r--r--src/shaders/SkImageShader.cpp1
-rw-r--r--src/shaders/gradients/SkGradientShader.cpp2
3 files changed, 4 insertions, 7 deletions
diff --git a/src/shaders/SkComposeShader.cpp b/src/shaders/SkComposeShader.cpp
index 7735494291..be2388f4ec 100644
--- a/src/shaders/SkComposeShader.cpp
+++ b/src/shaders/SkComposeShader.cpp
@@ -128,24 +128,18 @@ bool SkComposeShader::onAppendStages(SkRasterPipeline* pipeline, SkColorSpace* d
SkArenaAlloc* alloc, const SkMatrix& ctm,
const SkPaint& paint, const SkMatrix* localM) const {
struct Storage {
- float fXY[4 * SkJumper_kMaxStride];
float fRGBA[4 * SkJumper_kMaxStride];
float fAlpha;
};
auto storage = alloc->make<Storage>();
- // We need to save off device x,y (inputs to shader), since after calling fShaderA they
- // will be smashed, and I'll need them again for fShaderB. store_rgba saves off 4 registers
- // even though we only need to save r,g.
- pipeline->append(SkRasterPipeline::store_rgba, storage->fXY);
if (!as_SB(fShaderB)->appendStages(pipeline, dstCS, alloc, ctm, paint, localM)) { // SRC
return false;
}
// This outputs r,g,b,a, which we'll need later when we apply the mode, but we save it off now
// since fShaderB will overwrite them.
pipeline->append(SkRasterPipeline::store_rgba, storage->fRGBA);
- // Now we restore the device x,y for the next shader
- pipeline->append(SkRasterPipeline::load_rgba, storage->fXY);
+
if (!as_SB(fShaderA)->appendStages(pipeline, dstCS, alloc, ctm, paint, localM)) { // DST
return false;
}
diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp
index d46d2558e8..bdbd382638 100644
--- a/src/shaders/SkImageShader.cpp
+++ b/src/shaders/SkImageShader.cpp
@@ -258,6 +258,7 @@ bool SkImageShader::onAppendStages(SkRasterPipeline* p, SkColorSpace* dstCS, SkA
}
}
+ p->append(SkRasterPipeline::seed_shader);
struct MiscCtx {
std::unique_ptr<SkBitmapController::State> state;
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index 137da84d0c..d98c8c6c7e 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -422,6 +422,8 @@ bool SkGradientShaderBase::onAppendStages(SkRasterPipeline* p,
return false;
}
+ p->append(SkRasterPipeline::seed_shader);
+
auto* m = alloc->makeArrayDefault<float>(9);
if (matrix.asAffine(m)) {
p->append(SkRasterPipeline::matrix_2x3, m);