skia2/resources/sksl/errors/MatrixColumnOverflow.sksl
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

12 lines
465 B
Plaintext

uniform float4 f4;
void f22() { float2x2(1, f4.xyz); }
void f23() { float2x3(f4.xyzw, f4.xy); }
void f24() { float2x4(f4.xyz, f4.wxyz, f4.w); }
void f32() { float3x2(f4.xy, f4.zwxy); }
void f33() { float3x3(f4.xy, f4.zw, f4.xyzw, f4.x); }
void f34() { float3x4(f4, f4.xyz, f4.wxyz, 1); }
void f42() { float4x2(f4.xyz, f4.wxyz, f4.w); }
void f43() { float4x3(f4.x, f4.yzwx, f4.yzwx, f4.yzw); }
void f44() { float4x4(f4.xy, f4.zwxy, f4.zwx, f4.yz, f4.wxyz, f4.w); }