Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/opts/opts_check_x86.cpp

Issue 272503006: Improved x86 SSE build and run-time checks. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added 64-bit check for VisualStudio Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkPreConfig.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009 The Android Open Source Project 2 * Copyright 2009 The Android Open Source Project
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 "SkBitmapFilter_opts_SSE2.h" 8 #include "SkBitmapFilter_opts_SSE2.h"
9 #include "SkBitmapProcState_opts_SSE2.h" 9 #include "SkBitmapProcState_opts_SSE2.h"
10 #include "SkBitmapProcState_opts_SSSE3.h" 10 #include "SkBitmapProcState_opts_SSSE3.h"
11 #include "SkBlitMask.h" 11 #include "SkBlitMask.h"
12 #include "SkBlitRect_opts_SSE2.h" 12 #include "SkBlitRect_opts_SSE2.h"
13 #include "SkBlitRow.h" 13 #include "SkBlitRow.h"
14 #include "SkBlitRow_opts_SSE2.h" 14 #include "SkBlitRow_opts_SSE2.h"
15 #include "SkBlurImage_opts_SSE2.h" 15 #include "SkBlurImage_opts_SSE2.h"
16 #include "SkMorphology_opts.h" 16 #include "SkMorphology_opts.h"
17 #include "SkMorphology_opts_SSE2.h" 17 #include "SkMorphology_opts_SSE2.h"
18 #include "SkRTConf.h" 18 #include "SkRTConf.h"
19 #include "SkUtils.h" 19 #include "SkUtils.h"
20 #include "SkUtils_opts_SSE2.h" 20 #include "SkUtils_opts_SSE2.h"
21 #include "SkXfermode.h" 21 #include "SkXfermode.h"
22 #include "SkXfermode_proccoeff.h" 22 #include "SkXfermode_proccoeff.h"
23 23
24 #if defined(_MSC_VER) && defined(_WIN64) 24 #if defined(_MSC_VER) && defined(_WIN64)
25 #include <intrin.h> 25 #include <intrin.h>
26 #endif 26 #endif
27 27
28 /* This file must *not* be compiled with -msse or -msse2, otherwise 28 /* This file must *not* be compiled with -msse or any other optional SIMD
29 gcc may generate sse2 even for scalar ops (and thus give an invalid 29 extension, otherwise gcc may generate SIMD instructions even for scalar ops
30 instruction on Pentium3 on the code below). Only files named *_SSE2.cpp 30 (and thus give an invalid instruction on Pentium3 on the code below).
31 in this directory should be compiled with -msse2. */ 31 For example, only files named *_SSE2.cpp in this directory should be
32 compiled with -msse2 or higher. */
32 33
33 34
34 /* Function to get the CPU SSE-level in runtime, for different compilers. */ 35 /* Function to get the CPU SSE-level in runtime, for different compilers. */
35 #ifdef _MSC_VER 36 #ifdef _MSC_VER
36 static inline void getcpuid(int info_type, int info[4]) { 37 static inline void getcpuid(int info_type, int info[4]) {
37 #if defined(_WIN64) 38 #if defined(_WIN64)
38 __cpuid(info, info_type); 39 __cpuid(info, info_type);
39 #else 40 #else
40 __asm { 41 __asm {
41 mov eax, [info_type] 42 mov eax, [info_type]
42 cpuid 43 cpuid
43 mov edi, [info] 44 mov edi, [info]
44 mov [edi], eax 45 mov [edi], eax
45 mov [edi+4], ebx 46 mov [edi+4], ebx
46 mov [edi+8], ecx 47 mov [edi+8], ecx
47 mov [edi+12], edx 48 mov [edi+12], edx
48 } 49 }
49 #endif 50 #endif
50 } 51 }
51 #else 52 #elif defined(__x86_64__)
52 #if defined(__x86_64__)
53 static inline void getcpuid(int info_type, int info[4]) { 53 static inline void getcpuid(int info_type, int info[4]) {
54 asm volatile ( 54 asm volatile (
55 "cpuid \n\t" 55 "cpuid \n\t"
56 : "=a"(info[0]), "=b"(info[1]), "=c"(info[2]), "=d"(info[3]) 56 : "=a"(info[0]), "=b"(info[1]), "=c"(info[2]), "=d"(info[3])
57 : "a"(info_type) 57 : "a"(info_type)
58 ); 58 );
59 } 59 }
60 #else 60 #else
61 static inline void getcpuid(int info_type, int info[4]) { 61 static inline void getcpuid(int info_type, int info[4]) {
62 // We save and restore ebx, so this code can be compatible with -fPIC 62 // We save and restore ebx, so this code can be compatible with -fPIC
63 asm volatile ( 63 asm volatile (
64 "pushl %%ebx \n\t" 64 "pushl %%ebx \n\t"
65 "cpuid \n\t" 65 "cpuid \n\t"
66 "movl %%ebx, %1 \n\t" 66 "movl %%ebx, %1 \n\t"
67 "popl %%ebx \n\t" 67 "popl %%ebx \n\t"
68 : "=a"(info[0]), "=r"(info[1]), "=c"(info[2]), "=d"(info[3]) 68 : "=a"(info[0]), "=r"(info[1]), "=c"(info[2]), "=d"(info[3])
69 : "a"(info_type) 69 : "a"(info_type)
70 ); 70 );
71 } 71 }
72 #endif 72 #endif
73 #endif
74 73
75 //////////////////////////////////////////////////////////////////////////////// 74 ////////////////////////////////////////////////////////////////////////////////
76 75
77 #if defined(__x86_64__) || defined(_WIN64) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEV EL_SSE2 76 /* Fetch the SIMD level directly from the CPU, at run-time.
78 /* All x86_64 machines have SSE2, or we know it's supported at compile time, so don't even bother checking. */ 77 * Only checks the levels needed by the optimizations in this file.
79 static inline bool hasSSE2() { 78 */
80 return true; 79 static int get_SIMD_level() {
81 } 80 int cpu_info[4] = { 0 };
82 #else
83 81
84 static inline bool hasSSE2() {
85 int cpu_info[4] = { 0 };
86 getcpuid(1, cpu_info); 82 getcpuid(1, cpu_info);
87 return (cpu_info[3] & (1<<26)) != 0; 83 if ((cpu_info[2] & (1<<20)) != 0) {
88 } 84 return SK_CPU_SSE_LEVEL_SSE42;
89 #endif 85 } else if ((cpu_info[2] & (1<<9)) != 0) {
90 86 return SK_CPU_SSE_LEVEL_SSSE3;
91 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3 87 } else if ((cpu_info[3] & (1<<26)) != 0) {
92 /* If we know SSSE3 is supported at compile time, don't even bother checking. */ 88 return SK_CPU_SSE_LEVEL_SSE2;
93 static inline bool hasSSSE3() { 89 } else {
94 return true; 90 return 0;
95 } 91 }
96 #elif defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
97 /* For the Android framework we should always know at compile time if the device
98 * we are building for supports SSSE3. The one exception to this rule is on the
99 * emulator where we are compiled without the -msse3 option (so we have no SSSE3
100 * procs) but can be run on a host machine that supports SSSE3 instructions. So
101 * for that particular case we disable our SSSE3 options.
102 */
103 static inline bool hasSSSE3() {
104 return false;
105 }
106 #else
107
108 static inline bool hasSSSE3() {
109 int cpu_info[4] = { 0 };
110 getcpuid(1, cpu_info);
111 return (cpu_info[2] & 0x200) != 0;
112 }
113 #endif
114
115 static bool cachedHasSSE2() {
116 static bool gHasSSE2 = hasSSE2();
117 return gHasSSE2;
118 } 92 }
119 93
120 static bool cachedHasSSSE3() { 94 /* Verify that the requested SIMD level is supported in the build.
121 static bool gHasSSSE3 = hasSSSE3(); 95 * If not, check if the platform supports it.
122 return gHasSSSE3; 96 */
97 static inline bool supports_simd(int minLevel) {
98 #if defined(SK_CPU_SSE_LEVEL)
99 if (minLevel <= SK_CPU_SSE_LEVEL) {
100 return true;
101 } else
102 #endif
103 {
104 #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
105 /* For the Android framework we should always know at compile time if th e device
106 * we are building for supports SSSE3. The one exception to this rule i s on the
107 * emulator where we are compiled without the -mssse3 option (so we have no
108 * SSSE3 procs) but can be run on a host machine that supports SSSE3
109 * instructions. So for that particular case we disable our SSSE3 option s.
110 */
111 return false;
112 #else
113 static int gSIMDLevel = get_SIMD_level();
114 return (minLevel <= gSIMDLevel);
115 #endif
116 }
123 } 117 }
124 118
125 //////////////////////////////////////////////////////////////////////////////// 119 ////////////////////////////////////////////////////////////////////////////////
126 120
127 SK_CONF_DECLARE( bool, c_hqfilter_sse, "bitmap.filter.highQualitySSE", false, "U se SSE optimized version of high quality image filters"); 121 SK_CONF_DECLARE( bool, c_hqfilter_sse, "bitmap.filter.highQualitySSE", false, "U se SSE optimized version of high quality image filters");
128 122
129 void SkBitmapProcState::platformConvolutionProcs(SkConvolutionProcs* procs) { 123 void SkBitmapProcState::platformConvolutionProcs(SkConvolutionProcs* procs) {
130 if (cachedHasSSE2()) { 124 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
131 procs->fExtraHorizontalReads = 3; 125 procs->fExtraHorizontalReads = 3;
132 procs->fConvolveVertically = &convolveVertically_SSE2; 126 procs->fConvolveVertically = &convolveVertically_SSE2;
133 procs->fConvolve4RowsHorizontally = &convolve4RowsHorizontally_SSE2; 127 procs->fConvolve4RowsHorizontally = &convolve4RowsHorizontally_SSE2;
134 procs->fConvolveHorizontally = &convolveHorizontally_SSE2; 128 procs->fConvolveHorizontally = &convolveHorizontally_SSE2;
135 procs->fApplySIMDPadding = &applySIMDPadding_SSE2; 129 procs->fApplySIMDPadding = &applySIMDPadding_SSE2;
136 } 130 }
137 } 131 }
138 132
139 //////////////////////////////////////////////////////////////////////////////// 133 ////////////////////////////////////////////////////////////////////////////////
140 134
141 void SkBitmapProcState::platformProcs() { 135 void SkBitmapProcState::platformProcs() {
142 /* Every optimization in the function requires at least SSE2 */ 136 /* Every optimization in the function requires at least SSE2 */
143 if (!cachedHasSSE2()) { 137 if (!supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
144 return; 138 return;
145 } 139 }
146 140
147 /* Check fSampleProc32 */ 141 /* Check fSampleProc32 */
148 if (fSampleProc32 == S32_opaque_D32_filter_DX) { 142 if (fSampleProc32 == S32_opaque_D32_filter_DX) {
149 if (cachedHasSSSE3()) { 143 if (supports_simd(SK_CPU_SSE_LEVEL_SSSE3)) {
150 fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3; 144 fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3;
151 } else { 145 } else {
152 fSampleProc32 = S32_opaque_D32_filter_DX_SSE2; 146 fSampleProc32 = S32_opaque_D32_filter_DX_SSE2;
153 } 147 }
154 } else if (fSampleProc32 == S32_opaque_D32_filter_DXDY) { 148 } else if (fSampleProc32 == S32_opaque_D32_filter_DXDY) {
155 if (cachedHasSSSE3()) { 149 if (supports_simd(SK_CPU_SSE_LEVEL_SSSE3)) {
156 fSampleProc32 = S32_opaque_D32_filter_DXDY_SSSE3; 150 fSampleProc32 = S32_opaque_D32_filter_DXDY_SSSE3;
157 } 151 }
158 } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { 152 } else if (fSampleProc32 == S32_alpha_D32_filter_DX) {
159 if (cachedHasSSSE3()) { 153 if (supports_simd(SK_CPU_SSE_LEVEL_SSSE3)) {
160 fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3; 154 fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3;
161 } else { 155 } else {
162 fSampleProc32 = S32_alpha_D32_filter_DX_SSE2; 156 fSampleProc32 = S32_alpha_D32_filter_DX_SSE2;
163 } 157 }
164 } else if (fSampleProc32 == S32_alpha_D32_filter_DXDY) { 158 } else if (fSampleProc32 == S32_alpha_D32_filter_DXDY) {
165 if (cachedHasSSSE3()) { 159 if (supports_simd(SK_CPU_SSE_LEVEL_SSSE3)) {
166 fSampleProc32 = S32_alpha_D32_filter_DXDY_SSSE3; 160 fSampleProc32 = S32_alpha_D32_filter_DXDY_SSSE3;
167 } 161 }
168 } 162 }
169 163
170 /* Check fSampleProc16 */ 164 /* Check fSampleProc16 */
171 if (fSampleProc16 == S32_D16_filter_DX) { 165 if (fSampleProc16 == S32_D16_filter_DX) {
172 fSampleProc16 = S32_D16_filter_DX_SSE2; 166 fSampleProc16 = S32_D16_filter_DX_SSE2;
173 } 167 }
174 168
175 /* Check fMatrixProc */ 169 /* Check fMatrixProc */
(...skipping 22 matching lines...) Expand all
198 NULL, // S32_D565_Blend 192 NULL, // S32_D565_Blend
199 S32A_D565_Opaque_SSE2, // S32A_D565_Opaque 193 S32A_D565_Opaque_SSE2, // S32A_D565_Opaque
200 NULL, // S32A_D565_Blend 194 NULL, // S32A_D565_Blend
201 S32_D565_Opaque_Dither_SSE2, // S32_D565_Opaque_Dither 195 S32_D565_Opaque_Dither_SSE2, // S32_D565_Opaque_Dither
202 NULL, // S32_D565_Blend_Dither 196 NULL, // S32_D565_Blend_Dither
203 S32A_D565_Opaque_Dither_SSE2, // S32A_D565_Opaque_Dither 197 S32A_D565_Opaque_Dither_SSE2, // S32A_D565_Opaque_Dither
204 NULL, // S32A_D565_Blend_Dither 198 NULL, // S32A_D565_Blend_Dither
205 }; 199 };
206 200
207 SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) { 201 SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) {
208 if (cachedHasSSE2()) { 202 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
209 return platform_16_procs[flags]; 203 return platform_16_procs[flags];
210 } else { 204 } else {
211 return NULL; 205 return NULL;
212 } 206 }
213 } 207 }
214 208
215 static SkBlitRow::Proc32 platform_32_procs[] = { 209 static SkBlitRow::Proc32 platform_32_procs[] = {
216 NULL, // S32_Opaque, 210 NULL, // S32_Opaque,
217 S32_Blend_BlitRow32_SSE2, // S32_Blend, 211 S32_Blend_BlitRow32_SSE2, // S32_Blend,
218 S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque 212 S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque
219 S32A_Blend_BlitRow32_SSE2, // S32A_Blend, 213 S32A_Blend_BlitRow32_SSE2, // S32A_Blend,
220 }; 214 };
221 215
222 SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { 216 SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) {
223 if (cachedHasSSE2()) { 217 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
224 return platform_32_procs[flags]; 218 return platform_32_procs[flags];
225 } else { 219 } else {
226 return NULL; 220 return NULL;
227 } 221 }
228 } 222 }
229 223
230 SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { 224 SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() {
231 if (cachedHasSSE2()) { 225 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
232 return Color32_SSE2; 226 return Color32_SSE2;
233 } else { 227 } else {
234 return NULL; 228 return NULL;
235 } 229 }
236 } 230 }
237 231
238 SkBlitRow::ColorRectProc PlatformColorRectProcFactory(); // suppress warning 232 SkBlitRow::ColorRectProc PlatformColorRectProcFactory(); // suppress warning
239 233
240 SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { 234 SkBlitRow::ColorRectProc PlatformColorRectProcFactory() {
241 /* Return NULL for now, since the optimized path in ColorRect32_SSE2 is disabled . 235 /* Return NULL for now, since the optimized path in ColorRect32_SSE2 is disabled .
242 if (cachedHasSSE2()) { 236 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
243 return ColorRect32_SSE2; 237 return ColorRect32_SSE2;
244 } else { 238 } else {
245 return NULL; 239 return NULL;
246 } 240 }
247 */ 241 */
248 return NULL; 242 return NULL;
249 } 243 }
250 244
251 //////////////////////////////////////////////////////////////////////////////// 245 ////////////////////////////////////////////////////////////////////////////////
252 246
253 SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig, 247 SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig,
254 SkMask::Format maskFormat, 248 SkMask::Format maskFormat,
255 SkColor color) { 249 SkColor color) {
256 if (SkMask::kA8_Format != maskFormat) { 250 if (SkMask::kA8_Format != maskFormat) {
257 return NULL; 251 return NULL;
258 } 252 }
259 253
260 ColorProc proc = NULL; 254 ColorProc proc = NULL;
261 if (cachedHasSSE2()) { 255 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
262 switch (dstConfig) { 256 switch (dstConfig) {
263 case SkBitmap::kARGB_8888_Config: 257 case SkBitmap::kARGB_8888_Config:
264 // The SSE2 version is not (yet) faster for black, so we check 258 // The SSE2 version is not (yet) faster for black, so we check
265 // for that. 259 // for that.
266 if (SK_ColorBLACK != color) { 260 if (SK_ColorBLACK != color) {
267 proc = SkARGB32_A8_BlitMask_SSE2; 261 proc = SkARGB32_A8_BlitMask_SSE2;
268 } 262 }
269 break; 263 break;
270 default: 264 default:
271 break; 265 break;
272 } 266 }
273 } 267 }
274 return proc; 268 return proc;
275 } 269 }
276 270
277 SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) { 271 SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) {
278 if (cachedHasSSE2()) { 272 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
279 if (isOpaque) { 273 if (isOpaque) {
280 return SkBlitLCD16OpaqueRow_SSE2; 274 return SkBlitLCD16OpaqueRow_SSE2;
281 } else { 275 } else {
282 return SkBlitLCD16Row_SSE2; 276 return SkBlitLCD16Row_SSE2;
283 } 277 }
284 } else { 278 } else {
285 return NULL; 279 return NULL;
286 } 280 }
287 281
288 } 282 }
289 283
290 SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig, 284 SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig,
291 SkMask::Format maskFormat, 285 SkMask::Format maskFormat,
292 RowFlags flags) { 286 RowFlags flags) {
293 return NULL; 287 return NULL;
294 } 288 }
295 289
296 //////////////////////////////////////////////////////////////////////////////// 290 ////////////////////////////////////////////////////////////////////////////////
297 291
298 SkMemset16Proc SkMemset16GetPlatformProc() { 292 SkMemset16Proc SkMemset16GetPlatformProc() {
299 if (cachedHasSSE2()) { 293 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
300 return sk_memset16_SSE2; 294 return sk_memset16_SSE2;
301 } else { 295 } else {
302 return NULL; 296 return NULL;
303 } 297 }
304 } 298 }
305 299
306 SkMemset32Proc SkMemset32GetPlatformProc() { 300 SkMemset32Proc SkMemset32GetPlatformProc() {
307 if (cachedHasSSE2()) { 301 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
308 return sk_memset32_SSE2; 302 return sk_memset32_SSE2;
309 } else { 303 } else {
310 return NULL; 304 return NULL;
311 } 305 }
312 } 306 }
313 307
314 //////////////////////////////////////////////////////////////////////////////// 308 ////////////////////////////////////////////////////////////////////////////////
315 309
316 SkMorphologyImageFilter::Proc SkMorphologyGetPlatformProc(SkMorphologyProcType t ype) { 310 SkMorphologyImageFilter::Proc SkMorphologyGetPlatformProc(SkMorphologyProcType t ype) {
317 if (!cachedHasSSE2()) { 311 if (!supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
318 return NULL; 312 return NULL;
319 } 313 }
320 switch (type) { 314 switch (type) {
321 case kDilateX_SkMorphologyProcType: 315 case kDilateX_SkMorphologyProcType:
322 return SkDilateX_SSE2; 316 return SkDilateX_SSE2;
323 case kDilateY_SkMorphologyProcType: 317 case kDilateY_SkMorphologyProcType:
324 return SkDilateY_SSE2; 318 return SkDilateY_SSE2;
325 case kErodeX_SkMorphologyProcType: 319 case kErodeX_SkMorphologyProcType:
326 return SkErodeX_SSE2; 320 return SkErodeX_SSE2;
327 case kErodeY_SkMorphologyProcType: 321 case kErodeY_SkMorphologyProcType:
328 return SkErodeY_SSE2; 322 return SkErodeY_SSE2;
329 default: 323 default:
330 return NULL; 324 return NULL;
331 } 325 }
332 } 326 }
333 327
334 //////////////////////////////////////////////////////////////////////////////// 328 ////////////////////////////////////////////////////////////////////////////////
335 329
336 bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX, 330 bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX,
337 SkBoxBlurProc* boxBlurY, 331 SkBoxBlurProc* boxBlurY,
338 SkBoxBlurProc* boxBlurXY, 332 SkBoxBlurProc* boxBlurXY,
339 SkBoxBlurProc* boxBlurYX) { 333 SkBoxBlurProc* boxBlurYX) {
340 #ifdef SK_DISABLE_BLUR_DIVISION_OPTIMIZATION 334 #ifdef SK_DISABLE_BLUR_DIVISION_OPTIMIZATION
341 return false; 335 return false;
342 #else 336 #else
343 if (!cachedHasSSE2()) { 337 if (!supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
344 return false; 338 return false;
345 } 339 }
346 return SkBoxBlurGetPlatformProcs_SSE2(boxBlurX, boxBlurY, boxBlurXY, boxBlur YX); 340 return SkBoxBlurGetPlatformProcs_SSE2(boxBlurX, boxBlurY, boxBlurXY, boxBlur YX);
347 #endif 341 #endif
348 } 342 }
349 343
350 //////////////////////////////////////////////////////////////////////////////// 344 ////////////////////////////////////////////////////////////////////////////////
351 345
352 extern SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl_SSE2(const ProcCoeff& rec, 346 extern SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl_SSE2(const ProcCoeff& rec,
353 SkXfermode::Mode mode); 347 SkXfermode::Mode mode);
354 348
355 SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl(const ProcCoeff& rec, 349 SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl(const ProcCoeff& rec,
356 SkXfermode::Mode mode); 350 SkXfermode::Mode mode);
357 351
358 SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl(const ProcCoeff& rec, 352 SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl(const ProcCoeff& rec,
359 SkXfermode::Mode mode) { 353 SkXfermode::Mode mode) {
360 return NULL; 354 return NULL;
361 } 355 }
362 356
363 SkProcCoeffXfermode* SkPlatformXfermodeFactory(const ProcCoeff& rec, 357 SkProcCoeffXfermode* SkPlatformXfermodeFactory(const ProcCoeff& rec,
364 SkXfermode::Mode mode); 358 SkXfermode::Mode mode);
365 359
366 SkProcCoeffXfermode* SkPlatformXfermodeFactory(const ProcCoeff& rec, 360 SkProcCoeffXfermode* SkPlatformXfermodeFactory(const ProcCoeff& rec,
367 SkXfermode::Mode mode) { 361 SkXfermode::Mode mode) {
368 if (cachedHasSSE2()) { 362 if (supports_simd(SK_CPU_SSE_LEVEL_SSE2)) {
369 return SkPlatformXfermodeFactory_impl_SSE2(rec, mode); 363 return SkPlatformXfermodeFactory_impl_SSE2(rec, mode);
370 } else { 364 } else {
371 return SkPlatformXfermodeFactory_impl(rec, mode); 365 return SkPlatformXfermodeFactory_impl(rec, mode);
372 } 366 }
373 } 367 }
374 368
375 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode); 369 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode);
376 370
377 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode) { 371 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode) {
378 return NULL; 372 return NULL;
379 } 373 }
OLDNEW
« no previous file with comments | « include/core/SkPreConfig.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698