The SetScissorRects function marks portions of render targets that rendering is confined to.



VOID APIENTRY SetScissorRects(
  _In_       D3D10DDI_HDEVICE hDevice,
  _In_       UINT             NumScissorRects,
  _In_       UINT             ClearScissorRects,
  _In_ const D3D10_DDI_RECT   *pRects
{ ... }


hDevice [in]

A handle to the display device (graphics context).

NumScissorRects [in]

The total number of render-target portions that the pRects parameter specifies.

ClearScissorRects [in]

The number of render-target portions after the number of render-target portions that NumScissorRects specifies to be set to NULL. This number represents the difference between the previous number of render-target portions (that is, when the Microsoft Direct3D runtime previously called SetScissorRects) and the new number of render-target portions.

Note that the number that ClearScissorRects specifies is only an optimization aid because the user-mode display driver could calculate this number.

pRects [in]

An array of RECT structures for the render-target portions to mark.

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 D3D10_DDI_RECT structure is defined as a RECT structure.

typedef RECT D3D10_DDI_RECT;

The user-mode display driver must set all render-target portions atomically as one operation.

Although the NumScissorRects parameter specifies the number of render-target portions in the array that the pRects parameter specifies, some values in the array can be NULL.

The range of render-target portions between the number that NumScissorRects specifies and the maximum number of render-target portions that are allowed is required to contain all NULL or unbound values. The number that the ClearScissorRects parameter specifies informs the driver about how many render-target portions the driver must clear out for the current atomic operation.

If the previous call to SetScissorRects passed a value of 2 in the NumScissorRects parameter and the current call to SetScissorRects passes a value of 4 in NumScissorRects, the current call to SetScissorRects also passes a value of 0 in the ClearScissorRects parameter. If the next successive call to SetScissorRects passes a value of 1 in NumScissorRects, the successive call also passes a value of 3 (4 - 1) in ClearScissorRects.

When the value of clear render-target portions is requested during user-mode query operations, the value is the difference between the maximum number of render-target portions and the render-target portions value.

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 Microsoft 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 SetScissorRects (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