46787d5d7e
Fix code generation for Metal and Vulkan with geometric intrinsics that have scalar versions in GLSL/SkSL, but no native support in MSL/SPIR-V. Change-Id: Id4538a00172e0d233ad9d5ed8d33db6436b83208 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338276 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: John Stiles <johnstiles@google.com>
22 lines
423 B
Plaintext
22 lines
423 B
Plaintext
float scalar(float x, float y) {
|
|
x = length(x);
|
|
x = distance(x, y);
|
|
x = dot(x, y);
|
|
x = normalize(x);
|
|
return x;
|
|
}
|
|
|
|
float2 vector(float2 x, float2 y) {
|
|
x = length(x).xx;
|
|
x = distance(x, y).xx;
|
|
x = dot(x, y).xx;
|
|
x = normalize(x);
|
|
return x;
|
|
}
|
|
|
|
void main() {
|
|
float x = scalar(1, 2);
|
|
float2 y = vector(float2(1, 2), float2(3, 4));
|
|
sk_FragColor = half4(half(x), half2(y), 1);
|
|
}
|