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 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 decltype(blit_row_color32) blit_row_color32 = sk_default::blit_row_color32; | 77 decltype(blit_row_color32) blit_row_color32 = sk_default::blit_row_color32; |
78 | 78 |
79 decltype(matrix_translate) matrix_translate = sk_default::matrix
_translate; | 79 decltype(matrix_translate) matrix_translate = sk_default::matrix
_translate; |
80 decltype(matrix_scale_translate) matrix_scale_translate = sk_default::matrix
_scale_translate; | 80 decltype(matrix_scale_translate) matrix_scale_translate = sk_default::matrix
_scale_translate; |
81 decltype(matrix_affine) matrix_affine = sk_default::matrix
_affine; | 81 decltype(matrix_affine) matrix_affine = sk_default::matrix
_affine; |
82 | 82 |
83 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. | 83 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. |
84 void Init_ssse3(); | 84 void Init_ssse3(); |
85 void Init_sse41(); | 85 void Init_sse41(); |
86 void Init_sse42() { SkDEBUGCODE( SkDebugf("sse 4.2 detected\n"); ) } | 86 void Init_sse42() {} |
87 void Init_avx(); | 87 void Init_avx(); |
88 void Init_avx2() { SkDEBUGCODE( SkDebugf("avx2 detected\n"); ) } | 88 void Init_avx2() {} |
89 void Init_neon(); | 89 void Init_neon(); |
90 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, ... ? | |
91 | 90 |
92 static void init() { | 91 static void init() { |
93 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o
r feature? | 92 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o
r feature? |
94 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) | 93 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) |
95 uint32_t abcd[] = {0,0,0,0}; | 94 uint32_t abcd[] = {0,0,0,0}; |
96 cpuid(abcd); | 95 cpuid(abcd); |
97 if (abcd[2] & (1<< 9)) { Init_ssse3(); } | 96 if (abcd[2] & (1<< 9)) { Init_ssse3(); } |
98 if (abcd[2] & (1<<19)) { Init_sse41(); } | 97 if (abcd[2] & (1<<19)) { Init_sse41(); } |
99 if (abcd[2] & (1<<20)) { Init_sse42(); } | 98 if (abcd[2] & (1<<20)) { Init_sse42(); } |
100 | 99 |
(...skipping 18 matching lines...) Expand all Loading... |
119 | 118 |
120 SK_DECLARE_STATIC_ONCE(gInitOnce); | 119 SK_DECLARE_STATIC_ONCE(gInitOnce); |
121 void Init() { SkOnce(&gInitOnce, init); } | 120 void Init() { SkOnce(&gInitOnce, init); } |
122 | 121 |
123 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 122 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
124 static struct AutoInit { | 123 static struct AutoInit { |
125 AutoInit() { Init(); } | 124 AutoInit() { Init(); } |
126 } gAutoInit; | 125 } gAutoInit; |
127 #endif | 126 #endif |
128 } | 127 } |
OLD | NEW |