MSL: Simplify spvSubgroupBallot().

A bitcast to `uint2` will do just fine. I honestly don't know why I
didn't do it this way earlier.
This commit is contained in:
Chip Davis 2021-02-21 11:14:38 -06:00
parent 6196e3b029
commit 03ad13bae6
4 changed files with 4 additions and 6 deletions

View File

@ -55,7 +55,7 @@ inline uint4 spvSubgroupBallot(bool value)
// SPIR-V callers expect a uint4. We must convert.
// FIXME: This won't include higher bits if Apple ever supports
// 128 lanes in an SIMD-group.
return uint4((uint)((simd_vote::vote_t)vote & 0xFFFFFFFF), (uint)(((simd_vote::vote_t)vote >> 32) & 0xFFFFFFFF), 0, 0);
return uint4(as_type<uint2>((simd_vote::vote_t)vote), 0, 0);
}
inline bool spvSubgroupBallotBitExtract(uint4 ballot, uint bit)

View File

@ -55,7 +55,7 @@ inline uint4 spvSubgroupBallot(bool value)
// SPIR-V callers expect a uint4. We must convert.
// FIXME: This won't include higher bits if Apple ever supports
// 128 lanes in an SIMD-group.
return uint4((uint)((simd_vote::vote_t)vote & 0xFFFFFFFF), (uint)(((simd_vote::vote_t)vote >> 32) & 0xFFFFFFFF), 0, 0);
return uint4(as_type<uint2>((simd_vote::vote_t)vote), 0, 0);
}
inline bool spvSubgroupBallotBitExtract(uint4 ballot, uint bit)

View File

@ -53,7 +53,7 @@ inline uint4 spvSubgroupBallot(bool value)
// SPIR-V callers expect a uint4. We must convert.
// FIXME: This won't include higher bits if Apple ever supports
// 128 lanes in an SIMD-group.
return uint4((uint)((simd_vote::vote_t)vote & 0xFFFFFFFF), (uint)(((simd_vote::vote_t)vote >> 32) & 0xFFFFFFFF), 0, 0);
return uint4(as_type<uint2>((simd_vote::vote_t)vote), 0, 0);
}
inline bool spvSubgroupBallotBitExtract(uint4 ballot, uint bit)

View File

@ -5383,9 +5383,7 @@ void CompilerMSL::emit_custom_functions()
statement("// SPIR-V callers expect a uint4. We must convert.");
statement("// FIXME: This won't include higher bits if Apple ever supports");
statement("// 128 lanes in an SIMD-group.");
statement(
"return uint4((uint)((simd_vote::vote_t)vote & 0xFFFFFFFF), (uint)(((simd_vote::vote_t)vote >> "
"32) & 0xFFFFFFFF), 0, 0);");
statement("return uint4(as_type<uint2>((simd_vote::vote_t)vote), 0, 0);");
}
end_scope();
statement("");