xref: /aosp_15_r20/external/skia/resources/sksl/runtime_errors/IllegalShaderSampling.rts (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1// Expect 15 errors
2
3uniform shader      s;
4uniform colorFilter f;
5uniform blender     b;
6
7uniform float2 xy;
8uniform half4  color;
9int i;
10
11half4 eval_shader_xy_color()   { return s.eval(xy, color); }
12half4 eval_shader_color()      { return s.eval(color); }
13half4 eval_shader_color_xy()   { return s.eval(color, xy); }
14half4 eval_shader_empty()      { return s.eval(); }
15half4 eval_shader_matrix()     { return s.eval(float3x3(1)); }
16half4 eval_shader_comma_expr() { return (i++, s).eval(xy); }
17
18half4 eval_colorFilter_empty()      { return f.eval(); }
19half4 eval_colorFilter_xy()         { return f.eval(xy); }
20half4 eval_colorFilter_xy_color()   { return f.eval(xy, color); }
21half4 eval_colorFilter_comma_expr() { return (s, f).eval(color); }
22
23half4 eval_blender_empty()      { return b.eval(); }
24half4 eval_blender_color()      { return b.eval(color); }
25half4 eval_blender_xy()         { return b.eval(xy); }
26half4 eval_blender_xy_color()   { return b.eval(xy, color); }
27half4 eval_blender_comma_expr() { return (b, b).eval(color, color); }
28
29// Correct usage (EXPECT NO ERRORS)
30
31half4 eval_blender() { return b.eval(color, color); }
32half4 eval_colorFilter() { return f.eval(color); }
33half4 eval_shader() { return s.eval(xy); }
34
35/*%%*
36no match for shader::eval(float2, half4)
37no match for shader::eval(half4)
38no match for shader::eval(half4, float2)
39no match for shader::eval()
40no match for shader::eval(float3x3)
41type mismatch: ',' cannot operate on 'int', 'shader'
42no match for colorFilter::eval()
43no match for colorFilter::eval(float2)
44no match for colorFilter::eval(float2, half4)
45type mismatch: ',' cannot operate on 'shader', 'colorFilter'
46no match for blender::eval()
47no match for blender::eval(half4)
48no match for blender::eval(float2)
49no match for blender::eval(float2, half4)
50type mismatch: ',' cannot operate on 'blender', 'blender'
51*%%*/
52