Chromium Code Reviews| 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 | |
|
djsollen
2015/08/04 14:39:56
given that you don't yet use this define I would r
mtklein
2015/08/04 14:46:44
Let's leave it. It's what it wants to be, modulo
| |
| 10 #include "SkXfermode_opts.h" | 11 #include "SkXfermode_opts.h" |
| 11 | 12 |
| 12 #if defined(SK_CPU_X86) | 13 #if defined(SK_CPU_X86) |
| 13 #if defined(SK_BUILD_FOR_WIN32) | 14 #if defined(SK_BUILD_FOR_WIN32) |
| 14 #include <intrin.h> | 15 #include <intrin.h> |
| 15 static void cpuid(uint32_t abcd[4]) { __cpuid((int*)abcd, 1); } | 16 static void cpuid(uint32_t abcd[4]) { __cpuid((int*)abcd, 1); } |
| 16 #else | 17 #else |
| 17 #include <cpuid.h> | 18 #include <cpuid.h> |
| 18 static void cpuid(uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abc d+2, abcd+3); } | 19 static void cpuid(uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abc d+2, abcd+3); } |
| 19 #endif | 20 #endif |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 40 | 41 |
| 41 } // namespace portable | 42 } // namespace portable |
| 42 | 43 |
| 43 namespace SkOpts { | 44 namespace SkOpts { |
| 44 // Define default function pointer values here... | 45 // Define default function pointer values here... |
| 45 decltype(rsqrt) rsqrt = portable::rsqrt; | 46 decltype(rsqrt) rsqrt = portable::rsqrt; |
| 46 decltype(memset16) memset16 = portable::memsetT<uint16_t>; | 47 decltype(memset16) memset16 = portable::memsetT<uint16_t>; |
| 47 decltype(memset32) memset32 = portable::memsetT<uint32_t>; | 48 decltype(memset32) memset32 = portable::memsetT<uint32_t>; |
| 48 decltype(create_xfermode) create_xfermode = SkCreate4pxXfermode; | 49 decltype(create_xfermode) create_xfermode = SkCreate4pxXfermode; |
| 49 | 50 |
| 51 decltype(box_blur_xx) box_blur_xx = nullptr; | |
|
djsollen
2015/08/04 14:39:56
this is a break from previous versions where we de
mtklein
2015/08/04 14:46:44
The portable blurs are in src/effects, and this ke
djsollen
2015/08/04 14:56:17
I like the idea that SkOpts functions are always d
mtklein_C
2015/08/04 15:16:56
I tried it and I'm convinced. Done!
| |
| 52 decltype(box_blur_xy) box_blur_xy = nullptr; | |
| 53 decltype(box_blur_yx) box_blur_yx = nullptr; | |
| 54 | |
| 50 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. | 55 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. |
| 51 void Init_sse2(); | 56 void Init_sse2(); |
| 52 void Init_ssse3(); | 57 void Init_ssse3(); |
| 53 void Init_sse41(); | 58 void Init_sse41(); |
| 54 void Init_neon(); | 59 void Init_neon(); |
| 55 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? | 60 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? |
| 56 | 61 |
| 57 static void init() { | 62 static void init() { |
| 58 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o r feature? | 63 // 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) | 64 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 71 | 76 |
| 72 SK_DECLARE_STATIC_ONCE(gInitOnce); | 77 SK_DECLARE_STATIC_ONCE(gInitOnce); |
| 73 void Init() { SkOnce(&gInitOnce, init); } | 78 void Init() { SkOnce(&gInitOnce, init); } |
| 74 | 79 |
| 75 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 80 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
| 76 static struct AutoInit { | 81 static struct AutoInit { |
| 77 AutoInit() { Init(); } | 82 AutoInit() { Init(); } |
| 78 } gAutoInit; | 83 } gAutoInit; |
| 79 #endif | 84 #endif |
| 80 } | 85 } |
| OLD | NEW |