skia2/tests/sksl/shared/MatricesNonsquare.glsl
John Stiles 92748af1a5 Inline functions of the form 'return (expr)' only.
This drastically reduces the number of functions which we allow to be
inlined. If this change does not hurt our performance, it will allow us
to trivially remove hundreds of LOC. All current data leads us to
believe that it may affect the Mali 400 but is highly unlikely to change
results on any other device in the tree.

More info: http://go/optimization-in-sksl-inliner

Change-Id: Ia6b706742ce5407453e0e697b6c1f9201084c0e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384858
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-03-15 19:46:46 +00:00

38 lines
853 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorGreen;
uniform vec4 colorRed;
bool test_float() {
mat2x3 m23 = mat2x3(23.0);
mat2x4 m24 = mat2x4(24.0);
mat3x2 m32 = mat3x2(32.0);
mat3x4 m34 = mat3x4(34.0);
mat4x2 m42 = mat4x2(42.0);
mat4x3 m43 = mat4x3(44.0);
mat2 m22 = m32 * m23;
m22 *= m22;
mat3 m33 = m43 * m34;
m33 *= m33;
mat4 m44 = m24 * m42;
m44 *= m44;
return true;
}
bool test_half() {
mat2x3 m23 = mat2x3(23.0);
mat2x4 m24 = mat2x4(24.0);
mat3x2 m32 = mat3x2(32.0);
mat3x4 m34 = mat3x4(34.0);
mat4x2 m42 = mat4x2(42.0);
mat4x3 m43 = mat4x3(44.0);
mat2 m22 = m32 * m23;
m22 *= m22;
mat3 m33 = m43 * m34;
m33 *= m33;
mat4 m44 = m24 * m42;
m44 *= m44;
return true;
}
vec4 main() {
return test_float() && test_half() ? colorGreen : colorRed;
}