skia2/resources/sksl/runtime_errors/IllegalShaderSampling.rts
John Stiles 6dda78ac7b Add SkSL error tests for runtime_errors directory.
This enables the SkSL error testing logic for runtime effects. The core
logic is identical, only the ProgramKind differs.

(Error creation scripts: http://go/paste/6413797460803584 with some
light post-processing)

Change-Id: I877205b3cc1014b50ccccf6037a2f4034c07543e
Bug: skia:12665
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506538
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-02-10 14:24:39 +00:00

52 lines
1.8 KiB
Plaintext

// Expect 15 errors
uniform shader s;
uniform colorFilter f;
uniform blender b;
uniform float2 xy;
uniform half4 color;
int i;
half4 eval_shader_xy_color() { return s.eval(xy, color); }
half4 eval_shader_color() { return s.eval(color); }
half4 eval_shader_color_xy() { return s.eval(color, xy); }
half4 eval_shader_empty() { return s.eval(); }
half4 eval_shader_matrix() { return s.eval(float3x3(1)); }
half4 eval_shader_comma_expr() { return (i++, s).eval(xy); }
half4 eval_colorFilter_empty() { return f.eval(); }
half4 eval_colorFilter_xy() { return f.eval(xy); }
half4 eval_colorFilter_xy_color() { return f.eval(xy, color); }
half4 eval_colorFilter_comma_expr() { return (s, f).eval(color); }
half4 eval_blender_empty() { return b.eval(); }
half4 eval_blender_color() { return b.eval(color); }
half4 eval_blender_xy() { return b.eval(xy); }
half4 eval_blender_xy_color() { return b.eval(xy, color); }
half4 eval_blender_comma_expr() { return (b, b).eval(color, color); }
// Correct usage (EXPECT NO ERRORS)
half4 eval_blender() { return b.eval(color, color); }
half4 eval_colorFilter() { return f.eval(color); }
half4 eval_shader() { return s.eval(xy); }
/*%%*
no match for shader::eval(float2, half4)
no match for shader::eval(half4)
no match for shader::eval(half4, float2)
no match for shader::eval()
no match for shader::eval(float3x3)
type mismatch: ',' cannot operate on 'int', 'shader'
no match for colorFilter::eval()
no match for colorFilter::eval(float2)
no match for colorFilter::eval(float2, half4)
type mismatch: ',' cannot operate on 'shader', 'colorFilter'
no match for blender::eval()
no match for blender::eval(half4)
no match for blender::eval(float2)
no match for blender::eval(float2, half4)
type mismatch: ',' cannot operate on 'blender', 'blender'
*%%*/