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 half2* prevent_dce; |
| 5 | }; |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame^] | 6 | struct VertexOutput { |
| 7 | float4 pos; |
| 8 | half2 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 | half2 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 | half2 smoothstep_12c031() { |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 16 | half2 arg_0 = half2(2.0h); |
| 17 | half2 arg_1 = half2(4.0h); |
| 18 | half2 arg_2 = half2(3.0h); |
| 19 | half2 res = smoothstep(arg_0, arg_1, arg_2); |
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 | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 22 | fragment void fragment_main(device half2* prevent_dce [[buffer(0)]]) { |
| 23 | 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^] | 24 | (*tint_module_vars.prevent_dce) = smoothstep_12c031(); |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 25 | } |
James Price | 085093d | 2024-06-06 02:09:47 +0000 | [diff] [blame] | 26 | kernel void compute_main(device half2* prevent_dce [[buffer(0)]]) { |
| 27 | 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^] | 28 | (*tint_module_vars.prevent_dce) = smoothstep_12c031(); |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 29 | } |
James Price | 2cc6b3c | 2024-06-13 20:31:41 +0000 | [diff] [blame^] | 30 | VertexOutput vertex_main_inner() { |
| 31 | VertexOutput out = {}; |
| 32 | out.pos = float4(0.0f); |
| 33 | out.prevent_dce = smoothstep_12c031(); |
| 34 | return out; |
| 35 | } |
| 36 | vertex vertex_main_outputs vertex_main() { |
| 37 | VertexOutput const v = vertex_main_inner(); |
| 38 | 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] | 39 | } |