xref: /aosp_15_r20/external/skia/resources/sksl/shared/OutParamsDoubleSwizzle.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker/*#pragma settings NoInline*/
2*c8dee2aaSAndroid Build Coastguard Worker
3*c8dee2aaSAndroid Build Coastguard Workeruniform half4 colorGreen, colorRed;
4*c8dee2aaSAndroid Build Coastguard Worker
5*c8dee2aaSAndroid Build Coastguard Workerhalf2 swizzle_lvalue(half x, half y, inout half2 color, half z) {
6*c8dee2aaSAndroid Build Coastguard Worker    color.yx = color.xy;
7*c8dee2aaSAndroid Build Coastguard Worker    return half2(x + y, z);
8*c8dee2aaSAndroid Build Coastguard Worker}
9*c8dee2aaSAndroid Build Coastguard Worker
10*c8dee2aaSAndroid Build Coastguard Workervoid func(inout half4 color) {
11*c8dee2aaSAndroid Build Coastguard Worker    half2 t = swizzle_lvalue(1, 2, color.rb, 5);
12*c8dee2aaSAndroid Build Coastguard Worker    color.ga = t;
13*c8dee2aaSAndroid Build Coastguard Worker}
14*c8dee2aaSAndroid Build Coastguard Worker
15*c8dee2aaSAndroid Build Coastguard Workerhalf4 main(float2 coords) {
16*c8dee2aaSAndroid Build Coastguard Worker    half4 result = half4(0, 1, 2, 3);
17*c8dee2aaSAndroid Build Coastguard Worker    func(result);
18*c8dee2aaSAndroid Build Coastguard Worker    return result == half4(2, 3, 0, 5) ? colorGreen : colorRed;
19*c8dee2aaSAndroid Build Coastguard Worker}
20