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

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

Issue 1299013003: Update SkOpts namespaces. (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 | « no previous file | 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
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 portable 11 #define SK_OPTS_NS sk_default
12 #include "SkBlitMask_opts.h" 12 #include "SkBlitMask_opts.h"
13 #include "SkBlurImageFilter_opts.h" 13 #include "SkBlurImageFilter_opts.h"
14 #include "SkColorCubeFilter_opts.h" 14 #include "SkColorCubeFilter_opts.h"
15 #include "SkFloatingPoint_opts.h" 15 #include "SkFloatingPoint_opts.h"
16 #include "SkMorphologyImageFilter_opts.h" 16 #include "SkMorphologyImageFilter_opts.h"
17 #include "SkTextureCompressor_opts.h" 17 #include "SkTextureCompressor_opts.h"
18 #include "SkUtils_opts.h" 18 #include "SkUtils_opts.h"
19 #include "SkXfermode_opts.h" 19 #include "SkXfermode_opts.h"
20 20
21 #if defined(SK_CPU_X86) 21 #if defined(SK_CPU_X86)
22 #if defined(SK_BUILD_FOR_WIN32) 22 #if defined(SK_BUILD_FOR_WIN32)
23 #include <intrin.h> 23 #include <intrin.h>
24 static void cpuid(uint32_t abcd[4]) { __cpuid((int*)abcd, 1); } 24 static void cpuid(uint32_t abcd[4]) { __cpuid((int*)abcd, 1); }
25 #else 25 #else
26 #include <cpuid.h> 26 #include <cpuid.h>
27 static void cpuid(uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abc d+2, abcd+3); } 27 static void cpuid(uint32_t abcd[4]) { __get_cpuid(1, abcd+0, abcd+1, abc d+2, abcd+3); }
28 #endif 28 #endif
29 #elif !defined(SK_ARM_HAS_NEON) && defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR _ANDROID) 29 #elif !defined(SK_ARM_HAS_NEON) && defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR _ANDROID)
30 #include <cpu-features.h> 30 #include <cpu-features.h>
31 #endif 31 #endif
32 32
33 namespace SkOpts { 33 namespace SkOpts {
34 // Define default function pointer values here... 34 // Define default function pointer values here...
35 // If our global compile options are set high enough, these 'portable' defau lts might 35 // If our global compile options are set high enough, these defaults might e ven be
36 // even be CPU-specialized, e.g. a typical x86-64 machine might start with S SE2 defaults. 36 // CPU-specialized, e.g. a typical x86-64 machine might start with SSE2 defa ults.
37 // They'll still get a chance to be replaced with even better ones, e.g. usi ng SSE4.1. 37 // They'll still get a chance to be replaced with even better ones, e.g. usi ng SSE4.1.
38 decltype(rsqrt) rsqrt = portable::rsqrt; 38 decltype(rsqrt) rsqrt = sk_default::rsqrt;
39 decltype(memset16) memset16 = portable::memset16; 39 decltype(memset16) memset16 = sk_default::memset16;
40 decltype(memset32) memset32 = portable::memset32; 40 decltype(memset32) memset32 = sk_default::memset32;
41 decltype(create_xfermode) create_xfermode = SkCreate4pxXfermode; 41 decltype(create_xfermode) create_xfermode = SkCreate4pxXfermode;
42 decltype(color_cube_filter_span) color_cube_filter_span = portable::color_cu be_filter_span; 42 decltype(color_cube_filter_span) color_cube_filter_span = sk_default::color_ cube_filter_span;
43 43
44 decltype(box_blur_xx) box_blur_xx = portable::box_blur_xx; 44 decltype(box_blur_xx) box_blur_xx = sk_default::box_blur_xx;
45 decltype(box_blur_xy) box_blur_xy = portable::box_blur_xy; 45 decltype(box_blur_xy) box_blur_xy = sk_default::box_blur_xy;
46 decltype(box_blur_yx) box_blur_yx = portable::box_blur_yx; 46 decltype(box_blur_yx) box_blur_yx = sk_default::box_blur_yx;
47 47
48 decltype(dilate_x) dilate_x = portable::dilate_x; 48 decltype(dilate_x) dilate_x = sk_default::dilate_x;
49 decltype(dilate_y) dilate_y = portable::dilate_y; 49 decltype(dilate_y) dilate_y = sk_default::dilate_y;
50 decltype( erode_x) erode_x = portable::erode_x; 50 decltype( erode_x) erode_x = sk_default::erode_x;
51 decltype( erode_y) erode_y = portable::erode_y; 51 decltype( erode_y) erode_y = sk_default::erode_y;
52 52
53 decltype(texture_compressor) texture_compressor = portable::texture_co mpressor; 53 decltype(texture_compressor) texture_compressor = sk_default::texture_ compressor;
54 decltype(fill_block_dimensions) fill_block_dimensions = portable::fill_block _dimensions; 54 decltype(fill_block_dimensions) fill_block_dimensions = sk_default::fill_blo ck_dimensions;
55 55
56 decltype(blit_mask_d32_a8) blit_mask_d32_a8 = portable::blit_mask_d32_a8; 56 decltype(blit_mask_d32_a8) blit_mask_d32_a8 = sk_default::blit_mask_d32_a8;
57 57
58 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. 58 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp.
59 void Init_ssse3(); 59 void Init_ssse3();
60 void Init_sse41(); 60 void Init_sse41();
61 void Init_neon(); 61 void Init_neon();
62 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ? 62 //TODO: _dsp2, _armv7, _armv8, _x86, _x86_64, _sse42, _avx, avx2, ... ?
63 63
64 static void init() { 64 static void init() {
65 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o r feature? 65 // 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) 66 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
67 uint32_t abcd[] = {0,0,0,0}; 67 uint32_t abcd[] = {0,0,0,0};
68 cpuid(abcd); 68 cpuid(abcd);
69 if (abcd[2] & (1<< 9)) { Init_ssse3(); } 69 if (abcd[2] & (1<< 9)) { Init_ssse3(); }
70 if (abcd[2] & (1<<19)) { Init_sse41(); } 70 if (abcd[2] & (1<<19)) { Init_sse41(); }
71 #elif !defined(SK_ARM_HAS_NEON) && defined(SK_CPU_ARM32) && defined(SK_BUILD _FOR_ANDROID) 71 #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 (); } 72 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon (); }
73 #endif 73 #endif
74 } 74 }
75 75
76 SK_DECLARE_STATIC_ONCE(gInitOnce); 76 SK_DECLARE_STATIC_ONCE(gInitOnce);
77 void Init() { SkOnce(&gInitOnce, init); } 77 void Init() { SkOnce(&gInitOnce, init); }
78 78
79 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 79 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
80 static struct AutoInit { 80 static struct AutoInit {
81 AutoInit() { Init(); } 81 AutoInit() { Init(); }
82 } gAutoInit; 82 } gAutoInit;
83 #endif 83 #endif
84 } 84 }
OLDNEW
« no previous file with comments | « no previous file | src/opts/SkOpts_neon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698