skia2/tests/sksl/runtime_errors/IllegalShaderUse.skvm
John Stiles 9f85e0e12d Further reduce the size of DSLType.
DSLType stored an `fPosition` which was only used in one place, when
reporting that a function is not allowed to return a particular type.
Those errors now highlight the type and function name together, which is
not really any worse than before. This allows us to shrink DSLType down
to its minimal form, just a pointer to an SkSL::Type and nothing else.

Change-Id: I4b430cb996472da0ae57bc2ab095cd123d2c3f51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546097
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-06-02 14:02:29 +00:00

76 lines
2.9 KiB
Plaintext

### Compilation failed:
error: 10: variables of type 'shader' must be uniform
shader s3;
^^^^^^^^^
error: 11: 'in' variables not permitted in runtime effects
in shader s4;
^^^^^^^^^^^^
error: 11: variables of type 'shader' must be uniform
in shader s4;
^^^^^^^^^^^^
error: 13: opaque type 'shader' is not permitted in a struct
struct S { shader sh; };
^^^^^^^^^
error: 14: variables of type 'S' may not be uniform
uniform S s5;
^^^^^^^^^^^^
error: 15: opaque type 'shader' may not be used in an array
uniform shader s6[2];
^^^^^^^^^^^^^^^^^^^^
error: 18: type mismatch: '==' cannot operate on 'shader', 'shader'
bool equality() { return s1 == s2; }
^^^^^^^^
error: 19: type mismatch: '<' cannot operate on 'shader', 'shader'
bool comparison() { return s1 < s2; }
^^^^^^^
error: 20: '!' cannot operate on 'shader'
bool unary_not() { return !s1; }
^^^
error: 21: '-' cannot operate on 'shader'
void unary_neg() { -s1; }
^^^
error: 22: '+' cannot operate on 'shader'
void unary_pos() { +s1; }
^^^
error: 23: type mismatch: '*' cannot operate on 'shader', 'shader'
void arithmetic() { s1 * s2; }
^^^^^^^
error: 24: expected array, but found 'shader'
void index() { s1[0]; }
^^
error: 25: type 'shader' has no method named 'xyz'
void swizzle() { s1.xyz; }
^^^^^^
error: 26: cannot modify immutable variable 's1'
void assignment() { s1 = s2; }
^^
error: 27: variables of type 'shader' must be global
half4 local() { shader s; return s.eval(xy); }
^^^^^^^^
error: 27: variables of type 'shader' must be uniform
half4 local() { shader s; return s.eval(xy); }
^^^^^^^^
error: 28: parameters of type 'shader' not allowed
half4 parameter(shader s) { return s.eval(xy); }
^^^^^^^^
error: 28: unknown identifier 's'
half4 parameter(shader s) { return s.eval(xy); }
^
error: 29: functions may not return opaque type 'shader'
shader returned() { return s1; }
^^^^^^^^^^^^^^^^^
error: 30: cannot construct 'shader'
half4 constructed() { return shader(s1).eval(xy); }
^^^^^^^^^^
error: 31: ternary expression of opaque type 'shader' not allowed
half4 expression(bool b) { return (b ? s1 : s2).eval(xy); }
^^^^^^^^^^^
error: 32: expected '(' to begin method call
half4 dangling_eval() { s1.eval; }
^
error: 32: function 'dangling_eval' can exit without returning a value
half4 dangling_eval() { s1.eval; }
^^^^^^^^^^^^
24 errors