Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 1 | #include <metal_stdlib> |
| 2 | |
| 3 | using namespace metal; |
| 4 | |
Ben Clayton | ed998e9 | 2022-11-23 19:57:00 +0000 | [diff] [blame] | 5 | struct modf_result_f32 { |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 6 | float fract; |
| 7 | float whole; |
| 8 | }; |
Ben Clayton | ed998e9 | 2022-11-23 19:57:00 +0000 | [diff] [blame] | 9 | modf_result_f32 tint_modf(float param_0) { |
| 10 | modf_result_f32 result; |
Zhaoming Jiang | 20cddbf | 2022-08-05 15:11:44 +0000 | [diff] [blame] | 11 | result.fract = modf(param_0, result.whole); |
| 12 | return result; |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 13 | } |
| 14 | |
Zhaoming Jiang | 20cddbf | 2022-08-05 15:11:44 +0000 | [diff] [blame] | 15 | void modf_bbf7f7() { |
Ben Clayton | 329dfd7 | 2022-11-23 00:05:05 +0000 | [diff] [blame] | 16 | float arg_0 = -1.5f; |
Ben Clayton | ed998e9 | 2022-11-23 19:57:00 +0000 | [diff] [blame] | 17 | modf_result_f32 res = tint_modf(arg_0); |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | struct tint_symbol { |
| 21 | float4 value [[position]]; |
| 22 | }; |
| 23 | |
| 24 | float4 vertex_main_inner() { |
Zhaoming Jiang | 20cddbf | 2022-08-05 15:11:44 +0000 | [diff] [blame] | 25 | modf_bbf7f7(); |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 26 | return float4(0.0f); |
| 27 | } |
| 28 | |
| 29 | vertex tint_symbol vertex_main() { |
| 30 | float4 const inner_result = vertex_main_inner(); |
| 31 | tint_symbol wrapper_result = {}; |
| 32 | wrapper_result.value = inner_result; |
| 33 | return wrapper_result; |
| 34 | } |
| 35 | |
| 36 | fragment void fragment_main() { |
Zhaoming Jiang | 20cddbf | 2022-08-05 15:11:44 +0000 | [diff] [blame] | 37 | modf_bbf7f7(); |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 38 | return; |
| 39 | } |
| 40 | |
| 41 | kernel void compute_main() { |
Zhaoming Jiang | 20cddbf | 2022-08-05 15:11:44 +0000 | [diff] [blame] | 42 | modf_bbf7f7(); |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 43 | return; |
| 44 | } |
| 45 | |