WaveActiveSum function

Sums up the value of the expression across all active lanes in the current wave and replicates it to all lanes in the current wave.

Syntax

<type> WaveActiveSum(
   <type> expr
);

Parameters

expr

The expression to evaluate.

Return value

The sum value.

Remarks

The order of operations is undefined.

This function is supported from shader model 6.0 in all shader stages.

 

Examples

float3 total = WaveActiveSum( position ); // sum positions in wave
float3 center = total/count;           // compute average of these positions

See also

Overview of Shader Model 6

Shader Model 6