Returns a 4-bit unsigned integer bitmask of the evaluation of the Boolean expression for all active lanes in the specified wave.
uint4 WaveBallot( bool expr );
The boolean expression to evaluate.
A uint4 containing a bitmask of the evaluation of the Boolean expression for all active lanes in the current wave. The least-significant bit corresponds to the lane with index zero. The bits corresponding to inactive lanes will be zero. The bits that are greater than or equal to WaveGetLaneCount will be zero.
Different GPUs have different SIMD processor widths (lane counts). Most of these WaveXXX functions are able to operate at level of abstraction where SIMD machine width is concealed. To maximize portability of code across GPUs, use the intrinsics that don’t rely on machine width. For example, use:
uint result = WaveAllCountBits( bBit );
uint result = countbits( WaveBallot( bBit ) );
This function is supported from shader model 6.0, in the following types of shaders:
// get a bitwise representation of the number of currently active lanes: uint4 waveBits = WaveActiveBallot( true ); // convert to bits