mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 17:01:15 +01:00
41 lines
1019 B
Plaintext
41 lines
1019 B
Plaintext
// language: metal1.1
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
constant metal::float4 v_f32_one = {1.0, 1.0, 1.0, 1.0};
|
|
constant metal::float4 v_f32_zero = {0.0, 0.0, 0.0, 0.0};
|
|
constant metal::float4 v_f32_half = {0.5, 0.5, 0.5, 0.5};
|
|
|
|
metal::float4 builtins(
|
|
) {
|
|
int s1_ = true ? 1 : 0;
|
|
metal::float4 s2_ = true ? v_f32_one : v_f32_zero;
|
|
metal::float4 m1_ = metal::mix(v_f32_zero, v_f32_one, v_f32_half);
|
|
metal::float4 m2_ = metal::mix(v_f32_zero, v_f32_one, 0.1);
|
|
return ((static_cast<float4>(metal::int4(s1_)) + s2_) + m1_) + m2_;
|
|
}
|
|
|
|
metal::float4 splat(
|
|
) {
|
|
metal::float2 a = ((metal::float2(1.0) + metal::float2(2.0)) - metal::float2(3.0)) / metal::float2(4.0);
|
|
metal::int4 b = metal::int4(5) % metal::int4(2);
|
|
return a.xyxy + static_cast<float4>(b);
|
|
}
|
|
|
|
int unary(
|
|
) {
|
|
if (!true) {
|
|
return 1;
|
|
} else {
|
|
return !1;
|
|
}
|
|
}
|
|
|
|
kernel void main1(
|
|
) {
|
|
metal::float4 _e3 = builtins();
|
|
metal::float4 _e4 = splat();
|
|
int _e5 = unary();
|
|
return;
|
|
}
|