Expand Minimize

DispatchIndirect routine

The DispatchIndirect function executes the compute shader.

Syntax


PFND3D11DDI_DISPATCHINDIRECT DispatchIndirect;

VOID APIENTRY DispatchIndirect(
  _In_  D3D10DDI_HDEVICE hDevice,
  _In_  D3D10DDI_HRESOURCE hBufferForArgs,
  _In_  UINT AlignedByteOffsetForArgs
)
{ ... }

Parameters

hDevice [in]

A handle to the display device (graphics context).

hBufferForArgs [in]

A handle to a buffer that contains three UINT values that hold the sizes, in thread groups, of the X, Y, and Z dimensions of the thread-group grid. The buffer contains the following tightly packed structure:


struct DispatchArgs {
  UINT ThreadGroupCountX; 
  UINT ThreadGroupCountY;
  UINT ThreadGroupCountZ;
}

AlignedByteOffsetForArgs [in]

The offset, in bytes, into the buffer that hBufferForArgs specifies. AlignedByteOffsetForArgs must be a multiple of 4.

Return value

None

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.

Remarks

The DispatchIndirect function performs the same task as the call to the driver's Dispatch function. The Direct3D runtime calls the driver's DispatchIndirect function on the display device to execute the compute shader over a number of threads in a grid of thread groups. However, DispatchIndirect obtains the number of thread groups to execute from the contents of the buffer that the hBufferForArgs parameter specifies. DispatchIndirect reads three UINT values, starting at the byte offset that the AlignedByteOffsetForArgs parameter specifies.

When the Direct3D runtime calls the driver's CreateResource(D3D11) function to create the buffer resource that the hBufferForArgs parameter specifies, the runtime must set the D3D11_DDI_RESOURCE_MISC_DRAWINDIRECT_ARGS flag in the MiscFlags member of the D3D11DDIARG_CREATERESOURCE structure.

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 DispatchIndirect (which typically should not happen), the driver can return D3DDDIERR_DEVICEREMOVED.

Requirements

Version

DispatchIndirect is supported beginning with the Windows 7 operating system.

Header

D3d10umddi.h (include D3d10umddi.h)

See also

CreateResource(D3D11)
D3D11DDI_DEVICEFUNCS
D3D11DDIARG_CREATERESOURCE
Dispatch
pfnSetErrorCb

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft