| 1 |
/* |
| 2 |
* Copyright 2023 Google LLC |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "include/private/base/SkFeatures.h" |
| 9 |
#include "src/core/SkBitmapProcState.h" |
| 10 |
#include "src/core/SkCpu.h" |
| 11 |
#include "src/core/SkOptsTargets.h" |
| 12 |
|
| 13 |
#define SK_OPTS_TARGET SK_OPTS_TARGET_DEFAULT |
| 14 |
#include "src/opts/SkOpts_SetTarget.h" |
| 15 |
|
| 16 |
#include "src/opts/SkBitmapProcState_opts.h" // IWYU pragma: keep |
| 17 |
|
| 18 |
#include "src/opts/SkOpts_RestoreTarget.h" |
| 19 |
|
| 20 |
namespace SkOpts { |
| 21 |
DEFINE_DEFAULT(S32_alpha_D32_filter_DX); |
| 22 |
DEFINE_DEFAULT(S32_alpha_D32_filter_DXDY); |
| 23 |
|
| 24 |
void Init_BitmapProcState_ssse3(); |
| 25 |
void Init_BitmapProcState_lasx(); |
| 26 |
|
| 27 |
static bool init() { |
| 28 |
#if defined(SK_ENABLE_OPTIMIZE_SIZE) |
| 29 |
// All Init_foo functions are omitted when optimizing for size |
| 30 |
#elif defined(SK_CPU_X86) |
| 31 |
#if SK_CPU_SSE_LEVEL < SK_CPU_SSE_LEVEL_SSSE3 |
| 32 |
if (SkCpu::Supports(SkCpu::SSSE3)) { Init_BitmapProcState_ssse3(); } |
| 33 |
#endif |
| 34 |
#elif defined(SK_CPU_LOONGARCH) |
| 35 |
#if SK_CPU_LSX_LEVEL < SK_CPU_LSX_LEVEL_LASX |
| 36 |
if (SkCpu::Supports(SkCpu::LOONGARCH_ASX)) { Init_BitmapProcState_lasx(); } |
| 37 |
#endif |
| 38 |
#endif |
| 39 |
return true; |
| 40 |
} |
| 41 |
|
| 42 |
void Init_BitmapProcState() { |
| 43 |
[[maybe_unused]] static bool gInitialized = init(); |
| 44 |
} |
| 45 |
} // namespace SkOpts |