skia2/tests/sksl/intrinsics/MatrixCompMultES3.glsl
John Stiles b701fa0ac0 Add non-square MatrixCompMult support to public SkSL in ES3 mode.
We already had a test case here, but it wasn't actually in operation.
The test has been split into ES2 (square) and ES3 (non-square) halves,
returns the color like a proper runtime effect, and it's now running in
dm.

Also, Metal doesn't natively support matrixCompMult, so it injects a
helper function; I tweaked the helper so it no longer requires an extra
result variable.

Change-Id: Ie79242768966fcbe879ad73461d17b4fb8e55670
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448117
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-14 18:15:23 +00:00

11 lines
645 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
mat2x4 h24 = matrixCompMult(mat2x4(9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0, 9.0), mat2x4(colorRed, colorGreen));
mat4x2 h42 = matrixCompMult(mat4x2(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0), mat4x2(colorRed, colorGreen));
mat4x3 f43 = mat4x3(12.0, 22.0, 30.0, 36.0, 40.0, 42.0, 42.0, 40.0, 36.0, 30.0, 22.0, 12.0);
return (h24 == mat2x4(9.0, 0.0, 0.0, 9.0, 0.0, 9.0, 0.0, 9.0) && h42 == mat4x2(1.0, 0.0, 0.0, 4.0, 0.0, 6.0, 0.0, 8.0)) && f43 == mat4x3(12.0, 22.0, 30.0, 36.0, 40.0, 42.0, 42.0, 40.0, 36.0, 30.0, 22.0, 12.0) ? colorGreen : colorRed;
}