skia2/resources/sksl/intrinsics/Determinant.sksl
John Stiles c61d1bf4e6 Implement determinant() in SkSL ES3 public API.
The prototype has been added sksl_public, compile-time optimization is
implemented, and test code has been improved.

Change-Id: I536d6bd7fcae437a03744941b008940bf2a3b1c1
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440524
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-19 15:27:10 +00:00

10 lines
355 B
Plaintext

uniform float2x2 testMatrix2x2;
uniform half4 colorGreen, colorRed;
half4 main(float2 coords) {
return (determinant(testMatrix2x2) == -2 &&
determinant(half3x3(1, 2, 3, 4, 5, 6, 7, 8, 10)) == -3 &&
determinant(float4x4(1, 2, 3, 4, 5, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17)) == -16)
? colorGreen : colorRed;
}