aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-12-11 16:09:40 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-11 16:09:49 +0000
commit2bbcda3071a2656612fa5a8bc8ab12335ef98aa2 (patch)
tree96a905da5efb902db5fca6ed4289c5f7b565fb5c /src/shaders
parentc279851bc2e55a2c8864dd964be018cbccb262c1 (diff)
Revert "add experimental bilerp_clamp_8888 stage"
This reverts commit a7fa3377d24643d86117159f8a58d2ee66880a4d. Reason for revert: lots of crashing GPU bots. Original change's description: > add experimental bilerp_clamp_8888 stage > > It looks like we can specialize hot image shaders into their > own single stages for a good speedup on both x86 and ARM. > > I've started here with bilerp_clamp_8888, and will > follow up with bgra and 565, and lowp versions of those, > and probably also the same for nearest neighbors. > > All pixels are identical in GMs. > > Change-Id: I2f6995767cd38053d670b8d0bfdb71b687803d70 > Reviewed-on: https://skia-review.googlesource.com/82100 > Reviewed-by: Yuqian Li <liyuqian@google.com> > Commit-Queue: Mike Klein <mtklein@chromium.org> TBR=mtklein@chromium.org,mtklein@google.com,liyuqian@google.com Change-Id: If70abb91b69bcd781e395dd3ac05ff1eebb1169f No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/83340 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/shaders')
-rw-r--r--src/shaders/SkImageShader.cpp49
1 files changed, 15 insertions, 34 deletions
diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp
index 5c97f1c594..fff59c7bc3 100644
--- a/src/shaders/SkImageShader.cpp
+++ b/src/shaders/SkImageShader.cpp
@@ -313,7 +313,7 @@ bool SkImageShader::onAppendStages(const StageRec& rec) const {
p->append_matrix(alloc, matrix);
auto gather = alloc->make<SkJumper_GatherCtx>();
- gather->pixels = pm.addr();
+ gather->pixels = pm.writable_addr(); // Don't worry, we won't write to it.
gather->stride = pm.rowBytesAsPixels();
gather->width = pm.width();
gather->height = pm.height();
@@ -325,8 +325,6 @@ bool SkImageShader::onAppendStages(const StageRec& rec) const {
limit_y->scale = pm.height();
limit_y->invScale = 1.0f / pm.height();
- bool is_srgb = rec.fDstCS && (!info.colorSpace() || info.gammaCloseToSRGB());
-
auto append_tiling_and_gather = [&] {
switch (fTileModeX) {
case kClamp_TileMode: /* The gather_xxx stage will clamp for us. */ break;
@@ -348,38 +346,11 @@ bool SkImageShader::onAppendStages(const StageRec& rec) const {
case kRGBA_F16_SkColorType: p->append(SkRasterPipeline::gather_f16, gather); break;
default: SkASSERT(false);
}
- if (is_srgb) {
+ if (rec.fDstCS && (!info.colorSpace() || info.gammaCloseToSRGB())) {
p->append_from_srgb(info.alphaType());
}
};
- auto append_misc = [&] {
- if (info.colorType() == kAlpha_8_SkColorType) {
- p->append(SkRasterPipeline::set_rgb, &misc->paint_color);
- }
- if (info.colorType() == kAlpha_8_SkColorType ||
- info.alphaType() == kUnpremul_SkAlphaType) {
- p->append(SkRasterPipeline::premul);
- }
- if (quality > kLow_SkFilterQuality) {
- // Bicubic filtering naturally produces out of range values on both sides.
- p->append(SkRasterPipeline::clamp_0);
- p->append(SkRasterPipeline::clamp_a);
- }
- append_gamut_transform(p, alloc, info.colorSpace(), rec.fDstCS, kPremul_SkAlphaType);
- return true;
- };
-
- if (quality == kLow_SkFilterQuality &&
- info.colorType() == kRGBA_8888_SkColorType &&
- fTileModeX == SkShader::kClamp_TileMode &&
- fTileModeY == SkShader::kClamp_TileMode &&
- !is_srgb) {
-
- p->append(SkRasterPipeline::bilerp_clamp_8888, gather);
- return append_misc();
- }
-
SkJumper_SamplerCtx* sampler = nullptr;
if (quality != kNone_SkFilterQuality) {
sampler = alloc->make<SkJumper_SamplerCtx>();
@@ -395,7 +366,6 @@ bool SkImageShader::onAppendStages(const StageRec& rec) const {
if (quality == kNone_SkFilterQuality) {
append_tiling_and_gather();
-
} else if (quality == kLow_SkFilterQuality) {
p->append(SkRasterPipeline::save_xy, sampler);
@@ -405,7 +375,6 @@ bool SkImageShader::onAppendStages(const StageRec& rec) const {
sample(SkRasterPipeline::bilinear_px, SkRasterPipeline::bilinear_py);
p->append(SkRasterPipeline::move_dst_src);
-
} else {
p->append(SkRasterPipeline::save_xy, sampler);
@@ -432,5 +401,17 @@ bool SkImageShader::onAppendStages(const StageRec& rec) const {
p->append(SkRasterPipeline::move_dst_src);
}
- return append_misc();
+ if (info.colorType() == kAlpha_8_SkColorType) {
+ p->append(SkRasterPipeline::set_rgb, &misc->paint_color);
+ }
+ if (info.colorType() == kAlpha_8_SkColorType || info.alphaType() == kUnpremul_SkAlphaType) {
+ p->append(SkRasterPipeline::premul);
+ }
+ if (quality > kLow_SkFilterQuality) {
+ // Bicubic filtering naturally produces out of range values on both sides.
+ p->append(SkRasterPipeline::clamp_0);
+ p->append(SkRasterPipeline::clamp_a);
+ }
+ append_gamut_transform(p, alloc, info.colorSpace(), rec.fDstCS, kPremul_SkAlphaType);
+ return true;
}