SPIR-V Built-In

NumWorkgroups

Number of workgroups in a dispatch
NumWorkgroups

Decorating a variable with the NumWorkgroups built-in decoration will make that variable contain the number of local workgroups that are part of the dispatch that the invocation belongs to. Each component is equal to the values of the workgroup count parameters passed into the dispatching commands.

Valid Usage

VUID-NumWorkgroups-NumWorkgroups-04296

The NumWorkgroups decoration must be used only within the GLCompute, MeshEXT, or TaskEXT Execution Model

VUID-NumWorkgroups-NumWorkgroups-04297

The variable decorated with NumWorkgroups must be declared using the Input Storage Class

VUID-NumWorkgroups-NumWorkgroups-04298

The variable decorated with NumWorkgroups must be declared as a three-component vector of 32-bit integer values