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

Side by Side Diff: src/core/SkOpts.cpp

Issue 1261743002: Revert of Lay groundwork for SkOpts. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « src/core/SkOpts.h ('k') | src/opts/SkOpts_neon.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkOpts.h"
9
10 #if defined(SK_CPU_X86)
11 #if defined(SK_BUILD_FOR_WIN32)
12 #include <intrin.h>
13 static void cpuid(uint32_t abcd[4]) { __cpuid((int*)abcd, 1); }
14 #else
15 #include <cpuid.h>
16 static void cpuid(uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abc d+2, abcd+3); }
17 #endif
18 #elif defined(SK_BUILD_FOR_ANDROID)
19 #include <cpu-features.h>
20 #endif
21
22 namespace SkOpts {
23 // (Define default function pointer values here...)
24
25 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp.
26 void Init_sse2();
27 void Init_ssse3();
28 void Init_sse41();
29 void Init_neon();
30 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ?
31
32 void Init() {
33 #if defined(SK_CPU_X86)
34 uint32_t abcd[] = {0,0,0,0};
35 cpuid(abcd);
36 if (abcd[3] & (1<<26)) { Init_sse2(); }
37 if (abcd[2] & (1<< 9)) { Init_ssse3(); }
38 if (abcd[2] & (1<<19)) { Init_sse41(); }
39
40 #elif defined(SK_ARM_HAS_NEON)
41 Init_neon();
42
43 #elif defined(SK_BUILD_FOR_ANDROID)
44 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon (); }
45
46 #endif
47 }
48 }
OLDNEW
« no previous file with comments | « src/core/SkOpts.h ('k') | src/opts/SkOpts_neon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698