skia2/tests/sksl/intrinsics/Dot.glsl
John Stiles 419d2ced2d Implement compile-time optimization for dot().
float dot($genType x, $genType y);
half dot($genHType x, $genHType y);

Change-Id: Ia8b893eaddd8b4325c34143c80fb0ae05b111666
Bug: skia:12034
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412339
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-26 15:05:08 +00:00

11 lines
477 B
GLSL

out vec4 sk_FragColor;
uniform vec4 inputA;
uniform vec4 inputB;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
vec4 expected = vec4(5.0, 17.0, 38.0, 70.0);
return ((((((dot(inputA.x, inputB.x) == expected.x && dot(inputA.xy, inputB.xy) == expected.y) && dot(inputA.xyz, inputB.xyz) == expected.z) && dot(inputA, inputB) == expected.w) && 5.0 == expected.x) && 17.0 == expected.y) && 38.0 == expected.z) && 70.0 == expected.w ? colorGreen : colorRed;
}