SubgroupFunctionNode

Last modified: Mar 5, 2026

This class represents a set of built in WGSL shader functions that sync synchronously execute an operation across a subgroup, or ‘warp’, of compute or fragment shader invocations within a workgroup. Typically, these functions will synchronously execute an operation using data from all active invocations within the subgroup, then broadcast that result to all active invocations. In other graphics APIs, subgroup functions are also referred to as wave intrinsics (DirectX/HLSL) or warp intrinsics (CUDA).

Constructor

new SubgroupFunctionNode(method, aNode?, bNode?)
ParameterTypeDefault Value
methodstring
aNode?Nodenull
bNode?Nodenull

Constructs a new function node.

AccessorType

Properties

PropertyTypeDefault Value
methodstring
aNodeNode
bNodeNode
MethodType

Extends

TempNode

subgroupElect

Returns true if this invocation has the lowest subgroup_invocation_id among active invocations in the subgroup.

Returns

bool

subgroupBallot

Returns a set of bitfields where the bit corresponding to subgroup_invocation_id is 1 if pred is true for that active invocation and 0 otherwise.

ParameterTypeDefault Value
predbool

Returns

vec4<u32>

subgroupAdd

A reduction that adds e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupInclusiveAdd

An inclusive scan returning the sum of e for all active invocations with subgroup_invocation_id less than or equal to this invocation.

ParameterTypeDefault Value
enumber

Returns

number

subgroupExclusiveAdd

An exclusive scan that returns the sum of e for all active invocations with subgroup_invocation_id less than this invocation.

ParameterTypeDefault Value
enumber

Returns

number

subgroupMul

A reduction that multiplies e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupInclusiveMul

An inclusive scan returning the product of e for all active invocations with subgroup_invocation_id less than or equal to this invocation.

ParameterTypeDefault Value
enumber

Returns

number

subgroupExclusiveMul

An exclusive scan that returns the product of e for all active invocations with subgroup_invocation_id less than this invocation.

ParameterTypeDefault Value
enumber

Returns

number

subgroupAnd

A reduction that performs a bitwise and of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupOr

A reduction that performs a bitwise or of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupXor

A reduction that performs a bitwise xor of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupMin

A reduction that performs a min of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupMax

A reduction that performs a max of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupAll

Returns true if e is true for all active invocations in the subgroup.

Returns

bool

subgroupAny

Returns true if e is true for any active invocation in the subgroup

Returns

bool

subgroupBroadcastFirst

Broadcasts e from the active invocation with the lowest subgroup_invocation_id in the subgroup to all other active invocations.

ParameterTypeDefault Value
enumber
idnumber

Returns

number

quadSwapX

Swaps e between invocations in the quad in the X direction.

ParameterTypeDefault Value
enumber

Returns

number

quadSwapY

Swaps e between invocations in the quad in the Y direction.

ParameterTypeDefault Value
enumber

Returns

number

quadSwapDiagonal

Swaps e between invocations in the quad diagonally.

ParameterTypeDefault Value
enumber

Returns

number

subgroupBroadcast

Broadcasts e from the invocation whose subgroup_invocation_id matches id, to all active invocations.

ParameterTypeDefault Value
enumber
idnumber

Returns

number

subgroupShuffle

Returns v from the active invocation whose subgroup_invocation_id matches id

ParameterTypeDefault Value
vnumber
idnumber

Returns

number

subgroupShuffleXor

Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id ^ mask.

ParameterTypeDefault Value
vnumber
masknumber

Returns

number

subgroupShuffleUp

Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id - delta

ParameterTypeDefault Value
vnumber
deltanumber

Returns

number

subgroupShuffleDown

Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id + delta

ParameterTypeDefault Value
vnumber
deltanumber

Returns

number

quadBroadcast

Broadcasts e from the quad invocation with id equal to id.

ParameterTypeDefault Value
enumber

Returns

number