skia2/tests/sksl/errors/golden/InvalidAssignment.glsl
John Stiles c14defb8bf Disallow assignment to unfoldable ternaries in SkSL.
GLSL does not support assigning to ternaries, and will fail to compile
and/or generate non-functional shaders if we pass in a shader that tries
to assign into a ternary expression.

If SkSL is able to completely eliminate the ternary (e.g. if it boils
down to a simple `true ? x : y` or `false ? x : y`), SkSL can strip out
the ternary entirely and generate valid GLSL. This case is harmless and
so it is still allowed.

Change-Id: I960f119fb9934f998697634e6c4e519cd77d3780
Bug: skia:10767
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319679
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-25 21:26:40 +00:00

16 lines
613 B
GLSL

### Compilation failed:
error: 7: cannot assign to this expression
error: 8: cannot modify immutable variable 'u'
error: 9: cannot modify immutable variable 'x'
error: 10: cannot modify immutable variable 'x'
error: 11: cannot modify immutable variable 'x'
error: 12: cannot write to the same swizzle field more than once
error: 13: cannot modify immutable variable 's'
error: 14: cannot modify immutable variable 'l'
error: 15: cannot modify immutable variable 'r'
error: 16: cannot modify immutable variable 'l'
error: 17: cannot assign to this expression
error: 18: cannot assign to this expression
12 errors