Saving Pixel State With a StateBlock

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

To capture pixel state with a state block, specify D3DSBT_PIXELSTATE when calling IDirect3DDevice9::CreateStateBlock.

Pixel 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 pixel state:

Render States Default Value
D3DRS_ZENABLE D3DZB_FALSE
D3DRS_SPECULARENABLE FALSE
D3DFILLMODE D3DFILL_SOLID
D3DSHADEMODE D3DSHADE_GOURAUD
D3DRS_ZWRITEENABLE TRUE
D3DRS_ALPHATESTENABLE FALSE
D3DRS_LASTPIXEL TRUE
D3DRS_SRCBLEND D3DBLEND_ONE
D3DRS_DESTBLEND D3DBLEND_ZERO
D3DRS_ZFUNC D3DCMP_LESSEQUAL
D3DRS_ALPHAREF 0
D3DRS_ALPHAFUNC D3DCMP_ALWAYS
D3DRS_DITHERENABLE FALSE
D3DRS_FOGSTART 0
D3DRS_FOGEND 1
D3DRS_FOGDENSITY 1
D3DRS_ALPHABLENDENABLE FALSE
D3DRS_DEPTHBIAS 0
D3DRS_STENCILENABLE FALSE
D3DRS_STENCILFAIL D3DSTENCILOP_KEEP
D3DRS_STENCILZFAIL D3DSTENCILOP_KEEP
D3DRS_STENCILPASS D3DSTENCILOP_KEEP
D3DRS_STENCILFUNC D3DCMP_ALWAYS
D3DRS_STENCILREF 0
D3DRS_STENCILMASK 0xffffffff
D3DRS_STENCILWRITEMASK 0xffffffff
D3DRS_TEXTUREFACTOR 0xffffffff
D3DRS_WRAP0 0
D3DRS_WRAP1 0
D3DRS_WRAP2 0
D3DRS_WRAP3 0
D3DRS_WRAP4 0
D3DRS_WRAP5 0
D3DRS_WRAP6 0
D3DRS_WRAP7 0
D3DRS_WRAP8 0
D3DRS_WRAP9 0
D3DRS_WRAP10 0
D3DRS_WRAP11 0
D3DRS_WRAP12 0
D3DRS_WRAP13 0
D3DRS_WRAP14 0
D3DRS_WRAP15 0
D3DRS_LOCALVIEWER TRUE
D3DRS_EMISSIVEMATERIALSOURCE D3DMCS_MATERIAL
D3DRS_AMBIENTMATERIALSOURCE D3DMCS_MATERIAL
D3DRS_DIFFUSEMATERIALSOURCE D3DMCS_COLOR1
D3DRS_SPECULARMATERIALSOURCE D3DMCS_COLOR2
D3DRS_COLORWRITEENABLE 0x0000000f
D3DBLENDOP D3DBLENDOP_ADD
D3DRS_SCISSORTESTENABLE FALSE
D3DRS_SLOPESCALEDEPTHBIAS 0
D3DRS_ANTIALIASEDLINEENABLE FALSE
D3DRS_Two_Sided_StencilMODE FALSE
D3DRS_CCW_STENCILFAIL D3DSTENCILOP_KEEP
D3DRS_CCW_STENCILZFAIL D3DSTENCILOP_KEEP
D3DRS_CCW_STENCILPASS D3DSTENCILOP_KEEP
D3DRS_CCW_STENCILFUNC D3DCMP_ALWAYS
D3DRS_COLORWRITEENABLE1 0x0000000f
D3DRS_COLORWRITEENABLE2 0x0000000f
D3DRS_COLORWRITEENABLE3 0x0000000f
D3DRS_BLENDFACTOR 0xffffffff
D3DRS_SRGBWRITEENABLE 0
D3DRS_SEPARATEALPHABLENDENABLE FALSE
D3DRS_SRCBLENDALPHA D3DBLEND_ONE
D3DRS_DESTBLENDALPHA D3DBLEND_ZERO
D3DRS_BLENDOPALPHA D3DBLENDOP_ADD

Pixel 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 pixel state:

Sampler States Default Value
D3DSAMP_ADDRESSU D3DTADDRESS_WRAP
D3DSAMP_ADDRESSV D3DTADDRESS_WRAP
D3DSAMP_ADDRESSW D3DTADDRESS_WRAP
D3DSAMP_BORDERCOLOR 0x00000000
D3DSAMP_MAGFILTER D3DTEXF_POINT
D3DSAMP_MINFILTER D3DTEXF_POINT
D3DSAMP_MIPFILTER D3DTEXF_NONE
D3DSAMP_MIPMAPLODBIAS 0
D3DSAMP_MAXMIPLEVEL 0
D3DSAMP_MAXANISOTROPY 1
D3DSAMP_SRGBTEXTURE 0
D3DSAMP_ELEMENTINDEX 0

Pixel Pipeline: Texture State

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

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

Texture States Default Value
D3DTSS_COLOROP D3DTOP_DISABLE
D3DTSS_COLORARG1 D3DTA_TEXTURE
D3DTSS_COLORARG2 D3DTA_CURRENT
D3DTSS_ALPHAOP D3DTOP_DISABLE
D3DTSS_ALPHAARG1 D3DTA_TEXTURE
D3DTSS_ALPHAARG2 D3DTA_CURRENT
D3DTSS_BUMPENVMAT00 0
D3DTSS_BUMPENVMAT01 0
D3DTSS_BUMPENVMAT10 0
D3DTSS_BUMPENVMAT11 0
D3DTSS_TEXCOORDINDEX 0
D3DTSS_BUMPENVLSCALE 0
D3DTSS_BUMPENVLOFFSET 0
D3DTSS_TEXTURETRANSFORMFLAGS D3DTTFF_DISABLE
D3DTSS_COLORARG0 D3DTA_CURRENT
D3DTSS_ALPHAARG0 D3DTA_CURRENT
D3DTSS_RESULTARG D3DTA_CURRENT