Microsoft DirectX 9.0

Creating Predefined State Blocks

The IDirect3DDevice9::CreateStateBlock method creates a new state block that contains the entire set of device states or only those device states related to vertex or pixel processing. The method takes two parameters. The first parameter identifies the type of state information to capture in the new state block, and the second parameter is the address of a variable that will receive a valid state-block handle if the call succeeds.

The first parameter is a D3DSTATEBLOCKTYPE, which includes allows you to choose between:

For a complete listing of the states saved, see D3DSTATEBLOCKTYPE.

Be sure to check the error code from the IDirect3DDevice9::CreateStateBlock method. If the method fails, it is likely the display mode has changed. Your application should recover from this type of failure by recreating its surfaces, and then recreating the state block.

© 2002 Microsoft Corporation. All rights reserved.