skia2/tests/sksl/errors/MatrixColumnOverflow.glsl
John Stiles eb68973c2f Disallow matrix ctors which overflow a column.
The GLSL spec allows matrix constructors containing vectors that would
split between multiple columns of the matrix. However, in practice, this
does not actually work well on a lot of GPUs!

- "cast not allowed", "internal error":
	Tegra 3
	Quadro P400
	GTX 660
	GTX 960
- Compiles, but generates wrong result:
	RadeonR9M470X
	RadeonHD7770

Since this isn't a pattern we expect to see in user code, we now report
it as an error at compile time. mat2(vec4) is treated as an exceptional
case and still allowed.

Change-Id: Id6925984a2d1ec948aec4defcc790a197a96cf86
Bug: skia:12443
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449518
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-09-16 22:14:49 +00:00

13 lines
932 B
GLSL

### Compilation failed:
error: 3: argument 2 to 'float2x2' constructor is 'float3', but matrix column only has 1 slot left
error: 4: argument 1 to 'float2x3' constructor is 'float4', but matrix column only has 3 slots left
error: 5: argument 2 to 'float2x4' constructor is 'float4', but matrix column only has 1 slot left
error: 6: argument 2 to 'float3x2' constructor is 'float4', but matrix column only has 2 slots left
error: 7: argument 2 to 'float3x3' constructor is 'float2', but matrix column only has 1 slot left
error: 8: argument 3 to 'float3x4' constructor is 'float4', but matrix column only has 1 slot left
error: 9: argument 1 to 'float4x2' constructor is 'float3', but matrix column only has 2 slots left
error: 10: argument 2 to 'float4x3' constructor is 'float4', but matrix column only has 2 slots left
error: 11: argument 2 to 'float4x4' constructor is 'float4', but matrix column only has 2 slots left
9 errors