dan sinclair | 8f1d276 | 2024-07-31 02:35:40 +0000 | [diff] [blame] | 1 | struct S { |
| 2 | int a; |
| 3 | int b; |
| 4 | }; |
dan sinclair | 6931379 | 2024-06-13 20:35:21 +0000 | [diff] [blame] | 5 | |
dan sinclair | 8f1d276 | 2024-07-31 02:35:40 +0000 | [diff] [blame] | 6 | struct main_inputs { |
| 7 | uint tint_local_index : SV_GroupIndex; |
| 8 | }; |
| 9 | |
| 10 | |
| 11 | RWByteAddressBuffer s : register(u0); |
| 12 | groupshared int g1; |
| 13 | int accept_value(int val) { |
| 14 | return val; |
| 15 | } |
| 16 | |
| 17 | int accept_ptr_deref_call_func(inout int val) { |
| 18 | int v = val; |
| 19 | return (v + accept_value(val)); |
| 20 | } |
| 21 | |
| 22 | int accept_ptr_deref_pass_through(inout int val) { |
| 23 | int v_1 = val; |
| 24 | return (v_1 + accept_ptr_deref_call_func(val)); |
| 25 | } |
| 26 | |
| 27 | int accept_ptr_to_struct_and_access(inout S val) { |
| 28 | return (val.a + val.b); |
| 29 | } |
| 30 | |
| 31 | int accept_ptr_to_struct_access_pass_ptr(inout S val) { |
| 32 | int b = val.a; |
| 33 | b = 2; |
| 34 | return b; |
| 35 | } |
| 36 | |
| 37 | int tint_f32_to_i32(float value) { |
| 38 | return (((value <= 2147483520.0f)) ? ((((value >= -2147483648.0f)) ? (int(value)) : (-2147483648))) : (2147483647)); |
| 39 | } |
| 40 | |
| 41 | int accept_ptr_vec_access_elements(inout float3 v1) { |
| 42 | v1[0u] = cross(v1, v1)[0u]; |
| 43 | return tint_f32_to_i32(v1.x); |
| 44 | } |
| 45 | |
| 46 | int call_builtin_with_mod_scope_ptr() { |
| 47 | int v_2 = 0; |
| 48 | InterlockedOr(g1, 0, v_2); |
| 49 | return v_2; |
| 50 | } |
| 51 | |
| 52 | void main_inner(uint tint_local_index) { |
| 53 | if ((tint_local_index == 0u)) { |
| 54 | int v_3 = 0; |
| 55 | InterlockedExchange(g1, 0, v_3); |
| 56 | } |
| 57 | GroupMemoryBarrierWithGroupSync(); |
| 58 | int v1 = 0; |
| 59 | S v2 = (S)0; |
| 60 | S v3 = v2; |
| 61 | float3 v4 = (0.0f).xxx; |
| 62 | int v_4 = 0; |
| 63 | InterlockedOr(g1, 0, v_4); |
| 64 | int t1 = v_4; |
| 65 | int v_5 = accept_ptr_deref_pass_through(v1); |
| 66 | int v_6 = (v_5 + accept_ptr_to_struct_and_access(v2)); |
| 67 | int v_7 = (v_6 + accept_ptr_to_struct_and_access(v3)); |
| 68 | int v_8 = (v_7 + accept_ptr_vec_access_elements(v4)); |
| 69 | int v_9 = (v_8 + accept_ptr_to_struct_access_pass_ptr(v2)); |
| 70 | s.Store(0u, asuint(((v_9 + call_builtin_with_mod_scope_ptr()) + t1))); |
| 71 | } |
| 72 | |
| 73 | [numthreads(1, 1, 1)] |
| 74 | void main(main_inputs inputs) { |
| 75 | main_inner(inputs.tint_local_index); |
| 76 | } |
| 77 | |