James Price | 3efa5b1 | 2024-06-18 15:23:55 +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 | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 4 | struct tint_module_vars_struct { |
James Price | 812c9d0 | 2024-06-29 21:54:00 +0000 | [diff] [blame] | 5 | device float4* prevent_dce; |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 6 | texture2d_array<float, access::sample> arg_1; |
| 7 | sampler arg_2; |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 8 | }; |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 9 | |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 10 | struct VertexOutput { |
| 11 | float4 pos; |
| 12 | float4 prevent_dce; |
| 13 | }; |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 14 | |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 15 | struct vertex_main_outputs { |
| 16 | float4 VertexOutput_pos [[position]]; |
| 17 | float4 VertexOutput_prevent_dce [[user(locn0)]] [[flat]]; |
| 18 | }; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 19 | |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 20 | float4 textureGather_831549(tint_module_vars_struct tint_module_vars) { |
| 21 | float2 arg_3 = float2(1.0f); |
| 22 | int arg_4 = 1; |
Peter McNeeley | 4469c71 | 2024-08-15 15:35:44 +0000 | [diff] [blame] | 23 | float2 const v = arg_3; |
| 24 | float4 res = tint_module_vars.arg_1.gather(tint_module_vars.arg_2, v, max(arg_4, 0), int2(1), component::y); |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 25 | return res; |
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 | 812c9d0 | 2024-06-29 21:54:00 +0000 | [diff] [blame] | 28 | fragment void fragment_main(device float4* prevent_dce [[buffer(0)]], texture2d_array<float, access::sample> arg_1 [[texture(0)]], sampler arg_2 [[sampler(0)]]) { |
| 29 | tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .arg_1=arg_1, .arg_2=arg_2}; |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 30 | (*tint_module_vars.prevent_dce) = textureGather_831549(tint_module_vars); |
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 | 812c9d0 | 2024-06-29 21:54:00 +0000 | [diff] [blame] | 33 | kernel void compute_main(device float4* prevent_dce [[buffer(0)]], texture2d_array<float, access::sample> arg_1 [[texture(0)]], sampler arg_2 [[sampler(0)]]) { |
| 34 | tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .arg_1=arg_1, .arg_2=arg_2}; |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 35 | (*tint_module_vars.prevent_dce) = textureGather_831549(tint_module_vars); |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 36 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 37 | |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 38 | VertexOutput vertex_main_inner(tint_module_vars_struct tint_module_vars) { |
| 39 | VertexOutput out = {}; |
| 40 | out.pos = float4(0.0f); |
| 41 | out.prevent_dce = textureGather_831549(tint_module_vars); |
| 42 | return out; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 43 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 44 | |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 45 | vertex vertex_main_outputs vertex_main(texture2d_array<float, access::sample> arg_1 [[texture(0)]], sampler arg_2 [[sampler(0)]]) { |
| 46 | tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_1=arg_1, .arg_2=arg_2}; |
Peter McNeeley | 4469c71 | 2024-08-15 15:35:44 +0000 | [diff] [blame] | 47 | VertexOutput const v_1 = vertex_main_inner(tint_module_vars); |
James Price | 6d87fa6 | 2024-09-03 23:24:13 +0000 | [diff] [blame] | 48 | vertex_main_outputs tint_wrapper_result = {}; |
| 49 | tint_wrapper_result.VertexOutput_pos = v_1.pos; |
| 50 | tint_wrapper_result.VertexOutput_prevent_dce = v_1.prevent_dce; |
| 51 | return tint_wrapper_result; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 52 | } |