skia2/tests/sksl/intrinsics/Pow.glsl
John Stiles c3ff098020 Implement compile-time optimization for pow().
Change-Id: I1630cf6ecab6a1a18a7318c247f8263d87e2cda9
Bug: skia:12034
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412662
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-26 19:54:09 +00:00

11 lines
608 B
GLSL

out vec4 sk_FragColor;
uniform vec4 testInputs;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
vec4 expected = vec4(-1.5625, 0.0, 0.75, 3.375);
const vec4 exponents = vec4(2.0, 3.0, 1.0, 1.5);
return ((((((pow(testInputs.x, 2.0) == expected.x && pow(testInputs.xy, vec2(2.0, 3.0)) == expected.xy) && pow(testInputs.xyz, vec3(2.0, 3.0, 1.0)) == expected.xyz) && pow(testInputs, exponents) == expected) && 1.5625 == expected.x) && vec2(1.5625, 0.0) == expected.xy) && vec3(1.5625, 0.0, 0.75) == expected.xyz) && vec4(1.5625, 0.0, 0.75, 3.375) == expected ? colorGreen : colorRed;
}