Export (0) Print
Expand All
Expand Minimize

Dispatch routine

The Dispatch function executes the compute shader.



  _In_ D3D10DDI_HDEVICE hDevice,
  _In_ UINT             ThreadGroupCountX,
  _In_ UINT             ThreadGroupCountY,
  _In_ UINT             ThreadGroupCountZ
{ ... }


hDevice [in]

A handle to the display device (graphics context).

ThreadGroupCountX [in]

The size, in thread groups, of the x-dimension of the thread-group grid. The maximum size is 65535.

ThreadGroupCountY [in]

The size, in thread groups, of the y-dimension of the thread-group grid. The maximum size is 65535.

ThreadGroupCountZ [in]

The size, in thread groups, of the z-dimension of the thread-group grid. The maximum size is 65535.

Return value


The driver can use the pfnSetErrorCb callback function to set an error code. For more information about setting error codes, see the following Remarks section.


The Direct3D runtime calls the driver's Dispatch function on the display device to execute the compute shader. A compiled compute shader defines the set of instructions to execute per thread and the number of threads to run per group. The thread-group parameters (ThreadGroupCountX, ThreadGroupCountY, and ThreadGroupCountZ) indicate how many thread groups to execute. Each thread group contains the same number of threads, as defined by the compiled compute shader. The thread groups are organized in a three-dimensional grid. The total number of thread groups that the compiled compute shader executes is determined by the following calculation:

ThreadGroupCountX * ThreadGroupCountY * ThreadGroupCountZ

In particular, if any of the values in the thread-group parameters are 0, the Dispatch function does nothing.

The driver should not encounter any error, except for D3DDDIERR_DEVICEREMOVED. Therefore, if the driver passes any error, except for D3DDDIERR_DEVICEREMOVED, in a call to the pfnSetErrorCb function, the Direct3D runtime determines that the error is critical. Even if the device is removed, the driver is not required to return D3DDDIERR_DEVICEREMOVED; however, if device removal interferes with the operation of Dispatch (which typically should not happen), the driver can return D3DDDIERR_DEVICEREMOVED.


Target platform



Dispatch is supported beginning with the Windows 7 operating system.


D3d10umddi.h (include D3d10umddi.h)

See also




Send comments about this topic to Microsoft

© 2015 Microsoft