skia2/tests/sksl/shared/golden/Matrices.glsl
John Stiles bf282c05e5 Replace array indexing on vector types with swizzles.
Our optimizer ignores index expressions, but has a few simplifications
that it can perform on swizzles. (Added extra code to SwizzleByIndex
which demonstrates this.)

Change-Id: If3c85a0456d98749008d796e422944b602ee6933
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341460
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-12-07 21:16:40 +00:00

11 lines
589 B
GLSL

out vec4 sk_FragColor;
void main() {
mat3x4 z = mat2x4(1.0) * mat3x2(1.0, 0.0, 0.0, 1.0, 2.0, 2.0);
vec3 v1 = mat3(1.0) * vec3(2.0);
vec3 v2 = vec3(2.0) * mat3(1.0);
sk_FragColor = vec4(z[0].x, v1 + v2);
mat2 m5 = mat2(mat2(1.0, 2.0, 3.0, 4.0)[0].x);
sk_FragColor = vec4((((((((((mat2(1.0, 2.0, 3.0, 4.0)[0].x + mat2(vec4(0.0))[0].x) + mat2(1.0, 2.0, 3.0, 4.0)[0].x) + mat2(1.0)[0].x) + m5[0].x) + mat2(1.0, 2.0, 3.0, 4.0)[0].x) + mat2(5.0, 6.0, 7.0, 8.0)[0].x) + mat3x2(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)[0].x) + mat3(1.0)[0].x) + mat4(1.0)[0].x) + mat4(2.0)[0].x);
}