skia2/tests/sksl/intrinsics/Transpose.glsl
John Stiles 1e45dcd12f Add compile-time optimization for transpose().
Change-Id: I9ddb80b8886827250e243dc9174bb3679e70df9b
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440262
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-18 13:49:04 +00:00

11 lines
449 B
GLSL

out vec4 sk_FragColor;
uniform mat2 testMatrix2x2;
uniform mat3 testMatrix3x3;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
mat2x3 testMatrix2x3 = mat2x3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
return (transpose(testMatrix2x2) == mat2(1.0, 3.0, 2.0, 4.0) && transpose(testMatrix2x3) == mat3x2(1.0, 4.0, 2.0, 5.0, 3.0, 6.0)) && transpose(testMatrix3x3) == mat3(1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0) ? colorGreen : colorRed;
}