OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The Android Open Source Project | 2 * Copyright 2009 The Android Open Source Project |
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 "SkBitmapProcState_opts_SSE2.h" | 8 #include "SkBitmapProcState_opts_SSE2.h" |
9 #include "SkBitmapProcState_opts_SSSE3.h" | 9 #include "SkBitmapProcState_opts_SSSE3.h" |
10 #include "SkBitmapFilter_opts_SSE2.h" | 10 #include "SkBitmapFilter_opts_SSE2.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if (cachedHasSSE2()) { | 116 if (cachedHasSSE2()) { |
117 procs->fExtraHorizontalReads = 3; | 117 procs->fExtraHorizontalReads = 3; |
118 procs->fConvolveVertically = &convolveVertically_SSE2; | 118 procs->fConvolveVertically = &convolveVertically_SSE2; |
119 procs->fConvolve4RowsHorizontally = &convolve4RowsHorizontally_SSE2; | 119 procs->fConvolve4RowsHorizontally = &convolve4RowsHorizontally_SSE2; |
120 procs->fConvolveHorizontally = &convolveHorizontally_SSE2; | 120 procs->fConvolveHorizontally = &convolveHorizontally_SSE2; |
121 procs->fApplySIMDPadding = &applySIMDPadding_SSE2; | 121 procs->fApplySIMDPadding = &applySIMDPadding_SSE2; |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 void SkBitmapProcState::platformProcs() { | 125 void SkBitmapProcState::platformProcs() { |
126 if (cachedHasSSSE3()) { | 126 /* Every optimization in the function requires at least SSE2 */ |
127 if (fSampleProc32 == S32_opaque_D32_filter_DX) { | 127 if (!cachedHasSSE2()) { |
| 128 return; |
| 129 } |
| 130 |
| 131 /* Check fSampleProc32 */ |
| 132 if (fSampleProc32 == S32_opaque_D32_filter_DX) { |
| 133 if (cachedHasSSSE3()) { |
128 fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3; | 134 fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3; |
129 } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { | 135 } else { |
| 136 fSampleProc32 = S32_opaque_D32_filter_DX_SSE2; |
| 137 } |
| 138 } else if (fSampleProc32 == S32_opaque_D32_filter_DXDY) { |
| 139 if (cachedHasSSSE3()) { |
| 140 fSampleProc32 = S32_opaque_D32_filter_DXDY_SSSE3; |
| 141 } |
| 142 } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { |
| 143 if (cachedHasSSSE3()) { |
130 fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3; | 144 fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3; |
131 } | 145 } else { |
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 } | |
138 } else if (cachedHasSSE2()) { | |
139 if (fSampleProc32 == S32_opaque_D32_filter_DX) { | |
140 fSampleProc32 = S32_opaque_D32_filter_DX_SSE2; | |
141 } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { | |
142 fSampleProc32 = S32_alpha_D32_filter_DX_SSE2; | 146 fSampleProc32 = S32_alpha_D32_filter_DX_SSE2; |
143 } | 147 } |
144 | 148 } else if (fSampleProc32 == S32_alpha_D32_filter_DXDY) { |
145 if (fSampleProc16 == S32_D16_filter_DX) { | 149 if (cachedHasSSSE3()) { |
146 fSampleProc16 = S32_D16_filter_DX_SSE2; | 150 fSampleProc32 = S32_alpha_D32_filter_DXDY_SSSE3; |
147 } | 151 } |
148 } | 152 } |
149 | 153 |
150 if (cachedHasSSSE3() || cachedHasSSE2()) { | 154 /* Check fSampleProc16 */ |
151 if (fMatrixProc == ClampX_ClampY_filter_scale) { | 155 if (fSampleProc16 == S32_D16_filter_DX) { |
152 fMatrixProc = ClampX_ClampY_filter_scale_SSE2; | 156 fSampleProc16 = S32_D16_filter_DX_SSE2; |
153 } else if (fMatrixProc == ClampX_ClampY_nofilter_scale) { | 157 } |
154 fMatrixProc = ClampX_ClampY_nofilter_scale_SSE2; | |
155 } | |
156 | 158 |
157 if (fMatrixProc == ClampX_ClampY_filter_affine) { | 159 /* Check fMatrixProc */ |
158 fMatrixProc = ClampX_ClampY_filter_affine_SSE2; | 160 if (fMatrixProc == ClampX_ClampY_filter_scale) { |
159 } else if (fMatrixProc == ClampX_ClampY_nofilter_affine) { | 161 fMatrixProc = ClampX_ClampY_filter_scale_SSE2; |
160 fMatrixProc = ClampX_ClampY_nofilter_affine_SSE2; | 162 } else if (fMatrixProc == ClampX_ClampY_nofilter_scale) { |
161 } | 163 fMatrixProc = ClampX_ClampY_nofilter_scale_SSE2; |
162 if (c_hqfilter_sse) { | 164 } else if (fMatrixProc == ClampX_ClampY_filter_affine) { |
163 if (fShaderProc32 == highQualityFilter32) { | 165 fMatrixProc = ClampX_ClampY_filter_affine_SSE2; |
164 fShaderProc32 = highQualityFilter_SSE2; | 166 } else if (fMatrixProc == ClampX_ClampY_nofilter_affine) { |
165 } | 167 fMatrixProc = ClampX_ClampY_nofilter_affine_SSE2; |
| 168 } |
| 169 |
| 170 /* Check fShaderProc32 */ |
| 171 if (c_hqfilter_sse) { |
| 172 if (fShaderProc32 == highQualityFilter32) { |
| 173 fShaderProc32 = highQualityFilter_SSE2; |
166 } | 174 } |
167 } | 175 } |
168 } | 176 } |
169 | 177 |
170 static SkBlitRow::Proc platform_16_procs[] = { | 178 static SkBlitRow::Proc platform_16_procs[] = { |
171 S32_D565_Opaque_SSE2, // S32_D565_Opaque | 179 S32_D565_Opaque_SSE2, // S32_D565_Opaque |
172 NULL, // S32_D565_Blend | 180 NULL, // S32_D565_Blend |
173 S32A_D565_Opaque_SSE2, // S32A_D565_Opaque | 181 S32A_D565_Opaque_SSE2, // S32A_D565_Opaque |
174 NULL, // S32A_D565_Blend | 182 NULL, // S32A_D565_Blend |
175 S32_D565_Opaque_Dither_SSE2, // S32_D565_Opaque_Dither | 183 S32_D565_Opaque_Dither_SSE2, // S32_D565_Opaque_Dither |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } else { | 339 } else { |
332 return SkPlatformXfermodeFactory_impl(rec, mode); | 340 return SkPlatformXfermodeFactory_impl(rec, mode); |
333 } | 341 } |
334 } | 342 } |
335 | 343 |
336 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode); | 344 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode); |
337 | 345 |
338 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode) { | 346 SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode) { |
339 return NULL; | 347 return NULL; |
340 } | 348 } |
OLD | NEW |