xref: /aosp_15_r20/external/skia/resources/sksl/runtime/FunctionParameterAliasingFirst.rts (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform half4 colorGreen, colorRed;
2
3noinline half4 clear_blue(half4 param) {
4    return param.rg0a;
5}
6
7half4 main(float2) {
8    // First, pass a variable directly to `clear_blue`; the function parameter can be aliased
9    // directly to `red`.
10    half4 red    = colorRed;
11    half4 result = clear_blue(red);
12
13    // Now, call `clear_blue` with an expression that cannot be aliased directly onto a variable.
14    // The parameter should now get dedicated slots.
15    result = clear_blue(colorGreen.rgb1);
16    return result;
17}
18