Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Counts the number of boolean variables which evaluate to true across all active lanes in the current wave, and replicates the result to all lanes in the wave.
Syntax
uint WaveActiveCountBits(
bool bBit
);
Parameters
-
bBit
-
The boolean variables to evaluate. Providing an explicit true Boolean value returns the number of active lanes.
Return value
The number of lanes for which the boolean variable evaluates to true, across all active lanes in the current wave.
Remarks
This function is supported from shader model 6.0 in all shader stages.
Examples
Although these are all equivalent, WaveActiveCountBits is the most efficient way to achieve this:
// Use WaveActiveSum to count number of active lanes
uint result = WaveActiveSum(1);
// Use countbits and WaveActiveBallot to count number of active lanes
uint4 bits = countbits( WaveActiveBallot( true ) );
uint result = bits.x + bits.y + bits.z + bits.w;
// Use WaveActiveCountBits to count number of active lanes
uint result = WaveActiveCountBits(true);
See also