| 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 #define SK_OPTS_NS portable |
| 11 #include "SkBlurImageFilter_opts.h" |
| 10 #include "SkXfermode_opts.h" | 12 #include "SkXfermode_opts.h" |
| 11 | 13 |
| 12 #if defined(SK_CPU_X86) | 14 #if defined(SK_CPU_X86) |
| 13 #if defined(SK_BUILD_FOR_WIN32) | 15 #if defined(SK_BUILD_FOR_WIN32) |
| 14 #include <intrin.h> | 16 #include <intrin.h> |
| 15 static void cpuid(uint32_t abcd[4]) { __cpuid((int*)abcd, 1); } | 17 static void cpuid(uint32_t abcd[4]) { __cpuid((int*)abcd, 1); } |
| 16 #else | 18 #else |
| 17 #include <cpuid.h> | 19 #include <cpuid.h> |
| 18 static void cpuid(uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abc
d+2, abcd+3); } | 20 static void cpuid(uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abc
d+2, abcd+3); } |
| 19 #endif | 21 #endif |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 | 42 |
| 41 } // namespace portable | 43 } // namespace portable |
| 42 | 44 |
| 43 namespace SkOpts { | 45 namespace SkOpts { |
| 44 // Define default function pointer values here... | 46 // Define default function pointer values here... |
| 45 decltype(rsqrt) rsqrt = portable::rsqrt; | 47 decltype(rsqrt) rsqrt = portable::rsqrt; |
| 46 decltype(memset16) memset16 = portable::memsetT<uint16_t>; | 48 decltype(memset16) memset16 = portable::memsetT<uint16_t>; |
| 47 decltype(memset32) memset32 = portable::memsetT<uint32_t>; | 49 decltype(memset32) memset32 = portable::memsetT<uint32_t>; |
| 48 decltype(create_xfermode) create_xfermode = SkCreate4pxXfermode; | 50 decltype(create_xfermode) create_xfermode = SkCreate4pxXfermode; |
| 49 | 51 |
| 52 static const auto x = portable::kX, y = portable::kY; |
| 53 decltype(box_blur_xx) box_blur_xx = portable::box_blur<x,x>; |
| 54 decltype(box_blur_xy) box_blur_xy = portable::box_blur<x,y>; |
| 55 decltype(box_blur_yx) box_blur_yx = portable::box_blur<y,x>; |
| 56 |
| 50 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. | 57 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. |
| 51 void Init_sse2(); | 58 void Init_sse2(); |
| 52 void Init_ssse3(); | 59 void Init_ssse3(); |
| 53 void Init_sse41(); | 60 void Init_sse41(); |
| 54 void Init_neon(); | 61 void Init_neon(); |
| 55 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? | 62 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? |
| 56 | 63 |
| 57 static void init() { | 64 static void init() { |
| 58 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o
r feature? | 65 // 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) | 66 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 | 78 |
| 72 SK_DECLARE_STATIC_ONCE(gInitOnce); | 79 SK_DECLARE_STATIC_ONCE(gInitOnce); |
| 73 void Init() { SkOnce(&gInitOnce, init); } | 80 void Init() { SkOnce(&gInitOnce, init); } |
| 74 | 81 |
| 75 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 82 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
| 76 static struct AutoInit { | 83 static struct AutoInit { |
| 77 AutoInit() { Init(); } | 84 AutoInit() { Init(); } |
| 78 } gAutoInit; | 85 } gAutoInit; |
| 79 #endif | 86 #endif |
| 80 } | 87 } |
| OLD | NEW |