ID3D12GraphicsCommandList::DispatchX Method

Executes a command list from a thread group.

Syntax

public:
void DispatchX(
         UINT ThreadGroupCountX,
         UINT ThreadGroupCountY,
         UINT ThreadGroupCountZ,
         D3D12XBOX_DISPATCH_FLAGS Flags
)  

Parameters

ThreadGroupCountX
Type: UINT 

[in] The number of groups dispatched in the x dimension. Must be less than or equal to D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION (65535).

ThreadGroupCountY
Type: UINT 

[in] The number of groups dispatched in the y dimension. Must be less than or equal to D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION (65535).

ThreadGroupCountZ
Type: UINT 

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

Flags
Type: D3D12XBOX_DISPATCH_FLAGS 

[in] Flags to control this operation, as a bitwise-OR’d combination of D3D12XBOX_DISPATCH_FLAGS enumeration constants.

Return value

None.

Remarks

This method allows you to specify dispatch initiator parameters directly. When Ordered Append is used, the dispatch must have D3D12XBOX_DISPATCH_FLAG_ENABLE_ORDERED_APPEND set on it, otherwise, if the shader is using ordered append, the GPU will hang.

You call this method 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 (or DispatchX), 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, and SV_GroupID).

Figure 2.  The relationship between Dispatch (or DispatchX), thread groups, and threads

Requirements

Header: Declared in d3d12_x.h.

Library: Use d3d12_x.lib.

See also

Reference

Dispatch

ID3D12GraphicsCommandList Interface

ID3D12GraphicsCommandList Members