skia2/tests/sksl/intrinsics/Cross.glsl
John Stiles c43dc5e038 Implement compile-time optimization for cross().
We need to be careful to distinguish cross(vec3, vec3)--a real built-in
intrinsic--from cross(vec2, vec2)--an inline function in sksl_gpu, but
not actually a legitimate GLSL intrinsic.

Change-Id: I7e78c99dadfcbb637ae55a2503acfb7e591c932e
Bug: skia:12034
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413440
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-06-01 15:51:53 +00:00

14 lines
325 B
GLSL

out vec4 sk_FragColor;
uniform vec2 ah;
uniform vec2 bh;
uniform vec2 af;
uniform vec2 bf;
void main() {
sk_FragColor.x = ah.x * bh.y - ah.y * bh.x;
sk_FragColor.y = af.x * bf.y - af.y * bf.x;
sk_FragColor.z = 12.0;
sk_FragColor.xyz = vec3(-8.0, -8.0, 12.0);
sk_FragColor.yzw = vec3(9.0, -18.0, -9.0);
}