dan sinclair | 892af22 | 2024-12-06 14:16:09 +0000 | [diff] [blame] | 1 | // |
| 2 | // fragment_main |
| 3 | // |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 4 | #include <metal_stdlib> |
| 5 | using namespace metal; |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 6 | |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 7 | struct tint_module_vars_struct { |
| 8 | device float* prevent_dce; |
| 9 | }; |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 10 | |
dan sinclair | 892af22 | 2024-12-06 14:16:09 +0000 | [diff] [blame] | 11 | float bitcast_23c8bd() { |
| 12 | half2 arg_0 = half2(1.0h); |
| 13 | float res = as_type<float>(arg_0); |
| 14 | return res; |
| 15 | } |
| 16 | |
| 17 | fragment void fragment_main(device float* prevent_dce [[buffer(0)]]) { |
| 18 | tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce}; |
| 19 | (*tint_module_vars.prevent_dce) = bitcast_23c8bd(); |
| 20 | } |
| 21 | // |
| 22 | // compute_main |
| 23 | // |
| 24 | #include <metal_stdlib> |
| 25 | using namespace metal; |
| 26 | |
| 27 | struct tint_module_vars_struct { |
| 28 | device float* prevent_dce; |
| 29 | }; |
| 30 | |
| 31 | float bitcast_23c8bd() { |
| 32 | half2 arg_0 = half2(1.0h); |
| 33 | float res = as_type<float>(arg_0); |
| 34 | return res; |
| 35 | } |
| 36 | |
| 37 | kernel void compute_main(device float* prevent_dce [[buffer(0)]]) { |
| 38 | tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce}; |
| 39 | (*tint_module_vars.prevent_dce) = bitcast_23c8bd(); |
| 40 | } |
| 41 | // |
| 42 | // vertex_main |
| 43 | // |
| 44 | #include <metal_stdlib> |
| 45 | using namespace metal; |
| 46 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 47 | struct VertexOutput { |
| 48 | float4 pos; |
| 49 | float prevent_dce; |
| 50 | }; |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 51 | |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 52 | struct vertex_main_outputs { |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 53 | float4 VertexOutput_pos [[position]]; |
| 54 | float VertexOutput_prevent_dce [[user(locn0)]] [[flat]]; |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 55 | }; |
James Price | a30f8dd | 2024-05-10 14:31:43 +0000 | [diff] [blame] | 56 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 57 | float bitcast_23c8bd() { |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 58 | half2 arg_0 = half2(1.0h); |
| 59 | float res = as_type<float>(arg_0); |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 60 | return res; |
James Price | a30f8dd | 2024-05-10 14:31:43 +0000 | [diff] [blame] | 61 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 62 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 63 | VertexOutput vertex_main_inner() { |
| 64 | VertexOutput out = {}; |
| 65 | out.pos = float4(0.0f); |
| 66 | out.prevent_dce = bitcast_23c8bd(); |
| 67 | return out; |
| 68 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 69 | |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame] | 70 | vertex vertex_main_outputs vertex_main() { |
| 71 | VertexOutput const v = vertex_main_inner(); |
James Price | 6d87fa6 | 2024-09-03 23:24:13 +0000 | [diff] [blame] | 72 | vertex_main_outputs tint_wrapper_result = {}; |
| 73 | tint_wrapper_result.VertexOutput_pos = v.pos; |
| 74 | tint_wrapper_result.VertexOutput_prevent_dce = v.prevent_dce; |
| 75 | return tint_wrapper_result; |
James Price | a30f8dd | 2024-05-10 14:31:43 +0000 | [diff] [blame] | 76 | } |