senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 8 | #include "SkBitmapProcState_opts_SSE2.h" |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 9 | #include "SkBitmapProcState_opts_SSSE3.h" |
humper@google.com | b088947 | 2013-07-09 21:37:14 +0000 | [diff] [blame] | 10 | #include "SkBitmapFilter_opts_SSE2.h" |
reed@google.com | 58af9a6 | 2011-10-12 13:43:52 +0000 | [diff] [blame] | 11 | #include "SkBlitMask.h" |
tomhudson@google.com | 8dd90a9 | 2012-03-19 13:49:50 +0000 | [diff] [blame] | 12 | #include "SkBlitRow.h" |
| 13 | #include "SkBlitRect_opts_SSE2.h" |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 14 | #include "SkBlitRow_opts_SSE2.h" |
senorblanco@chromium.org | 27eec46 | 2013-11-08 20:49:04 +0000 | [diff] [blame] | 15 | #include "SkBlurImage_opts_SSE2.h" |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 16 | #include "SkUtils_opts_SSE2.h" |
| 17 | #include "SkUtils.h" |
senorblanco@chromium.org | 7a47ad3 | 2013-10-30 21:57:04 +0000 | [diff] [blame] | 18 | #include "SkMorphology_opts.h" |
| 19 | #include "SkMorphology_opts_SSE2.h" |
commit-bot@chromium.org | c524e98 | 2014-04-09 15:43:46 +0000 | [diff] [blame^] | 20 | #include "SkXfermode.h" |
| 21 | #include "SkXfermode_proccoeff.h" |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 22 | |
humper@google.com | b088947 | 2013-07-09 21:37:14 +0000 | [diff] [blame] | 23 | #include "SkRTConf.h" |
| 24 | |
tomhudson@google.com | ea85494 | 2012-05-17 15:09:17 +0000 | [diff] [blame] | 25 | #if defined(_MSC_VER) && defined(_WIN64) |
| 26 | #include <intrin.h> |
| 27 | #endif |
| 28 | |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 29 | /* This file must *not* be compiled with -msse or -msse2, otherwise |
| 30 | gcc may generate sse2 even for scalar ops (and thus give an invalid |
| 31 | instruction on Pentium3 on the code below). Only files named *_SSE2.cpp |
| 32 | in this directory should be compiled with -msse2. */ |
| 33 | |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 34 | |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 35 | #ifdef _MSC_VER |
| 36 | static inline void getcpuid(int info_type, int info[4]) { |
tomhudson@google.com | ea85494 | 2012-05-17 15:09:17 +0000 | [diff] [blame] | 37 | #if defined(_WIN64) |
| 38 | __cpuid(info, info_type); |
| 39 | #else |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 40 | __asm { |
| 41 | mov eax, [info_type] |
| 42 | cpuid |
| 43 | mov edi, [info] |
| 44 | mov [edi], eax |
| 45 | mov [edi+4], ebx |
| 46 | mov [edi+8], ecx |
| 47 | mov [edi+12], edx |
| 48 | } |
tomhudson@google.com | ea85494 | 2012-05-17 15:09:17 +0000 | [diff] [blame] | 49 | #endif |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 50 | } |
| 51 | #else |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 52 | #if defined(__x86_64__) |
| 53 | static inline void getcpuid(int info_type, int info[4]) { |
| 54 | asm volatile ( |
| 55 | "cpuid \n\t" |
| 56 | : "=a"(info[0]), "=b"(info[1]), "=c"(info[2]), "=d"(info[3]) |
| 57 | : "a"(info_type) |
| 58 | ); |
| 59 | } |
| 60 | #else |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 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 |
| 63 | asm volatile ( |
| 64 | "pushl %%ebx \n\t" |
| 65 | "cpuid \n\t" |
| 66 | "movl %%ebx, %1 \n\t" |
| 67 | "popl %%ebx \n\t" |
| 68 | : "=a"(info[0]), "=r"(info[1]), "=c"(info[2]), "=d"(info[3]) |
| 69 | : "a"(info_type) |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 70 | ); |
| 71 | } |
| 72 | #endif |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 73 | #endif |
| 74 | |
reed@google.com | 70d1be5 | 2012-07-16 16:07:42 +0000 | [diff] [blame] | 75 | #if defined(__x86_64__) || defined(_WIN64) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 76 | /* All x86_64 machines have SSE2, or we know it's supported at compile time, so don't even bother checking. */ |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 77 | static inline bool hasSSE2() { |
| 78 | return true; |
| 79 | } |
| 80 | #else |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 81 | |
| 82 | static inline bool hasSSE2() { |
| 83 | int cpu_info[4] = { 0 }; |
| 84 | getcpuid(1, cpu_info); |
| 85 | return (cpu_info[3] & (1<<26)) != 0; |
| 86 | } |
| 87 | #endif |
| 88 | |
reed@google.com | 70d1be5 | 2012-07-16 16:07:42 +0000 | [diff] [blame] | 89 | #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3 |
| 90 | /* If we know SSSE3 is supported at compile time, don't even bother checking. */ |
| 91 | static inline bool hasSSSE3() { |
| 92 | return true; |
| 93 | } |
| 94 | #else |
| 95 | |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 96 | static inline bool hasSSSE3() { |
| 97 | int cpu_info[4] = { 0 }; |
| 98 | getcpuid(1, cpu_info); |
| 99 | return (cpu_info[2] & 0x200) != 0; |
| 100 | } |
reed@google.com | 70d1be5 | 2012-07-16 16:07:42 +0000 | [diff] [blame] | 101 | #endif |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 102 | |
reed@google.com | edb606c | 2011-10-18 13:56:50 +0000 | [diff] [blame] | 103 | static bool cachedHasSSE2() { |
| 104 | static bool gHasSSE2 = hasSSE2(); |
| 105 | return gHasSSE2; |
| 106 | } |
| 107 | |
tomhudson@google.com | 95ad155 | 2012-02-14 18:28:54 +0000 | [diff] [blame] | 108 | static bool cachedHasSSSE3() { |
| 109 | static bool gHasSSSE3 = hasSSSE3(); |
| 110 | return gHasSSSE3; |
| 111 | } |
| 112 | |
humper@google.com | b088947 | 2013-07-09 21:37:14 +0000 | [diff] [blame] | 113 | SK_CONF_DECLARE( bool, c_hqfilter_sse, "bitmap.filter.highQualitySSE", false, "Use SSE optimized version of high quality image filters"); |
| 114 | |
reed@google.com | fed04b3 | 2013-09-05 20:31:17 +0000 | [diff] [blame] | 115 | void SkBitmapProcState::platformConvolutionProcs(SkConvolutionProcs* procs) { |
humper@google.com | 138ebc3 | 2013-07-19 20:20:04 +0000 | [diff] [blame] | 116 | if (cachedHasSSE2()) { |
reed@google.com | fed04b3 | 2013-09-05 20:31:17 +0000 | [diff] [blame] | 117 | procs->fExtraHorizontalReads = 3; |
| 118 | procs->fConvolveVertically = &convolveVertically_SSE2; |
| 119 | procs->fConvolve4RowsHorizontally = &convolve4RowsHorizontally_SSE2; |
| 120 | procs->fConvolveHorizontally = &convolveHorizontally_SSE2; |
| 121 | procs->fApplySIMDPadding = &applySIMDPadding_SSE2; |
humper@google.com | 138ebc3 | 2013-07-19 20:20:04 +0000 | [diff] [blame] | 122 | } |
| 123 | } |
| 124 | |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 125 | void SkBitmapProcState::platformProcs() { |
tomhudson@google.com | 06a7313 | 2012-02-22 18:30:43 +0000 | [diff] [blame] | 126 | if (cachedHasSSSE3()) { |
| 127 | if (fSampleProc32 == S32_opaque_D32_filter_DX) { |
| 128 | fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3; |
| 129 | } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { |
| 130 | fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3; |
| 131 | } |
tomhudson@google.com | ae29b88 | 2012-03-06 14:59:04 +0000 | [diff] [blame] | 132 | |
| 133 | if (fSampleProc32 == S32_opaque_D32_filter_DXDY) { |
| 134 | fSampleProc32 = S32_opaque_D32_filter_DXDY_SSSE3; |
| 135 | } else if (fSampleProc32 == S32_alpha_D32_filter_DXDY) { |
| 136 | fSampleProc32 = S32_alpha_D32_filter_DXDY_SSSE3; |
| 137 | } |
tomhudson@google.com | 06a7313 | 2012-02-22 18:30:43 +0000 | [diff] [blame] | 138 | } else if (cachedHasSSE2()) { |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 139 | if (fSampleProc32 == S32_opaque_D32_filter_DX) { |
| 140 | fSampleProc32 = S32_opaque_D32_filter_DX_SSE2; |
senorblanco@chromium.org | f3f0bd7 | 2009-12-10 22:46:31 +0000 | [diff] [blame] | 141 | } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { |
| 142 | fSampleProc32 = S32_alpha_D32_filter_DX_SSE2; |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 143 | } |
reed@google.com | 7866228 | 2012-07-24 13:53:23 +0000 | [diff] [blame] | 144 | |
| 145 | if (fSampleProc16 == S32_D16_filter_DX) { |
| 146 | fSampleProc16 = S32_D16_filter_DX_SSE2; |
| 147 | } |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 148 | } |
tomhudson@google.com | 06a7313 | 2012-02-22 18:30:43 +0000 | [diff] [blame] | 149 | |
| 150 | if (cachedHasSSSE3() || cachedHasSSE2()) { |
| 151 | if (fMatrixProc == ClampX_ClampY_filter_scale) { |
| 152 | fMatrixProc = ClampX_ClampY_filter_scale_SSE2; |
| 153 | } else if (fMatrixProc == ClampX_ClampY_nofilter_scale) { |
| 154 | fMatrixProc = ClampX_ClampY_nofilter_scale_SSE2; |
| 155 | } |
tomhudson@google.com | 5efaf26 | 2012-02-28 15:41:49 +0000 | [diff] [blame] | 156 | |
| 157 | if (fMatrixProc == ClampX_ClampY_filter_affine) { |
| 158 | fMatrixProc = ClampX_ClampY_filter_affine_SSE2; |
| 159 | } else if (fMatrixProc == ClampX_ClampY_nofilter_affine) { |
| 160 | fMatrixProc = ClampX_ClampY_nofilter_affine_SSE2; |
| 161 | } |
humper@google.com | b088947 | 2013-07-09 21:37:14 +0000 | [diff] [blame] | 162 | if (c_hqfilter_sse) { |
mtklein@google.com | 0dc546c | 2013-08-26 16:21:35 +0000 | [diff] [blame] | 163 | if (fShaderProc32 == highQualityFilter32) { |
humper@google.com | b088947 | 2013-07-09 21:37:14 +0000 | [diff] [blame] | 164 | fShaderProc32 = highQualityFilter_SSE2; |
| 165 | } |
humper@google.com | b088947 | 2013-07-09 21:37:14 +0000 | [diff] [blame] | 166 | } |
tomhudson@google.com | 06a7313 | 2012-02-22 18:30:43 +0000 | [diff] [blame] | 167 | } |
senorblanco@chromium.org | dc7de74 | 2009-11-30 20:00:29 +0000 | [diff] [blame] | 168 | } |
| 169 | |
commit-bot@chromium.org | 4759107 | 2014-02-19 03:09:52 +0000 | [diff] [blame] | 170 | static SkBlitRow::Proc platform_16_procs[] = { |
commit-bot@chromium.org | 39ce33a | 2014-02-24 04:23:39 +0000 | [diff] [blame] | 171 | S32_D565_Opaque_SSE2, // S32_D565_Opaque |
commit-bot@chromium.org | 4759107 | 2014-02-19 03:09:52 +0000 | [diff] [blame] | 172 | NULL, // S32_D565_Blend |
| 173 | S32A_D565_Opaque_SSE2, // S32A_D565_Opaque |
| 174 | NULL, // S32A_D565_Blend |
commit-bot@chromium.org | 2758047 | 2014-03-07 03:25:32 +0000 | [diff] [blame] | 175 | S32_D565_Opaque_Dither_SSE2, // S32_D565_Opaque_Dither |
commit-bot@chromium.org | 4759107 | 2014-02-19 03:09:52 +0000 | [diff] [blame] | 176 | NULL, // S32_D565_Blend_Dither |
commit-bot@chromium.org | fe089b3 | 2014-03-07 13:24:42 +0000 | [diff] [blame] | 177 | S32A_D565_Opaque_Dither_SSE2, // S32A_D565_Opaque_Dither |
commit-bot@chromium.org | 4759107 | 2014-02-19 03:09:52 +0000 | [diff] [blame] | 178 | NULL, // S32A_D565_Blend_Dither |
| 179 | }; |
| 180 | |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 181 | static SkBlitRow::Proc32 platform_32_procs[] = { |
| 182 | NULL, // S32_Opaque, |
| 183 | S32_Blend_BlitRow32_SSE2, // S32_Blend, |
| 184 | S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque |
| 185 | S32A_Blend_BlitRow32_SSE2, // S32A_Blend, |
| 186 | }; |
| 187 | |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 188 | SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) { |
commit-bot@chromium.org | 4759107 | 2014-02-19 03:09:52 +0000 | [diff] [blame] | 189 | if (cachedHasSSE2()) { |
| 190 | return platform_16_procs[flags]; |
| 191 | } else { |
| 192 | return NULL; |
| 193 | } |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 194 | } |
| 195 | |
senorblanco@chromium.org | c385638 | 2010-12-13 15:27:20 +0000 | [diff] [blame] | 196 | SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { |
reed@google.com | edb606c | 2011-10-18 13:56:50 +0000 | [diff] [blame] | 197 | if (cachedHasSSE2()) { |
senorblanco@chromium.org | c385638 | 2010-12-13 15:27:20 +0000 | [diff] [blame] | 198 | return Color32_SSE2; |
| 199 | } else { |
| 200 | return NULL; |
| 201 | } |
| 202 | } |
| 203 | |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 204 | SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { |
reed@google.com | edb606c | 2011-10-18 13:56:50 +0000 | [diff] [blame] | 205 | if (cachedHasSSE2()) { |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 206 | return platform_32_procs[flags]; |
| 207 | } else { |
| 208 | return NULL; |
| 209 | } |
| 210 | } |
| 211 | |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 212 | |
reed@google.com | e901b4c | 2011-11-14 21:56:45 +0000 | [diff] [blame] | 213 | SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig, |
| 214 | SkMask::Format maskFormat, |
| 215 | SkColor color) { |
reed@google.com | edb606c | 2011-10-18 13:56:50 +0000 | [diff] [blame] | 216 | if (SkMask::kA8_Format != maskFormat) { |
| 217 | return NULL; |
| 218 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 219 | |
reed@google.com | e901b4c | 2011-11-14 21:56:45 +0000 | [diff] [blame] | 220 | ColorProc proc = NULL; |
reed@google.com | edb606c | 2011-10-18 13:56:50 +0000 | [diff] [blame] | 221 | if (cachedHasSSE2()) { |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 222 | switch (dstConfig) { |
| 223 | case SkBitmap::kARGB_8888_Config: |
reed@google.com | e6ea606 | 2011-07-07 19:12:50 +0000 | [diff] [blame] | 224 | // The SSE2 version is not (yet) faster for black, so we check |
| 225 | // for that. |
| 226 | if (SK_ColorBLACK != color) { |
reed@google.com | edb606c | 2011-10-18 13:56:50 +0000 | [diff] [blame] | 227 | proc = SkARGB32_A8_BlitMask_SSE2; |
reed@google.com | e6ea606 | 2011-07-07 19:12:50 +0000 | [diff] [blame] | 228 | } |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 229 | break; |
| 230 | default: |
reed@google.com | e901b4c | 2011-11-14 21:56:45 +0000 | [diff] [blame] | 231 | break; |
reed@google.com | 981d479 | 2011-03-09 12:55:47 +0000 | [diff] [blame] | 232 | } |
| 233 | } |
| 234 | return proc; |
| 235 | } |
| 236 | |
tomhudson@google.com | d6770e6 | 2012-02-14 16:01:15 +0000 | [diff] [blame] | 237 | SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) { |
| 238 | if (cachedHasSSE2()) { |
| 239 | if (isOpaque) { |
| 240 | return SkBlitLCD16OpaqueRow_SSE2; |
| 241 | } else { |
| 242 | return SkBlitLCD16Row_SSE2; |
| 243 | } |
| 244 | } else { |
| 245 | return NULL; |
| 246 | } |
| 247 | |
| 248 | } |
reed@google.com | e901b4c | 2011-11-14 21:56:45 +0000 | [diff] [blame] | 249 | SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig, |
reed@google.com | 1750bf1 | 2011-11-15 19:51:02 +0000 | [diff] [blame] | 250 | SkMask::Format maskFormat, |
| 251 | RowFlags flags) { |
reed@google.com | e901b4c | 2011-11-14 21:56:45 +0000 | [diff] [blame] | 252 | return NULL; |
| 253 | } |
| 254 | |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 255 | SkMemset16Proc SkMemset16GetPlatformProc() { |
reed@google.com | edb606c | 2011-10-18 13:56:50 +0000 | [diff] [blame] | 256 | if (cachedHasSSE2()) { |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 257 | return sk_memset16_SSE2; |
| 258 | } else { |
| 259 | return NULL; |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | SkMemset32Proc SkMemset32GetPlatformProc() { |
reed@google.com | edb606c | 2011-10-18 13:56:50 +0000 | [diff] [blame] | 264 | if (cachedHasSSE2()) { |
senorblanco@chromium.org | 4e75355 | 2009-11-16 21:09:00 +0000 | [diff] [blame] | 265 | return sk_memset32_SSE2; |
| 266 | } else { |
| 267 | return NULL; |
| 268 | } |
| 269 | } |
tomhudson@google.com | 8dd90a9 | 2012-03-19 13:49:50 +0000 | [diff] [blame] | 270 | |
senorblanco@chromium.org | 0ded88d | 2014-01-24 15:43:50 +0000 | [diff] [blame] | 271 | SkMorphologyImageFilter::Proc SkMorphologyGetPlatformProc(SkMorphologyProcType type) { |
senorblanco@chromium.org | 7a47ad3 | 2013-10-30 21:57:04 +0000 | [diff] [blame] | 272 | if (!cachedHasSSE2()) { |
| 273 | return NULL; |
| 274 | } |
| 275 | switch (type) { |
| 276 | case kDilateX_SkMorphologyProcType: |
| 277 | return SkDilateX_SSE2; |
| 278 | case kDilateY_SkMorphologyProcType: |
| 279 | return SkDilateY_SSE2; |
| 280 | case kErodeX_SkMorphologyProcType: |
| 281 | return SkErodeX_SSE2; |
| 282 | case kErodeY_SkMorphologyProcType: |
| 283 | return SkErodeY_SSE2; |
| 284 | default: |
| 285 | return NULL; |
| 286 | } |
| 287 | } |
| 288 | |
senorblanco@chromium.org | 27eec46 | 2013-11-08 20:49:04 +0000 | [diff] [blame] | 289 | bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX, |
| 290 | SkBoxBlurProc* boxBlurY, |
senorblanco@chromium.org | 05edd02 | 2013-11-11 20:12:34 +0000 | [diff] [blame] | 291 | SkBoxBlurProc* boxBlurXY, |
| 292 | SkBoxBlurProc* boxBlurYX) { |
senorblanco@chromium.org | 27eec46 | 2013-11-08 20:49:04 +0000 | [diff] [blame] | 293 | #ifdef SK_DISABLE_BLUR_DIVISION_OPTIMIZATION |
| 294 | return false; |
| 295 | #else |
| 296 | if (!cachedHasSSE2()) { |
| 297 | return false; |
| 298 | } |
senorblanco@chromium.org | 05edd02 | 2013-11-11 20:12:34 +0000 | [diff] [blame] | 299 | return SkBoxBlurGetPlatformProcs_SSE2(boxBlurX, boxBlurY, boxBlurXY, boxBlurYX); |
senorblanco@chromium.org | 27eec46 | 2013-11-08 20:49:04 +0000 | [diff] [blame] | 300 | #endif |
| 301 | } |
| 302 | |
caryclark@google.com | 83ecdc3 | 2012-06-06 12:10:26 +0000 | [diff] [blame] | 303 | SkBlitRow::ColorRectProc PlatformColorRectProcFactory(); // suppress warning |
| 304 | |
tomhudson@google.com | 8dd90a9 | 2012-03-19 13:49:50 +0000 | [diff] [blame] | 305 | SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { |
| 306 | if (cachedHasSSE2()) { |
| 307 | return ColorRect32_SSE2; |
| 308 | } else { |
| 309 | return NULL; |
| 310 | } |
| 311 | } |
commit-bot@chromium.org | c524e98 | 2014-04-09 15:43:46 +0000 | [diff] [blame^] | 312 | |
| 313 | extern SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl_SSE2(const ProcCoeff& rec, |
| 314 | SkXfermode::Mode mode); |
| 315 | |
| 316 | SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl(const ProcCoeff& rec, |
| 317 | SkXfermode::Mode mode); |
| 318 | |
| 319 | SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl(const ProcCoeff& rec, |
| 320 | SkXfermode::Mode mode) { |
| 321 | return NULL; |
| 322 | } |
| 323 | |
| 324 | SkProcCoeffXfermode* SkPlatformXfermodeFactory(const ProcCoeff& rec, |
| 325 | SkXfermode::Mode mode); |
| 326 | |
| 327 | SkProcCoeffXfermode* SkPlatformXfermodeFactory(const ProcCoeff& rec, |
| 328 | SkXfermode::Mode mode) { |
| 329 | if (cachedHasSSE2()) { |
| 330 | return SkPlatformXfermodeFactory_impl_SSE2(rec, mode); |
| 331 | } else { |
| 332 | return SkPlatformXfermodeFactory_impl(rec, mode); |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode); |
| 337 | |
| 338 | SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode) { |
| 339 | return NULL; |
| 340 | } |