Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: src/core/SkXfermodeF16.cpp

Issue 2256023002: Flush denorm half floats to zero. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix threshold, clean up tests Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkSpanProcs.cpp ('k') | src/effects/gradients/Sk4fGradientPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermodeF16.cpp
diff --git a/src/core/SkXfermodeF16.cpp b/src/core/SkXfermodeF16.cpp
index 219e91188ea79052e99b940e6d578cc99982cb72..9cf7254d1fb165f006eb10c5f94ab223a0eccba7 100644
--- a/src/core/SkXfermodeF16.cpp
+++ b/src/core/SkXfermodeF16.cpp
@@ -22,16 +22,16 @@ static void xfer_1(const SkXfermode* xfer, uint64_t dst[], const SkPM4f* src, in
SkPM4f d;
if (aa) {
for (int i = 0; i < count; ++i) {
- Sk4f d4 = SkHalfToFloat_finite(dst[i]);
+ Sk4f d4 = SkHalfToFloat_finite_ftz(dst[i]);
d4.store(d.fVec);
Sk4f r4 = Sk4f::Load(proc(*src, d).fVec);
- SkFloatToHalf_finite(lerp_by_coverage(r4, d4, aa[i])).store(&dst[i]);
+ SkFloatToHalf_finite_ftz(lerp_by_coverage(r4, d4, aa[i])).store(&dst[i]);
}
} else {
for (int i = 0; i < count; ++i) {
- SkHalfToFloat_finite(dst[i]).store(d.fVec);
+ SkHalfToFloat_finite_ftz(dst[i]).store(d.fVec);
Sk4f r4 = Sk4f::Load(proc(*src, d).fVec);
- SkFloatToHalf_finite(r4).store(&dst[i]);
+ SkFloatToHalf_finite_ftz(r4).store(&dst[i]);
}
}
}
@@ -42,16 +42,16 @@ static void xfer_n(const SkXfermode* xfer, uint64_t dst[], const SkPM4f src[], i
SkPM4f d;
if (aa) {
for (int i = 0; i < count; ++i) {
- Sk4f d4 = SkHalfToFloat_finite(dst[i]);
+ Sk4f d4 = SkHalfToFloat_finite_ftz(dst[i]);
d4.store(d.fVec);
Sk4f r4 = Sk4f::Load(proc(src[i], d).fVec);
- SkFloatToHalf_finite(lerp_by_coverage(r4, d4, aa[i])).store(&dst[i]);
+ SkFloatToHalf_finite_ftz(lerp_by_coverage(r4, d4, aa[i])).store(&dst[i]);
}
} else {
for (int i = 0; i < count; ++i) {
- SkHalfToFloat_finite(dst[i]).store(d.fVec);
+ SkHalfToFloat_finite_ftz(dst[i]).store(d.fVec);
Sk4f r4 = Sk4f::Load(proc(src[i], d).fVec);
- SkFloatToHalf_finite(r4).store(&dst[i]);
+ SkFloatToHalf_finite_ftz(r4).store(&dst[i]);
}
}
}
@@ -64,8 +64,8 @@ static void clear(const SkXfermode*, uint64_t dst[], const SkPM4f*, int count, c
if (aa) {
for (int i = 0; i < count; ++i) {
if (aa[i]) {
- const Sk4f d4 = SkHalfToFloat_finite(dst[i]);
- SkFloatToHalf_finite(d4 * Sk4f((255 - aa[i]) * 1.0f/255)).store(&dst[i]);
+ const Sk4f d4 = SkHalfToFloat_finite_ftz(dst[i]);
+ SkFloatToHalf_finite_ftz(d4 * Sk4f((255 - aa[i]) * 1.0f/255)).store(&dst[i]);
}
}
} else {
@@ -82,12 +82,12 @@ static void src_1(const SkXfermode*, uint64_t dst[], const SkPM4f* src, int coun
const Sk4f s4 = Sk4f::Load(src->fVec);
if (aa) {
for (int i = 0; i < count; ++i) {
- const Sk4f d4 = SkHalfToFloat_finite(dst[i]);
- SkFloatToHalf_finite(lerp_by_coverage(s4, d4, aa[i])).store(&dst[i]);
+ const Sk4f d4 = SkHalfToFloat_finite_ftz(dst[i]);
+ SkFloatToHalf_finite_ftz(lerp_by_coverage(s4, d4, aa[i])).store(&dst[i]);
}
} else {
uint64_t s4h;
- SkFloatToHalf_finite(s4).store(&s4h);
+ SkFloatToHalf_finite_ftz(s4).store(&s4h);
sk_memset64(dst, s4h, count);
}
}
@@ -97,13 +97,13 @@ static void src_n(const SkXfermode*, uint64_t dst[], const SkPM4f src[], int cou
if (aa) {
for (int i = 0; i < count; ++i) {
const Sk4f s4 = Sk4f::Load(src[i].fVec);
- const Sk4f d4 = SkHalfToFloat_finite(dst[i]);
- SkFloatToHalf_finite(lerp_by_coverage(s4, d4, aa[i])).store(&dst[i]);
+ const Sk4f d4 = SkHalfToFloat_finite_ftz(dst[i]);
+ SkFloatToHalf_finite_ftz(lerp_by_coverage(s4, d4, aa[i])).store(&dst[i]);
}
} else {
for (int i = 0; i < count; ++i) {
const Sk4f s4 = Sk4f::Load(src[i].fVec);
- SkFloatToHalf_finite(s4).store(&dst[i]);
+ SkFloatToHalf_finite_ftz(s4).store(&dst[i]);
}
}
}
@@ -123,12 +123,12 @@ static void srcover_1(const SkXfermode*, uint64_t dst[], const SkPM4f* src, int
const Sk4f s4 = Sk4f::Load(src->fVec);
const Sk4f dst_scale = Sk4f(1 - get_alpha(s4));
for (int i = 0; i < count; ++i) {
- const Sk4f d4 = SkHalfToFloat_finite(dst[i]);
+ const Sk4f d4 = SkHalfToFloat_finite_ftz(dst[i]);
const Sk4f r4 = s4 + d4 * dst_scale;
if (aa) {
- SkFloatToHalf_finite(lerp_by_coverage(r4, d4, aa[i])).store(&dst[i]);
+ SkFloatToHalf_finite_ftz(lerp_by_coverage(r4, d4, aa[i])).store(&dst[i]);
} else {
- SkFloatToHalf_finite(r4).store(&dst[i]);
+ SkFloatToHalf_finite_ftz(r4).store(&dst[i]);
}
}
}
@@ -137,12 +137,12 @@ static void srcover_n(const SkXfermode*, uint64_t dst[], const SkPM4f src[], int
const SkAlpha aa[]) {
for (int i = 0; i < count; ++i) {
Sk4f s = Sk4f::Load(src+i),
- d = SkHalfToFloat_finite(dst[i]),
+ d = SkHalfToFloat_finite_ftz(dst[i]),
r = s + d*(1.0f - SkNx_shuffle<3,3,3,3>(s));
if (aa) {
r = lerp_by_coverage(r, d, aa[i]);
}
- SkFloatToHalf_finite(r).store(&dst[i]);
+ SkFloatToHalf_finite_ftz(r).store(&dst[i]);
}
}
« no previous file with comments | « src/core/SkSpanProcs.cpp ('k') | src/effects/gradients/Sk4fGradientPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698