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

Side by Side Diff: src/core/SkCpu.h

Issue 2138073002: Clean up hyper-local SkCpu feature test experiment. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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/core/SkCpu.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 2016 Google Inc. 2 * Copyright 2016 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 #ifndef SkCpu_DEFINED 8 #ifndef SkCpu_DEFINED
9 #define SkCpu_DEFINED 9 #define SkCpu_DEFINED
10 10
(...skipping 14 matching lines...) Expand all
25 }; 25 };
26 enum { 26 enum {
27 NEON = 1 << 0, 27 NEON = 1 << 0,
28 NEON_FMA = 1 << 1, 28 NEON_FMA = 1 << 1,
29 VFP_FP16 = 1 << 2, 29 VFP_FP16 = 1 << 2,
30 }; 30 };
31 31
32 static void CacheRuntimeFeatures(); 32 static void CacheRuntimeFeatures();
33 static bool Supports(uint32_t); 33 static bool Supports(uint32_t);
34 private: 34 private:
35 #if defined(_MSC_VER) || !defined(SkCpu_IMPL) 35 static uint32_t gCachedFeatures;
36 static const uint32_t gCachedFeatures;
37 #else
38 static uint32_t gCachedFeatures;
39 #endif
40 }; 36 };
41 37
42 inline bool SkCpu::Supports(uint32_t mask) { 38 inline bool SkCpu::Supports(uint32_t mask) {
43 uint32_t features = gCachedFeatures; 39 uint32_t features = gCachedFeatures;
44 40
45 // If we mask in compile-time known lower limits, the compiler can 41 // If we mask in compile-time known lower limits, the compiler can
46 // often compile away this entire function. 42 // often compile away this entire function.
47 #if SK_CPU_X86 43 #if SK_CPU_X86
48 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE1 44 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE1
49 features |= SSE1; 45 features |= SSE1;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 77
82 #if defined(SK_CPU_ARM64) 78 #if defined(SK_CPU_ARM64)
83 features |= NEON|NEON_FMA|VFP_FP16; 79 features |= NEON|NEON_FMA|VFP_FP16;
84 #endif 80 #endif
85 81
86 #endif 82 #endif
87 return (features & mask) == mask; 83 return (features & mask) == mask;
88 } 84 }
89 85
90 #endif//SkCpu_DEFINED 86 #endif//SkCpu_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/SkCpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698