ID3D11ComputeContextX::Dispatch Method

Execute a command list from a thread group.

Syntax

public:
void Dispatch(
         UINT ThreadGroupCountX,
         UINT ThreadGroupCountY,
         UINT ThreadGroupCountZ
)  

Parameters

ThreadGroupCountX
Type: UINT 

[in] The number of groups dispatched in the x direction. ThreadGroupCountX must be less than or equal to D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION (65535).

ThreadGroupCountY
Type: UINT 

[in] The number of groups dispatched in the y direction. ThreadGroupCountY must be less than or equal to D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION (65535).

ThreadGroupCountZ
Type: UINT 

[in] The number of groups dispatched in the z direction. ThreadGroupCountZ must be less than or equal to D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION (65535). In feature level 10 the value for ThreadGroupCountZ must be 1.

Return value

None.

Remarks

You call Dispatch to execute commands in a compute shader. A compute shader can be run on many threads in parallel, within a thread group. Index a particular thread, within a thread group using a 3D vector given by (x,y,z).

In the following illustration, assume a thread group with 50 threads where the size of the group is given by (5,5,2). A single thread is identified from a thread group with 50 threads in it, using the vector (4,1,1).

Figure 1.  Illustration of a single thread within a thread group of 50 threads

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).

Figure 2.  Illustration of the relationship between Dispatch, thread groups, and threads

Requirements

Header: Declared in d3d11_x.h.

Library: Use d3d11_x.lib.

See also

Reference

ID3D11ComputeContextX Interface

ID3D11ComputeContextX Members