ID3D11DeviceContext::Dispatch Method
Execute a command list from a thread group.
Syntax
void Dispatch(
[in] UINT ThreadGroupCountX,
[in] UINT ThreadGroupCountY,
[in] UINT ThreadGroupCountZ
);
Parameters
ThreadGroupCountX [in]
UINT
The number of groups dispatched in the x direction. ThreadGroupCountX must be less than 64k.
ThreadGroupCountY [in]
UINT
The number of groups dispatched in the y direction. ThreadGroupCountY must be less than 64k.
ThreadGroupCountZ [in]
UINT
The number of groups dispatched in the z direction. ThreadGroupCountZ must be less than 64k. In feature level 10 the value for ThreadGroupCountZ must be 1.
Return Value
void
Returns nothing.
Remarks
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).
文章来源:https://uudwc.com/A/2YGx6
Illustration of a single thread within a thread group of 50 threads
The following illustration shows the relationship between the parameters passed to ID3D11DeviceContext::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文章来源地址https://uudwc.com/A/2YGx6