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 | 11 |
11 #if defined(SK_CPU_X86) | 12 #if defined(SK_CPU_X86) |
12 #if defined(SK_BUILD_FOR_WIN32) | 13 #if defined(SK_BUILD_FOR_WIN32) |
13 #include <intrin.h> | 14 #include <intrin.h> |
14 static void cpuid(uint32_t abcd[4]) { __cpuid((int*)abcd, 1); } | 15 static void cpuid(uint32_t abcd[4]) { __cpuid((int*)abcd, 1); } |
15 #else | 16 #else |
16 #include <cpuid.h> | 17 #include <cpuid.h> |
17 static void cpuid(uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abc
d+2, abcd+3); } | 18 static void cpuid(uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abc
d+2, abcd+3); } |
18 #endif | 19 #endif |
19 #elif !defined(SK_ARM_HAS_NEON) && defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR
_ANDROID) | 20 #elif !defined(SK_ARM_HAS_NEON) && defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR
_ANDROID) |
(...skipping 14 matching lines...) Expand all Loading... |
34 return estimate; | 35 return estimate; |
35 } | 36 } |
36 | 37 |
37 template <typename T> | 38 template <typename T> |
38 static void memsetT(T dst[], T val, int n) { while (n --> 0) { *dst++ = val; } } | 39 static void memsetT(T dst[], T val, int n) { while (n --> 0) { *dst++ = val; } } |
39 | 40 |
40 } // namespace portable | 41 } // namespace portable |
41 | 42 |
42 namespace SkOpts { | 43 namespace SkOpts { |
43 // Define default function pointer values here... | 44 // Define default function pointer values here... |
44 decltype(rsqrt) rsqrt = portable::rsqrt; | 45 decltype(rsqrt) rsqrt = portable::rsqrt; |
45 decltype(memset16) memset16 = portable::memsetT<uint16_t>; | 46 decltype(memset16) memset16 = portable::memsetT<uint16_t>; |
46 decltype(memset32) memset32 = portable::memsetT<uint32_t>; | 47 decltype(memset32) memset32 = portable::memsetT<uint32_t>; |
47 | 48 decltype(create_xfermode) create_xfermode = SkCreate4pxXfermode; |
48 | 49 |
49 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. | 50 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. |
50 void Init_sse2(); | 51 void Init_sse2(); |
51 void Init_ssse3(); | 52 void Init_ssse3(); |
52 void Init_sse41(); | 53 void Init_sse41(); |
53 void Init_neon(); | 54 void Init_neon(); |
54 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? | 55 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? |
55 | 56 |
56 static void init() { | 57 static void init() { |
57 #if defined(SK_CPU_X86) | 58 #if defined(SK_CPU_X86) |
(...skipping 11 matching lines...) Expand all Loading... |
69 | 70 |
70 SK_DECLARE_STATIC_ONCE(gInitOnce); | 71 SK_DECLARE_STATIC_ONCE(gInitOnce); |
71 void Init() { SkOnce(&gInitOnce, init); } | 72 void Init() { SkOnce(&gInitOnce, init); } |
72 | 73 |
73 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 74 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
74 static struct AutoInit { | 75 static struct AutoInit { |
75 AutoInit() { Init(); } | 76 AutoInit() { Init(); } |
76 } gAutoInit; | 77 } gAutoInit; |
77 #endif | 78 #endif |
78 } | 79 } |
OLD | NEW |