Export (0) Print
Expand All
3 out of 5 rated this helpful - Rate this topic

Scissor Test (Direct3D 9)

The scissor test culls pixels that are outside of the scissor rectangle, a user-defined rectangular sub-section of the render target.

The scissor rectangle could be used to indicate the area of the render target where the game world is drawn. The area outside the rectangle is culled and could be devoted to a game's GUI. The scissor test cannot cull non-rectangular areas.

Scissor rectangles cannot be set larger than the render target, but they can be set larger than the viewport.

The scissor rectangle is managed by a device render state. A scissor test is enabled or disabled by setting the renderstate to TRUE or FALSE. This test is performed after the fragment color is computed but before alpha testing. IDirect3DDevice9::SetRenderTarget resets the scissor rectangle to the full render target, analogous to the viewport reset. IDirect3DDevice9::SetScissorRect is recorded by stateblocks, and IDirect3DDevice9::CreateStateBlock with the all state setting (D3DSBT_ALL value in D3DSTATEBLOCKTYPE). The scissor test also affects the device IDirect3DDevice9::Clear operation.



// Methods
HRESULT IDirect3DDevice9::SetScissorRect(CONST RECT* pRect); 
HRESULT IDirect3DDevice9::GetScissorRect(RECT* pRect); 

// New RenderState, values are TRUE or FALSE 
D3DRS_SCISSORTESTENABLE 

// New hardware cap 
D3D9CAPS.RasterCaps -> D3DPRASTERCAPS_SCISSORTEST;


The default scissor rectangle is the full viewport.

Scissor testing is done just after pixel processing is completed by a pixel shader or the fixed function pipeline, as shown in the following diagram.

Diagram of when scissor testing is performed relative to other steps

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.