James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 1 | #include <metal_stdlib> |
| 2 | using namespace metal; |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 3 | |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 4 | struct tint_module_vars_struct { |
| 5 | device float2* prevent_dce; |
| 6 | }; |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 7 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 8 | struct VertexOutput { |
| 9 | float4 pos; |
| 10 | float2 prevent_dce; |
| 11 | }; |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 12 | |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 13 | struct vertex_main_outputs { |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 14 | float4 VertexOutput_pos [[position]]; |
| 15 | float2 VertexOutput_prevent_dce [[user(locn0)]] [[flat]]; |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 16 | }; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 17 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 18 | float2 acos_dfc915() { |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 19 | float2 arg_0 = float2(0.96891242265701293945f); |
| 20 | float2 res = acos(arg_0); |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 21 | return res; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 22 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 23 | |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 24 | fragment void fragment_main(device float2* prevent_dce [[buffer(0)]]) { |
| 25 | tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce}; |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 26 | (*tint_module_vars.prevent_dce) = acos_dfc915(); |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 27 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 28 | |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 29 | kernel void compute_main(device float2* prevent_dce [[buffer(0)]]) { |
| 30 | tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce}; |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 31 | (*tint_module_vars.prevent_dce) = acos_dfc915(); |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 32 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 33 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 34 | VertexOutput vertex_main_inner() { |
| 35 | VertexOutput out = {}; |
| 36 | out.pos = float4(0.0f); |
| 37 | out.prevent_dce = acos_dfc915(); |
| 38 | return out; |
| 39 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 40 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 41 | vertex vertex_main_outputs vertex_main() { |
| 42 | VertexOutput const v = vertex_main_inner(); |
James Price | 6d87fa6 | 2024-09-03 23:24:13 +0000 | [diff] [blame] | 43 | vertex_main_outputs tint_wrapper_result = {}; |
| 44 | tint_wrapper_result.VertexOutput_pos = v.pos; |
| 45 | tint_wrapper_result.VertexOutput_prevent_dce = v.prevent_dce; |
| 46 | return tint_wrapper_result; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 47 | } |