skia2/tests/sksl/workarounds/RewriteMatrixVectorMultiply.glsl
John Stiles 9e13fe86b1 Rewrite matrix * vector multiplication on ARM GPUs.
If sk_Caps.rewriteMatrixVectorMultiply is false, we generate the same
code as before.

If sk_Caps.rewriteMatrixVectorMultiply is true, and optimization is
enabled, medium-precision multiplication of `matrix * vector` is
rewritten in BinaryExpression as the sum of
(m[0]*v[0] + m[1]*v[1] + ... + m[N]*v[N]).

Change-Id: I9796158fd4203b5cd2278c0d0e9a2e8cda82b136
Bug: skia:11769
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388460
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-24 19:21:44 +00:00

8 lines
198 B
GLSL

#version 400
out vec4 sk_FragColor;
vec4 main() {
mat4 m44 = mat4(123.0);
vec4 v4 = vec4(0.0, 1.0, 2.0, 3.0);
return ((m44[0] * v4.x + m44[1] * v4.y) + m44[2] * v4.z) + m44[3] * v4.w;
}