Platform SDK: DirectX

Creating Predefined State Blocks

[C++]

The IDirect3DDevice7::CreateStateBlock method creates a new state block that contains the entire set of device states, or just those device-states related to vertex or pixel processing. The CreateStateBlock method accepts two parameters. The first parameter identifies the type of state information to be captured into 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.

Valid values for the first parameter are defined by the D3DSTATEBLOCKTYPE enumerated type, which includes members that you can use to capture the entire set of device states (D3DSBT_ALL), or only those states that pertain to vertex or pixel processing (D3DSBT_VERTEX or D3DSBT_PIXEL). The following list summarizes the states that the system captures when you pass the D3DSBT_VERTEX or D3DSBT_PIXEL values.

[Visual Basic]

The Direct3DDevice7.CreateStateBlock method creates a new state block that contains the entire set of device states, or just those device-states related to vertex or pixel processing. The CreateStateBlock method accepts two parameters. The first parameter identifies the type of state information to be captured into 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.

Valid values for the first parameter are defined by the CONST_D3DSTATEBLOCKTYPE enumeration, which includes members that you can use to capture the entire set of device states (D3DSBT_ALL), or only those states that pertain to vertex or pixel processing (D3DSBT_VERTEX or D3DSBT_PIXEL). The following list summarizes the states that the system captures when you pass the D3DSBT_VERTEX or D3DSBT_PIXEL values.

Note  It is important to check the error code from the CreateStateBlock method. If it fails, it is most likely because the display mode has changed (error code DDERR_SURFACELOST). Your application should recover from this type of failure by recreating its surfaces, then recreating the state block.