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