diff options
-rw-r--r-- | bench/SkBlend_optsBench.cpp | 2 | ||||
-rw-r--r-- | experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig | 2 | ||||
-rw-r--r-- | experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig | 2 | ||||
-rwxr-xr-x | experimental/iOSSampleApp/iOSSampleApp.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | gyp/common_conditions.gypi | 5 | ||||
-rw-r--r-- | include/core/SkPreConfig.h | 14 | ||||
-rw-r--r-- | public.bzl | 1 | ||||
-rw-r--r-- | src/core/SkOpts.cpp | 3 | ||||
-rw-r--r-- | tests/SkBlend_optsTest.cpp | 4 |
9 files changed, 22 insertions, 13 deletions
diff --git a/bench/SkBlend_optsBench.cpp b/bench/SkBlend_optsBench.cpp index 08c3d7fd4b..29f3ed8331 100644 --- a/bench/SkBlend_optsBench.cpp +++ b/bench/SkBlend_optsBench.cpp @@ -151,7 +151,7 @@ private: typedef Benchmark INHERITED; }; -#if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) +#if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS) #define BENCHES(fileName) \ DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsBruteForce>(fileName); ) \ DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsTrivial>(fileName); ) \ diff --git a/experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig b/experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig index eafd949235..3833c6f2e1 100644 --- a/experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig +++ b/experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig @@ -9,5 +9,5 @@ // #include "SkiOSSampleApp-Base" -GCC_PREPROCESSOR_DEFINITIONS=SK_DEBUG SK_BUILD_FOR_IOS +GCC_PREPROCESSOR_DEFINITIONS=SK_DEBUG SK_BUILD_FOR_IOS SK_BUILD_NO_OPTS GCC_OPTIMIZATION_LEVEL=0 diff --git a/experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig b/experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig index 1720318823..711e0e64ba 100644 --- a/experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig +++ b/experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig @@ -8,5 +8,5 @@ // found in the LICENSE file. // #include "SkiOSSampleApp-Base" -GCC_PREPROCESSOR_DEFINITIONS=SK_RELEASE SK_BUILD_FOR_IOS +GCC_PREPROCESSOR_DEFINITIONS=SK_RELEASE SK_BUILD_FOR_IOS SK_BUILD_NO_OPTS GCC_OPTIMIZATION_LEVEL=s diff --git a/experimental/iOSSampleApp/iOSSampleApp.xcodeproj/project.pbxproj b/experimental/iOSSampleApp/iOSSampleApp.xcodeproj/project.pbxproj index b0016f8ad9..bbb84822d3 100755 --- a/experimental/iOSSampleApp/iOSSampleApp.xcodeproj/project.pbxproj +++ b/experimental/iOSSampleApp/iOSSampleApp.xcodeproj/project.pbxproj @@ -3428,6 +3428,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( SK_BUILD_FOR_IOS, + SK_BUILD_NO_OPTS, SK_DEBUG, ); GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -3449,6 +3450,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( SK_RELEASE, SK_BUILD_FOR_IOS, + SK_BUILD_NO_OPTS, ); GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = NO; diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi index 21f4c92398..4f387e9883 100644 --- a/gyp/common_conditions.gypi +++ b/gyp/common_conditions.gypi @@ -562,7 +562,12 @@ [ 'skia_os == "ios"', { 'defines': [ + # When targetting iOS and using gyp to generate the build files, it is + # not possible to select files to build depending on the architecture + # (i.e. it is not possible to use hand optimized assembly version). In + # that configuration, disable all optimisation. 'SK_BUILD_FOR_IOS', + 'SK_BUILD_NO_OPTS', ], 'conditions' : [ [ 'skia_warnings_as_errors', { diff --git a/include/core/SkPreConfig.h b/include/core/SkPreConfig.h index b9b46c073a..928c1bda63 100644 --- a/include/core/SkPreConfig.h +++ b/include/core/SkPreConfig.h @@ -118,8 +118,12 @@ #define SK_CPU_SSE_LEVEL_AVX 51 #define SK_CPU_SSE_LEVEL_AVX2 52 -#ifdef SK_BUILD_FOR_IOS - #define SK_CPU_SSE_LEVEL 0 // We're tired of fighting with opts/ and iOS simulator. +// When targetting iOS and using gyp to generate the build files, it is not +// possible to select files to build depending on the architecture (i.e. it +// is not possible to use hand optimized assembly implementation). In that +// configuration SK_BUILD_NO_OPTS is defined. Remove optimisation then. +#ifdef SK_BUILD_NO_OPTS + #define SK_CPU_SSE_LEVEL 0 #endif // Are we in GCC? @@ -190,14 +194,12 @@ #endif #endif -// Disable ARM64 optimizations for iOS due to complications regarding gyp and iOS. -#if defined(__aarch64__) && !defined(SK_BUILD_FOR_IOS) +#if defined(__aarch64__) && !defined(SK_BUILD_NO_OPTS) #define SK_CPU_ARM64 #endif // All 64-bit ARM chips have NEON. Many 32-bit ARM chips do too. -// TODO: Why don't we want NEON on iOS? -#if !defined(SK_ARM_HAS_NEON) && !defined(SK_BUILD_FOR_IOS) && (defined(__ARM_NEON__) || defined(__ARM_NEON)) +#if !defined(SK_ARM_HAS_NEON) && !defined(SK_BUILD_NO_OPTS) && (defined(__ARM_NEON__) || defined(__ARM_NEON)) #define SK_ARM_HAS_NEON #endif diff --git a/public.bzl b/public.bzl index 4cd21454d5..f84abc0e6c 100644 --- a/public.bzl +++ b/public.bzl @@ -569,6 +569,7 @@ DEFINES_ANDROID = [ DEFINES_IOS = [ "SK_BUILD_FOR_IOS", + "SK_BUILD_NO_OPTS", "SK_IGNORE_ETC1_SUPPORT", "SKNX_NO_SIMD", ] diff --git a/src/core/SkOpts.cpp b/src/core/SkOpts.cpp index c6ff43b532..6d3e6c9fea 100644 --- a/src/core/SkOpts.cpp +++ b/src/core/SkOpts.cpp @@ -84,8 +84,7 @@ namespace SkOpts { void Init_avx2() {} static void init() { - // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug or feature? - #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) + #if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS) if (SkCpu::Supports(SkCpu::SSSE3)) { Init_ssse3(); } if (SkCpu::Supports(SkCpu::SSE41)) { Init_sse41(); } if (SkCpu::Supports(SkCpu::SSE42)) { Init_sse42(); } diff --git a/tests/SkBlend_optsTest.cpp b/tests/SkBlend_optsTest.cpp index 06b7c1ade2..9142f9d7a1 100644 --- a/tests/SkBlend_optsTest.cpp +++ b/tests/SkBlend_optsTest.cpp @@ -35,7 +35,7 @@ extern void srcover_srgb_srgb( uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); } -#if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) +#if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS) namespace sk_sse41 { extern void srcover_srgb_srgb( uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); @@ -104,7 +104,7 @@ DEF_TEST(SkBlend_optsCheck, reporter) { Spec{sk_default::best_non_simd_srcover_srgb_srgb, "best_non_simd"}, Spec{sk_default::srcover_srgb_srgb, "default"}, }; - #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) + #if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS) if (SkCpu::Supports(SkCpu::SSE41)) { specs.push_back(Spec{sk_sse41::srcover_srgb_srgb, "sse41", }); } |