SV_DispatchThreadID

Indices for which combined thread and thread group a compute shader is executing in. SV_DispatchThreadID is the sum of SV_GroupID * numthreads and GroupThreadID. It varies across the range specified in Dispatch and numthreads. For example if Dispatch(2,2,2) is called on a compute shader with numthreads(3,3,3) SV_DispatchThreadID will have a range of 0..5 for each dimension.

Type

Type
uint3

 

Remarks

This system value is optional.

The following illustration shows the relationship between the parameters passed to Dispatch, Dispatch(5,3,2), the values specified in the numthreads attribute, numthreads(10,8,3), and values that will passed to the compute shader for the thread-related system values (SV_GroupIndex,SV_DispatchThreadID,SV_GroupThreadID,SV_GroupID).

illustration of the relationship between dispatch, thread groups, and threads

This function is supported in the following types of shaders:

Vertex Hull Domain Geometry Pixel Compute
x

 

See also

Semantics

Shader Model 5