| #include <metal_stdlib> |
| using namespace metal; |
| |
| struct tint_module_vars_struct { |
| device uint4* prevent_dce; |
| thread uint2* tint_subgroup_size_mask; |
| }; |
| |
| uint4 tint_subgroup_ballot(bool pred, tint_module_vars_struct tint_module_vars) { |
| uint2 const v = as_type<uint2>((simd_vote::vote_t)simd_ballot(pred)); |
| return uint4((v & (*tint_module_vars.tint_subgroup_size_mask)), 0u, 0u); |
| } |
| |
| uint4 subgroupBallot_1a8251(tint_module_vars_struct tint_module_vars) { |
| uint4 res = tint_subgroup_ballot(true, tint_module_vars); |
| return res; |
| } |
| |
| fragment void fragment_main(uint tint_subgroup_size [[threads_per_simdgroup]], device uint4* prevent_dce [[buffer(0)]]) { |
| thread uint2 tint_subgroup_size_mask = 0u; |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .tint_subgroup_size_mask=(&tint_subgroup_size_mask)}; |
| (*tint_module_vars.tint_subgroup_size_mask).x = select((4294967295u >> (32u - tint_subgroup_size)), 4294967295u, (tint_subgroup_size > 32u)); |
| (*tint_module_vars.tint_subgroup_size_mask).y = select(0u, (4294967295u >> (64u - tint_subgroup_size)), (tint_subgroup_size > 32u)); |
| (*tint_module_vars.prevent_dce) = subgroupBallot_1a8251(tint_module_vars); |
| } |
| |
| kernel void compute_main(uint tint_subgroup_size [[threads_per_simdgroup]], device uint4* prevent_dce [[buffer(0)]]) { |
| thread uint2 tint_subgroup_size_mask = 0u; |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .tint_subgroup_size_mask=(&tint_subgroup_size_mask)}; |
| (*tint_module_vars.tint_subgroup_size_mask).x = select((4294967295u >> (32u - tint_subgroup_size)), 4294967295u, (tint_subgroup_size > 32u)); |
| (*tint_module_vars.tint_subgroup_size_mask).y = select(0u, (4294967295u >> (64u - tint_subgroup_size)), (tint_subgroup_size > 32u)); |
| (*tint_module_vars.prevent_dce) = subgroupBallot_1a8251(tint_module_vars); |
| } |