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