blob: d9eba77a7976116cbd3b49fb5d9192a79fc8e59c [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
struct tint_private_vars_struct {
uint4 tint_subgroup_size_mask;
};
uint4 tint_msl_subgroup_ballot(bool pred, thread tint_private_vars_struct* const tint_private_vars) {
uint4 const tint_symbol = uint4(as_type<uint2>((ulong)simd_ballot(pred)), 0u, 0u);
return (tint_symbol & (*(tint_private_vars)).tint_subgroup_size_mask);
}
uint4 subgroupBallot_1a8251(thread tint_private_vars_struct* const tint_private_vars) {
bool arg_0 = true;
uint4 res = tint_msl_subgroup_ballot(arg_0, tint_private_vars);
return res;
}
fragment void fragment_main(device uint4* tint_symbol_1 [[buffer(0)]], uint tint_subgroup_size [[threads_per_simdgroup]]) {
thread tint_private_vars_struct tint_private_vars = {};
{
bool const gt = (tint_subgroup_size > 32u);
tint_private_vars.tint_subgroup_size_mask[0u] = select((4294967295u >> (32u - tint_subgroup_size)), 4294967295u, gt);
tint_private_vars.tint_subgroup_size_mask[1u] = select(0u, (4294967295u >> (64u - tint_subgroup_size)), gt);
}
*(tint_symbol_1) = subgroupBallot_1a8251(&(tint_private_vars));
return;
}
kernel void compute_main(device uint4* tint_symbol_2 [[buffer(0)]], uint tint_subgroup_size_1 [[threads_per_simdgroup]]) {
thread tint_private_vars_struct tint_private_vars = {};
{
bool const gt = (tint_subgroup_size_1 > 32u);
tint_private_vars.tint_subgroup_size_mask[0u] = select((4294967295u >> (32u - tint_subgroup_size_1)), 4294967295u, gt);
tint_private_vars.tint_subgroup_size_mask[1u] = select(0u, (4294967295u >> (64u - tint_subgroup_size_1)), gt);
}
*(tint_symbol_2) = subgroupBallot_1a8251(&(tint_private_vars));
return;
}