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

Unified Diff: cc/base/math_util.cc

Issue 2179003003: cc: disable denorm handling before calling into Skia's filter code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Protect orig_state_ member var with #ifdef __SSE__. Created 4 years, 5 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 | « cc/base/math_util.h ('k') | cc/output/software_renderer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/math_util.cc
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index e3cb81f70cca5c92b9b881b744c97a34d3daada2..d28c195971f6cd14eb753b6d9eddd51d1dd082fb 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -7,6 +7,9 @@
#include <algorithm>
#include <cmath>
#include <limits>
+#ifdef __SSE__
+#include <xmmintrin.h>
+#endif
#include "base/trace_event/trace_event_argument.h"
#include "base/values.h"
@@ -918,4 +921,18 @@ gfx::Vector3dF MathUtil::GetYAxis(const gfx::Transform& transform) {
transform.matrix().getFloat(2, 1));
}
+ScopedSubnormalFloatDisabler::ScopedSubnormalFloatDisabler() {
+#ifdef __SSE__
+ // Turn on "subnormals are zero" and "flush to zero" CSR flags.
+ orig_state_ = _mm_getcsr();
+ _mm_setcsr(orig_state_ | 0x8040);
+#endif
+}
+
+ScopedSubnormalFloatDisabler::~ScopedSubnormalFloatDisabler() {
+#ifdef __SSE__
+ _mm_setcsr(orig_state_);
+#endif
+}
+
} // namespace cc
« no previous file with comments | « cc/base/math_util.h ('k') | cc/output/software_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698