xref: /aosp_15_r20/external/skia/src/core/SkBlitMask_opts.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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/SkBlitMask.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/SkBlitMask_opts.h"  // IWYU pragma: keep
17 
18 #include "src/opts/SkOpts_RestoreTarget.h"
19 
20 namespace SkOpts {
21     DEFINE_DEFAULT(blit_mask_d32_a8);
22 
23     void Init_BlitMask_ssse3();
24 
init()25     static bool init() {
26     #if defined(SK_ENABLE_OPTIMIZE_SIZE)
27         // All Init_foo functions are omitted when optimizing for size
28     #elif defined(SK_CPU_X86)
29         #if SK_CPU_SSE_LEVEL < SK_CPU_SSE_LEVEL_SSSE3
30             if (SkCpu::Supports(SkCpu::SSSE3)) { Init_BlitMask_ssse3(); }
31         #endif
32     #endif
33       return true;
34     }
35 
Init_BlitMask()36     void Init_BlitMask() {
37         [[maybe_unused]] static bool gInitialized = init();
38     }
39 }  // namespace SkOpts
40