xref: /aosp_15_r20/external/skia/resources/sksl/runtime_errors/IllegalShaderUse.rts (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1// Expect >= 8 errors (currently 12, due to double-reporting)
2
3// Correct declaration (used in some test functions)
4uniform shader s1;
5uniform shader s2;
6
7uniform float2 xy;
8
9// Incorrect shader declarations (they must be uniform)
10shader s3;
11in shader s4;
12// Incorrect shader declarations (no opaque types in structs or arrays)
13struct S { shader sh; };
14uniform S s5;
15uniform shader s6[2];
16
17// Various places that shaders should not be allowed:
18bool   equality()          { return s1 == s2; }
19bool   comparison()        { return s1 < s2; }
20bool   unary_not()         { return !s1; }
21void   unary_neg()         { -s1; }
22void   unary_pos()         { +s1; }
23void   arithmetic()        { s1 * s2; }
24void   index()             { s1[0]; }
25void   swizzle()           { s1.xyz; }
26void   assignment()        { s1 = s2; }
27half4  local()             { shader s; return s.eval(xy); }
28half4  parameter(shader s) { return s.eval(xy); }
29shader returned()          { return s1; }
30half4  constructed()       { return shader(s1).eval(xy); }
31half4  expression(bool b)  { return (b ? s1 : s2).eval(xy); }
32half4  dangling_eval()     { s1.eval; }
33
34/*%%*
35variables of type 'shader' must be uniform
36variables of type 'shader' must be uniform
37'in' is not permitted here
38opaque type 'shader' is not permitted in a struct
39variables of type 'S' may not be uniform
40opaque type 'shader' may not be used in an array
41type mismatch: '==' cannot operate on 'shader', 'shader'
42type mismatch: '<' cannot operate on 'shader', 'shader'
43'!' cannot operate on 'shader'
44'-' cannot operate on 'shader'
45'+' cannot operate on 'shader'
46type mismatch: '*' cannot operate on 'shader', 'shader'
47expected array, but found 'shader'
48type 'shader' has no method named 'xyz'
49cannot modify immutable variable 's1'
50variables of type 'shader' must be global
51variables of type 'shader' must be uniform
52parameters of type 'shader' not allowed
53unknown identifier 's'
54functions may not return opaque type 'shader'
55cannot construct 'shader'
56ternary expression of opaque type 'shader' is not allowed
57expected '(' to begin method call
58function 'dangling_eval' can exit without returning a value
59*%%*/
60