Graceful degredation for SkOpts_hsw.
authorMike Klein <mtklein@chromium.org>
Thu, 26 Jan 2017 21:23:26 +0000 (16:23 -0500)
committerMike Klein <mtklein@chromium.org>
Thu, 26 Jan 2017 21:47:31 +0000 (21:47 +0000)
__AVX2__ will not be defined if you omit -mavx2.  Android does this
intentionally for x86 builds.  (No mobile CPU supports AVX2 AFAIK.)

This should fix the Android roll.

Change-Id: Ib94c862641abc11fbb46863afc53bcc049f362ad
Reviewed-on: https://skia-review.googlesource.com/7633
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Matt Sarett <msarett@google.com>
src/opts/SkOpts_hsw.cpp

index 843dcb5..f14d2a5 100644 (file)
@@ -12,6 +12,8 @@
 #include <immintrin.h>   // ODR safe
 #include <stdint.h>      // ODR safe
 
+#if defined(__AVX2__)
+
 namespace hsw {
 
     void convolve_vertically(const int16_t* filter, int filterLen,
@@ -94,3 +96,9 @@ namespace SkOpts {
         convolve_vertically = hsw::convolve_vertically;
     }
 }
+
+#else  // defined(__AVX2__) is not true...
+
+namespace SkOpts { void Init_hsw() {} }
+
+#endif