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 uint4* prevent_dce; |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 6 | texture2d<uint, 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 | uint4 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 | uint4 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 | uint4 textureGather_8fae00(tint_module_vars_struct tint_module_vars) { |
| 21 | float2 arg_3 = float2(1.0f); |
| 22 | uint4 res = tint_module_vars.arg_1.gather(tint_module_vars.arg_2, arg_3, int2(0), component::y); |
| 23 | return res; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 24 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 25 | |
James Price | 812c9d0 | 2024-06-29 21:54:00 +0000 | [diff] [blame] | 26 | fragment void fragment_main(device uint4* prevent_dce [[buffer(0)]], texture2d<uint, access::sample> arg_1 [[texture(0)]], sampler arg_2 [[sampler(0)]]) { |
| 27 | 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] | 28 | (*tint_module_vars.prevent_dce) = textureGather_8fae00(tint_module_vars); |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 29 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 30 | |
James Price | 812c9d0 | 2024-06-29 21:54:00 +0000 | [diff] [blame] | 31 | kernel void compute_main(device uint4* prevent_dce [[buffer(0)]], texture2d<uint, access::sample> arg_1 [[texture(0)]], sampler arg_2 [[sampler(0)]]) { |
| 32 | 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] | 33 | (*tint_module_vars.prevent_dce) = textureGather_8fae00(tint_module_vars); |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 34 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 35 | |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 36 | VertexOutput vertex_main_inner(tint_module_vars_struct tint_module_vars) { |
| 37 | VertexOutput out = {}; |
| 38 | out.pos = float4(0.0f); |
| 39 | out.prevent_dce = textureGather_8fae00(tint_module_vars); |
| 40 | return out; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 41 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 42 | |
James Price | 3efa5b1 | 2024-06-18 15:23:55 +0000 | [diff] [blame] | 43 | vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_1 [[texture(0)]], sampler arg_2 [[sampler(0)]]) { |
| 44 | tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_1=arg_1, .arg_2=arg_2}; |
| 45 | VertexOutput const v = vertex_main_inner(tint_module_vars); |
James Price | 6d87fa6 | 2024-09-03 23:24:13 +0000 | [diff] [blame] | 46 | vertex_main_outputs tint_wrapper_result = {}; |
| 47 | tint_wrapper_result.VertexOutput_pos = v.pos; |
| 48 | tint_wrapper_result.VertexOutput_prevent_dce = v.prevent_dce; |
| 49 | return tint_wrapper_result; |
dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 50 | } |