xref: /aosp_15_r20/external/skia/resources/sksl/wgsl/EntrypointIsWrittenLast.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1// This is a copy of FunctionPrototype.sksl, but with `noinline` applied to all functions.
2
3layout (binding=0) uniform Uniforms {
4    layout (offset=0) half4 colorGreen;
5};
6
7noinline float this_function_is_prototyped_at_the_start_and_never_defined();
8noinline half4 this_function_is_defined_before_use(half4 x);
9noinline half4 this_function_is_defined_after_use(half4 x);
10noinline half4 this_function_is_defined_near_the_end(half4 x);
11half4 main(float2 coords); // prototyping main is allowed (although not particularly useful)
12
13noinline half4 this_function_is_defined_before_use(half4 x) {
14    return -this_function_is_defined_near_the_end(x);
15}
16
17noinline bool this_function_is_prototyped_in_the_middle_and_never_defined(float4x4 a);
18
19half4 main(float2 coords) {
20    return this_function_is_defined_after_use(colorGreen);
21}
22
23noinline half4 this_function_is_defined_after_use(half4 x) {
24    return this_function_is_defined_before_use(-x);
25}
26
27noinline half4 this_function_is_defined_near_the_end(half4 x) {
28    return x;
29}
30
31noinline int3 this_function_is_prototyped_at_the_very_end_and_never_defined(half2x2 x, bool2 y);
32