diff options
author | Mike Klein <mtklein@chromium.org> | 2016-10-19 13:39:13 -0400 |
---|---|---|
committer | Mike Klein <mtklein@chromium.org> | 2016-10-19 18:01:37 +0000 |
commit | d8765e3455ff3f99cc733f01f8d10d4b0939bbd5 (patch) | |
tree | 88be329c50b211645a7e5adffa5c18154cea654e | |
parent | 4bc6d8fd3d0586444d743b07975a492cb6305448 (diff) |
Define SK_CPU_SSE_LEVEL on Windows builds.
We check this define to know which intrinsics we can call safely. The -msse flags set it for us on non-MSVC, but MSVC has no such switch. We do this in GYP (and Chrome's GN) too. No need for any defines on :avx or :hsw targets... the /arch:AVX and /arch:AVX2 do set SK_CPU_SSE_LEVEL for us.
Most directly, this means things like Sk4f::thenElse() will now use blendps when compiled into SkOpts_sse41.cpp.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3666
Change-Id: Ie80a8b8e5544250b45cfe51c40604fade06b3ef9
Reviewed-on: https://skia-review.googlesource.com/3666
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Matt Sarett <msarett@google.com>
-rw-r--r-- | BUILD.gn | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -195,7 +195,9 @@ opts("crc32") { opts("sse2") { enabled = is_x86 sources = skia_opts.sse2_sources - if (!is_win) { + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ] + } else { cflags = [ "-msse2" ] } } @@ -203,7 +205,9 @@ opts("sse2") { opts("ssse3") { enabled = is_x86 sources = skia_opts.ssse3_sources - if (!is_win) { + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ] + } else { cflags = [ "-mssse3" ] } } @@ -211,7 +215,9 @@ opts("ssse3") { opts("sse41") { enabled = is_x86 sources = skia_opts.sse41_sources - if (!is_win) { + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ] + } else { cflags = [ "-msse4.1" ] } } @@ -219,7 +225,9 @@ opts("sse41") { opts("sse42") { enabled = is_x86 sources = skia_opts.sse42_sources - if (!is_win) { + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ] + } else { cflags = [ "-msse4.2" ] } } |