xref: /aosp_15_r20/external/skia/resources/sksl/errors/InvalidOutParams.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Workervoid inc1(out float x)  { x++; }
2*c8dee2aaSAndroid Build Coastguard Workervoid inc4(out float4 x) { x += half4(1); }
3*c8dee2aaSAndroid Build Coastguard Worker
4*c8dee2aaSAndroid Build Coastguard Workervoid test_a() { inc1(0); }
5*c8dee2aaSAndroid Build Coastguard Workervoid test_b() { inc4(float4(0)); }
6*c8dee2aaSAndroid Build Coastguard Workervoid test_c() { inc1(sqrt(1)); }
7*c8dee2aaSAndroid Build Coastguard Worker
8*c8dee2aaSAndroid Build Coastguard Worker// $pure isn't allowed outside of module code, but the test still does its job; it just reports an
9*c8dee2aaSAndroid Build Coastguard Worker// additional error as well ('$pure' is not permitted here).
10*c8dee2aaSAndroid Build Coastguard Worker$pure void pure_function_with_out_param  (out float x)   { x = 1; }
11*c8dee2aaSAndroid Build Coastguard Worker$pure void pure_function_with_inout_param(inout float x) { x += 1; }
12*c8dee2aaSAndroid Build Coastguard Worker
13*c8dee2aaSAndroid Build Coastguard Worker/*%%*
14*c8dee2aaSAndroid Build Coastguard Workercannot assign to this expression
15*c8dee2aaSAndroid Build Coastguard Workercannot assign to this expression
16*c8dee2aaSAndroid Build Coastguard Workercannot assign to this expression
17*c8dee2aaSAndroid Build Coastguard Workerpure functions cannot have out parameters
18*c8dee2aaSAndroid Build Coastguard Workerpure functions cannot have out parameters
19*c8dee2aaSAndroid Build Coastguard Worker*%%*/
20