PFND3D10DDI_SETPREDICATION callback function

The SetPredication function specifies whether rendering and resource-manipulation commands that follow are actually performed.



VOID APIENTRY SetPredication(
  _In_ D3D10DDI_HDEVICE hDevice,
  _In_ D3D10DDI_HQUERY  hQuery,
  _In_ BOOL             PredicateValue
{ ... }


hDevice [in]

A handle to the display device (graphics context).

hQuery [in]

A handle to the query object to set as a predicate. Setting hQuery to NULL indicates "no predication". If hQuery is set to NULL, the driver ignores the value in the PredicateValue parameter; however, the driver should store the predicate value for subsequent requests for the value.

PredicateValue [in]

A Boolean value to compare with query data. If the query data is equal to the predicate value, the following rendering and resource manipulation commands are not performed.

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.


Some predicates are only hints; therefore, they might not actually prevent operations from being performed. The Microsoft Direct3D runtime primarily calls SetPredication to let applications issue graphics commands without taking the performance hit of spinning and waiting for a call to the QueryGetData function to return. Therefore, predication can occur even if QueryGetData returns S_FALSE. In other words, an application can also use predication as a fallback if QueryGetData possibly returns S_FALSE. If QueryGetData returns S_OK, the application can skip calling the graphics commands manually with its own application logic.

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 will determine that the error is critical. Even if the device was removed, the driver is not required to return D3DDDIERR_DEVICEREMOVED; however, if device removal interfered with the operation of SetPredication (which typically should not happen), the driver can return D3DDDIERR_DEVICEREMOVED.


Target platform



Available in Windows Vista and later versions of the Windows operating systems.


D3d10umddi.h (include D3d10umddi.h)

See also




Send comments about this topic to Microsoft