skia2/resources/sksl/intrinsics/Cross.sksl
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

10 lines
322 B
Plaintext

uniform half2 ah, bh;
uniform float2 af, bf;
void main() {
sk_FragColor.x = cross(ah, bh);
sk_FragColor.y = half(cross(af, bf));
sk_FragColor.z = cross(half2(3, 0), half2(-1, 4));
sk_FragColor.xyz = cross(half3(3, 0, 2), half3(-1, 4, 2));
sk_FragColor.yzw = cross(half3(1, 4, -7), half3(2, -1, 4));
}