skia2/tests/sksl/intrinsics/golden/Determinant.glsl
John Stiles 5f675be193 Add tests for SkSL intrinsic functions.
This does not give us 100% coverage of intrinsics yet, but it is a
pretty good start.

Change-Id: I97d49324db1afd9f2975c2eeafbacdead710d4aa
Bug: skia:11054
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341977
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-12-09 22:02:17 +00:00

7 lines
929 B
GLSL

mat4 _determinant4(mat4 m) { float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3]; float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3]; float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3]; float a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3]; float b00 = a00 * a11 - a01 * a10; float b01 = a00 * a12 - a02 * a10; float b02 = a00 * a13 - a03 * a10; float b03 = a01 * a12 - a02 * a11; float b04 = a01 * a13 - a03 * a11; float b05 = a02 * a13 - a03 * a12; float b06 = a20 * a31 - a21 * a30; float b07 = a20 * a32 - a22 * a30; float b08 = a20 * a33 - a23 * a30; float b09 = a21 * a32 - a22 * a31; float b10 = a21 * a33 - a23 * a31; float b11 = a22 * a33 - a23 * a32; return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;}out vec4 sk_FragColor;
mat4 a;
void main() {
sk_FragColor.x = _determinant4(a);
}