xref: /aosp_15_r20/external/skia/include/gpu/graphite/precompile/PrecompileRuntimeEffect.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2024 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 #ifndef skgpu_graphite_precompile_PrecompileRuntimeEffect_DEFINED
9 #define skgpu_graphite_precompile_PrecompileRuntimeEffect_DEFINED
10 
11 #include "include/core/SkRefCnt.h"
12 #include "include/core/SkSpan.h"
13 
14 class SkRuntimeEffect;
15 
16 namespace skgpu::graphite {
17 
18 class PrecompileBase;
19 class PrecompileBlender;
20 class PrecompileColorFilter;
21 class PrecompileShader;
22 
23 using PrecompileChildOptions = SkSpan<const sk_sp<PrecompileBase>>;
24 
25 //--------------------------------------------------------------------------------------------------
26 // These factory functions correspond to the main API's SkRuntimeEffect makeShader, makeColorFilter,
27 // and makeBlender functions. The uniform values found in the main API are abstracted away since
28 // they do not alter the generated code.
29 namespace PrecompileRuntimeEffects {
30 
31 SK_API sk_sp<PrecompileShader> MakePrecompileShader(
32         sk_sp<SkRuntimeEffect> effect,
33         SkSpan<const PrecompileChildOptions> childOptions = {});
34 
35 SK_API sk_sp<PrecompileColorFilter> MakePrecompileColorFilter(
36         sk_sp<SkRuntimeEffect> effect,
37         SkSpan<const PrecompileChildOptions> childOptions = {});
38 
39 SK_API sk_sp<PrecompileBlender> MakePrecompileBlender(
40         sk_sp<SkRuntimeEffect> effect,
41         SkSpan<const PrecompileChildOptions> childOptions = {});
42 
43 } // namespace PrecompileRuntimeEffects
44 
45 } // namespace skgpu::graphite
46 
47 #endif // skgpu_graphite_precompile_PrecompileRuntimeEffect_DEFINED
48