aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-11-18 15:47:22 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-18 22:11:12 +0000
commit2e35e8a45c9ff04b88d7a98b381ce56e565d8402 (patch)
tree6d852ff930cfde58847becd4763b41de605a7d51 /src/opts
parent1aaccc77dc14e9f08f52c12ca5661fc449f9c01a (diff)
mirror tiling
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5064 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I9d48ba73e145701245e5ec4f32c8c360da6baddd Reviewed-on: https://skia-review.googlesource.com/5064 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/opts')
-rw-r--r--src/opts/SkNx_sse.h1
-rw-r--r--src/opts/SkRasterPipeline_opts.h14
2 files changed, 10 insertions, 5 deletions
diff --git a/src/opts/SkNx_sse.h b/src/opts/SkNx_sse.h
index c1f4b2c1c5..fa9f4cde1f 100644
--- a/src/opts/SkNx_sse.h
+++ b/src/opts/SkNx_sse.h
@@ -610,6 +610,7 @@ public:
AI SkNx rsqrt() const { return _mm256_rsqrt_ps(fVec); }
AI SkNx invert() const { return _mm256_rcp_ps (fVec); }
+ AI SkNx abs() const { return _mm256_andnot_ps(_mm256_set1_ps(-0.0f), fVec); }
AI SkNx floor() const { return _mm256_floor_ps(fVec); }
AI float operator[](int k) const {
diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h
index d9760cbafa..ee957e147b 100644
--- a/src/opts/SkRasterPipeline_opts.h
+++ b/src/opts/SkRasterPipeline_opts.h
@@ -697,21 +697,25 @@ SI SkNf clamp(const SkNf& v, float limit) {
SI SkNf repeat(const SkNf& v, float limit) {
SkNf result = v - (v/limit).floor()*limit;
-
// For small negative v, (v/limit).floor()*limit can dominate v in the subtraction,
// which leaves result == limit. We want result < limit, so clamp it one ULP.
result = SkNf::Min(result, nextafterf(limit, 0));
-
return assert_in_tile(result, limit);
}
+SI SkNf mirror(const SkNf& v, float l/*imit*/) {
+ SkNf result = ((v - l) - ((v - l) / (2*l)).floor()*(2*l) - l).abs();
+ // Same deal as repeat.
+ result = SkNf::Min(result, nextafterf(l, 0));
+ return assert_in_tile(result, l);
+}
+
STAGE(clamp_x, true) { r = clamp (r, *(const int*)ctx); }
STAGE(clamp_y, true) { g = clamp (g, *(const int*)ctx); }
STAGE(repeat_x, true) { r = repeat(r, *(const int*)ctx); }
STAGE(repeat_y, true) { g = repeat(g, *(const int*)ctx); }
-
-STAGE(mirror_x, true) {} // TODO
-STAGE(mirror_y, true) {} // TODO
+STAGE(mirror_x, true) { r = mirror(r, *(const int*)ctx); }
+STAGE(mirror_y, true) { g = mirror(g, *(const int*)ctx); }
struct NearestCtx {