| 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 | 10 |
| 11 #define SK_OPTS_NS sk_default | 11 #define SK_OPTS_NS sk_default |
| 12 #include "SkBlitMask_opts.h" | 12 #include "SkBlitMask_opts.h" |
| 13 #include "SkBlitRow_opts.h" |
| 13 #include "SkBlurImageFilter_opts.h" | 14 #include "SkBlurImageFilter_opts.h" |
| 14 #include "SkColorCubeFilter_opts.h" | 15 #include "SkColorCubeFilter_opts.h" |
| 15 #include "SkFloatingPoint_opts.h" | 16 #include "SkFloatingPoint_opts.h" |
| 16 #include "SkMorphologyImageFilter_opts.h" | 17 #include "SkMorphologyImageFilter_opts.h" |
| 17 #include "SkTextureCompressor_opts.h" | 18 #include "SkTextureCompressor_opts.h" |
| 18 #include "SkUtils_opts.h" | 19 #include "SkUtils_opts.h" |
| 19 #include "SkXfermode_opts.h" | 20 #include "SkXfermode_opts.h" |
| 20 | 21 |
| 21 #if defined(SK_CPU_X86) | 22 #if defined(SK_CPU_X86) |
| 22 #if defined(SK_BUILD_FOR_WIN32) | 23 #if defined(SK_BUILD_FOR_WIN32) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 48 decltype(dilate_x) dilate_x = sk_default::dilate_x; | 49 decltype(dilate_x) dilate_x = sk_default::dilate_x; |
| 49 decltype(dilate_y) dilate_y = sk_default::dilate_y; | 50 decltype(dilate_y) dilate_y = sk_default::dilate_y; |
| 50 decltype( erode_x) erode_x = sk_default::erode_x; | 51 decltype( erode_x) erode_x = sk_default::erode_x; |
| 51 decltype( erode_y) erode_y = sk_default::erode_y; | 52 decltype( erode_y) erode_y = sk_default::erode_y; |
| 52 | 53 |
| 53 decltype(texture_compressor) texture_compressor = sk_default::texture_
compressor; | 54 decltype(texture_compressor) texture_compressor = sk_default::texture_
compressor; |
| 54 decltype(fill_block_dimensions) fill_block_dimensions = sk_default::fill_blo
ck_dimensions; | 55 decltype(fill_block_dimensions) fill_block_dimensions = sk_default::fill_blo
ck_dimensions; |
| 55 | 56 |
| 56 decltype(blit_mask_d32_a8) blit_mask_d32_a8 = sk_default::blit_mask_d32_a8; | 57 decltype(blit_mask_d32_a8) blit_mask_d32_a8 = sk_default::blit_mask_d32_a8; |
| 57 | 58 |
| 59 decltype(blit_row_color32) blit_row_color32 = sk_default::blit_row_color32; |
| 60 |
| 58 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. | 61 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. |
| 59 void Init_ssse3(); | 62 void Init_ssse3(); |
| 60 void Init_sse41(); | 63 void Init_sse41(); |
| 61 void Init_neon(); | 64 void Init_neon(); |
| 62 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? | 65 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? |
| 63 | 66 |
| 64 static void init() { | 67 static void init() { |
| 65 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o
r feature? | 68 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o
r feature? |
| 66 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) | 69 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) |
| 67 uint32_t abcd[] = {0,0,0,0}; | 70 uint32_t abcd[] = {0,0,0,0}; |
| 68 cpuid(abcd); | 71 cpuid(abcd); |
| 69 if (abcd[2] & (1<< 9)) { Init_ssse3(); } | 72 if (abcd[2] & (1<< 9)) { Init_ssse3(); } |
| 70 if (abcd[2] & (1<<19)) { Init_sse41(); } | 73 if (abcd[2] & (1<<19)) { Init_sse41(); } |
| 71 #elif !defined(SK_ARM_HAS_NEON) && defined(SK_CPU_ARM32) && defined(SK_BUILD
_FOR_ANDROID) | 74 #elif !defined(SK_ARM_HAS_NEON) && defined(SK_CPU_ARM32) && defined(SK_BUILD
_FOR_ANDROID) |
| 72 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon
(); } | 75 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon
(); } |
| 73 #endif | 76 #endif |
| 74 } | 77 } |
| 75 | 78 |
| 76 SK_DECLARE_STATIC_ONCE(gInitOnce); | 79 SK_DECLARE_STATIC_ONCE(gInitOnce); |
| 77 void Init() { SkOnce(&gInitOnce, init); } | 80 void Init() { SkOnce(&gInitOnce, init); } |
| 78 | 81 |
| 79 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 82 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
| 80 static struct AutoInit { | 83 static struct AutoInit { |
| 81 AutoInit() { Init(); } | 84 AutoInit() { Init(); } |
| 82 } gAutoInit; | 85 } gAutoInit; |
| 83 #endif | 86 #endif |
| 84 } | 87 } |
| OLD | NEW |