Add test for SkSL vector-slice constructors.
SkSL does not support shrinking a vector via casting. Use a swizzle instead. Change-Id: Ieba78a05dad9c55f44c765924e28f0c7e1667a67 Bug: skia:12193 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427198 Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
010c0ec061
commit
ce7cdcd7b4
@ -143,6 +143,7 @@ sksl_error_tests = [
|
||||
"/sksl/errors/UnscopedVariableInIf.sksl",
|
||||
"/sksl/errors/UnscopedVariableInWhile.sksl",
|
||||
"/sksl/errors/UsingInvalidValue.sksl",
|
||||
"/sksl/errors/VectorSlice.sksl",
|
||||
"/sksl/errors/WhileTypeMismatch.sksl",
|
||||
]
|
||||
|
||||
|
19
resources/sksl/errors/VectorSlice.sksl
Normal file
19
resources/sksl/errors/VectorSlice.sksl
Normal file
@ -0,0 +1,19 @@
|
||||
// Expect 9 errors
|
||||
|
||||
// SkSL does not support shrinking a vector via casting.
|
||||
// A vector-slice can be performed in SkSL (or GLSL) by using a swizzle instead.
|
||||
|
||||
const half4 h4 = half4(0);
|
||||
const half3 h3 = half3(h4);
|
||||
const half2 h2 = half2(h4);
|
||||
const half h = half (h4);
|
||||
|
||||
const int4 i4 = int4(0);
|
||||
const int3 i3 = int3(i4);
|
||||
const int2 i2 = int2(i4);
|
||||
const int i = int (i4);
|
||||
|
||||
const bool4 b4 = bool4(false);
|
||||
const bool3 b3 = bool3(b4);
|
||||
const bool2 b2 = bool2(b4);
|
||||
const bool b = bool (b4);
|
12
tests/sksl/errors/VectorSlice.glsl
Normal file
12
tests/sksl/errors/VectorSlice.glsl
Normal file
@ -0,0 +1,12 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 7: invalid arguments to 'half3' constructor (expected 3 scalars, but found 4)
|
||||
error: 8: invalid arguments to 'half2' constructor (expected 2 scalars, but found 4)
|
||||
error: 9: invalid argument to 'half' constructor (expected a number or bool, but found 'half4')
|
||||
error: 12: invalid arguments to 'int3' constructor (expected 3 scalars, but found 4)
|
||||
error: 13: invalid arguments to 'int2' constructor (expected 2 scalars, but found 4)
|
||||
error: 14: invalid argument to 'int' constructor (expected a number or bool, but found 'int4')
|
||||
error: 17: invalid arguments to 'bool3' constructor (expected 3 scalars, but found 4)
|
||||
error: 18: invalid arguments to 'bool2' constructor (expected 2 scalars, but found 4)
|
||||
error: 19: invalid argument to 'bool' constructor (expected a number or bool, but found 'bool4')
|
||||
9 errors
|
Loading…
Reference in New Issue
Block a user