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 half4* 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 | half4 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 | half4 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 | half4 abs_538d29() { |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 19 | half4 res = half4(1.0h); |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 20 | return res; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 21 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 22 | |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 23 | fragment void fragment_main(device half4* 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) = abs_538d29(); |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 26 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 27 | |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 28 | kernel void compute_main(device half4* prevent_dce [[buffer(0)]]) { |
| 29 | 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] | 30 | (*tint_module_vars.prevent_dce) = abs_538d29(); |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 31 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 32 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 33 | VertexOutput vertex_main_inner() { |
| 34 | VertexOutput out = {}; |
| 35 | out.pos = float4(0.0f); |
| 36 | out.prevent_dce = abs_538d29(); |
| 37 | return out; |
| 38 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 39 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 40 | vertex vertex_main_outputs vertex_main() { |
| 41 | VertexOutput const v = vertex_main_inner(); |
James Price | 6d87fa6 | 2024-09-03 23:24:13 +0000 | [diff] [blame] | 42 | vertex_main_outputs tint_wrapper_result = {}; |
| 43 | tint_wrapper_result.VertexOutput_pos = v.pos; |
| 44 | tint_wrapper_result.VertexOutput_prevent_dce = v.prevent_dce; |
| 45 | return tint_wrapper_result; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 46 | } |