skia2/resources/sksl/intrinsics/Cross.sksl
Brian Osman fde20db7ca Rename SkSL's 2D cross product builtin function
Note that the 2D cross product isn't defined. There are at least two
possible interpretations of what that might mean. This name makes it
clearer that we're asking for the length of the resulting vector, if
we computed the 3D cross product (assuming Z == 0 for both vectors).

It also eliminates name overlap between builtin functions and actual
intrinsics.

Change-Id: I24e8bc0ab2ec91aaace20f0dd3e8565c10bd44a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484440
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-14 22:00:26 +00:00

10 lines
352 B
Plaintext

uniform half2 ah, bh;
uniform float2 af, bf;
void main() {
sk_FragColor.x = cross_length_2d(ah, bh);
sk_FragColor.y = half(cross_length_2d(af, bf));
sk_FragColor.z = cross_length_2d(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));
}