OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkOnce.h" | 8 #include "SkOnce.h" |
9 #include "SkOpts.h" | 9 #include "SkOpts.h" |
10 #include "SkXfermode_opts.h" | 10 #include "SkXfermode_opts.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 decltype(create_xfermode) create_xfermode = SkCreate4pxXfermode; | 48 decltype(create_xfermode) create_xfermode = SkCreate4pxXfermode; |
49 | 49 |
50 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. | 50 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. |
51 void Init_sse2(); | 51 void Init_sse2(); |
52 void Init_ssse3(); | 52 void Init_ssse3(); |
53 void Init_sse41(); | 53 void Init_sse41(); |
54 void Init_neon(); | 54 void Init_neon(); |
55 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? | 55 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? |
56 | 56 |
57 static void init() { | 57 static void init() { |
58 #if defined(SK_CPU_X86) | 58 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o
r feature? |
| 59 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) |
59 uint32_t abcd[] = {0,0,0,0}; | 60 uint32_t abcd[] = {0,0,0,0}; |
60 cpuid(abcd); | 61 cpuid(abcd); |
61 if (abcd[3] & (1<<26)) { Init_sse2(); } | 62 if (abcd[3] & (1<<26)) { Init_sse2(); } |
62 if (abcd[2] & (1<< 9)) { Init_ssse3(); } | 63 if (abcd[2] & (1<< 9)) { Init_ssse3(); } |
63 if (abcd[2] & (1<<19)) { Init_sse41(); } | 64 if (abcd[2] & (1<<19)) { Init_sse41(); } |
64 #elif defined(SK_ARM_HAS_NEON) | 65 #elif defined(SK_ARM_HAS_NEON) |
65 Init_neon(); | 66 Init_neon(); |
66 #elif defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR_ANDROID) | 67 #elif defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR_ANDROID) |
67 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon
(); } | 68 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon
(); } |
68 #endif | 69 #endif |
69 } | 70 } |
70 | 71 |
71 SK_DECLARE_STATIC_ONCE(gInitOnce); | 72 SK_DECLARE_STATIC_ONCE(gInitOnce); |
72 void Init() { SkOnce(&gInitOnce, init); } | 73 void Init() { SkOnce(&gInitOnce, init); } |
73 | 74 |
74 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 75 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
75 static struct AutoInit { | 76 static struct AutoInit { |
76 AutoInit() { Init(); } | 77 AutoInit() { Init(); } |
77 } gAutoInit; | 78 } gAutoInit; |
78 #endif | 79 #endif |
79 } | 80 } |
OLD | NEW |