skia2/resources/sksl/runtime_errors/IllegalShaderUse.rts
John Stiles 32385b7070 Report incomplete expression-statements as errors.
Previously, a dangling type or function reference would be eliminated
silently with optimizations on, or would assert when optimizations were
off.

Change-Id: Ib2e273b6f069724e8872c9cb97351b647b875a62
Bug: skia:12472
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469525
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-09 22:10:18 +00:00

20 lines
624 B
Plaintext

// Expect >= 8 errors (currently 12, due to double-reporting)
// Correct declaration (used in some test functions)
uniform shader s1;
uniform shader s2;
uniform float2 xy;
// Incorrect shader declarations (they must be uniform)
shader s3;
in shader s4;
// Various places that shaders should not be allowed:
half4 local() { shader s; return s.eval(xy); }
half4 parameter(shader s) { return s.eval(xy); }
shader returned() { return s1; }
half4 constructed() { return shader(s1).eval(xy); }
half4 expression(bool b) { return (b ? s1 : s2).eval(xy); }
half4 dangling_eval() { s1.eval; }