Saving Vertex States With a StateBlock (Direct3D 9)

A state block can be used to capture only vertex state (see State Blocks Save and Restore State (Direct3D 9)). The following state is vertex state:

To capture vertex state with a state block, specify D3DSBT_VERTEXSTATE when calling IDirect3DDevice9::CreateStateBlock.

Vertex Pipeline: Render State

Device render states affect the behavior of almost every part of the pipeline. Render states are set by calling IDirect3DDevice9::SetRenderState.

The following table includes all render states that set-up vertex state:

Render States Default Value
D3DRS_CULLMODE D3DCULL_CCW
D3DRS_FOGCOLOR 0
D3DRS_FOGTABLEMODE D3DFOG_NONE
D3DRS_FOGSTART 0
D3DRS_FOGEND 1
D3DRS_FOGDENSITY 1
D3DRS_RANGEFOGENABLE FALSE
D3DRS_AMBIENT 0
D3DRS_COLORVERTEX TRUE
D3DRS_FOGVERTEXMODE D3DFOG_NONE
D3DRS_CLIPPING TRUE
D3DRS_LIGHTING TRUE
D3DRS_LOCALVIEWER TRUE
D3DRS_EMISSIVEMATERIALSOURCE D3DMCS_MATERIAL
D3DRS_AMBIENTMATERIALSOURCE D3DMCS_MATERIAL
D3DRS_DIFFUSEMATERIALSOURCE D3DMCS_COLOR1
D3DRS_SPECULARMATERIALSOURCE D3DMCS_COLOR2
D3DRS_VERTEXBLEND D3DVBF_DISABLE
D3DRS_CLIPPLANEENABLE 0
D3DRS_POINTSIZE Driver dependent
D3DRS_POINTSIZE_MIN 1
D3DRS_POINTSPRITEENABLE FALSE
D3DRS_POINTSCALEENABLE FALSE
D3DRS_POINTSCALE_A 1
D3DRS_POINTSCALE_B 0
D3DRS_POINTSCALE_C 0
D3DRS_MULTISAMPLEANTIALIAS TRUE
D3DRS_MULTISAMPLEMASK 0xffffffff
D3DRS_PATCHEDGESTYLE D3DPATCHEDGE_DISCRETE
D3DRS_POINTSIZE_MAX 1
D3DRS_INDEXEDVERTEXBLENDENABLE FALSE
D3DRS_TWEENFACTOR 0
D3DRS_POSITIONDEGREE D3DDEGREE_CUBIC
D3DRS_NORMALDEGREE D3DDEGREE_LINEAR
D3DRS_MINTESSELLATIONLEVEL 1
D3DRS_MAXTESSELLATIONLEVEL 1
D3DRS_ADAPTIVETESS_X 0
D3DRS_ADAPTIVETESS_Y 0
D3DRS_ADAPTIVETESS_Z 1
D3DRS_ADAPTIVETESS_W 0
D3DRS_ENABLEADAPTIVETESSELLATION"/> FALSE

 

Vertex Pipeline: Sampler State

Sampler states control sampling related topics such as filtering, tiling, and texture coordinate address modes. Use IDirect3DDevice9::SetSamplerState to set up the sampler state (including the one used in the tessellator unit to sample displacement maps). The sampler states have been renamed with a "D3DSAMP_" prefix to enable compile time error detection when porting from DirectX 8.

The following table includes all sampler states that set-up vertex state:

Sampler States Default Value
D3DSAMP_DMAPOFFSET 256

 

Vertex Pipeline: Texture State

Texture states control texture blending operations of the multi-texture blender. Use IDirect3DDevice9::SetTextureStageState to set-up texture states. Use IDirect3DDevice9::SetTexture to associate a texture with a sampler stage.

The following table includes all the texture states that set-up vertex state:

Texture States Default Value
D3DTSS_TEXCOORDINDEX 0
D3DTSS_TEXTURETRANSFORMFLAGS D3DTTFF_DISABLE

 

D3DTSS_TEXCOORDINDEX is a fixed function vertex processing state. If a programmable vertex shader is used, this state is ignored.

State Blocks Save and Restore State