Saving Pixel State With a StateBlock (Direct3D 9)

A state block can be used to capture only pixel state (see State Blocks Save and Restore State (Direct3D 9)). 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 StatesDefault Value
D3DRS_ZENABLED3DZB_FALSE
D3DRS_SPECULARENABLEFALSE
D3DFILLMODE D3DFILL_SOLID
D3DSHADEMODE D3DSHADE_GOURAUD
D3DRS_ZWRITEENABLETRUE
D3DRS_ALPHATESTENABLEFALSE
D3DRS_LASTPIXELTRUE
D3DRS_SRCBLENDD3DBLEND_ONE
D3DRS_DESTBLENDD3DBLEND_ZERO
D3DRS_ZFUNCD3DCMP_LESSEQUAL
D3DRS_ALPHAREF0
D3DRS_ALPHAFUNCD3DCMP_ALWAYS
D3DRS_DITHERENABLEFALSE
D3DRS_FOGSTART0
D3DRS_FOGEND1
D3DRS_FOGDENSITY1
D3DRS_ALPHABLENDENABLEFALSE
D3DRS_DEPTHBIAS0
D3DRS_STENCILENABLEFALSE
D3DRS_STENCILFAILD3DSTENCILOP_KEEP
D3DRS_STENCILZFAILD3DSTENCILOP_KEEP
D3DRS_STENCILPASSD3DSTENCILOP_KEEP
D3DRS_STENCILFUNCD3DCMP_ALWAYS
D3DRS_STENCILREF0
D3DRS_STENCILMASK0xffffffff
D3DRS_STENCILWRITEMASK0xffffffff
D3DRS_TEXTUREFACTOR0xffffffff
D3DRS_WRAP00
D3DRS_WRAP10
D3DRS_WRAP20
D3DRS_WRAP30
D3DRS_WRAP40
D3DRS_WRAP50
D3DRS_WRAP60
D3DRS_WRAP70
D3DRS_WRAP80
D3DRS_WRAP90
D3DRS_WRAP100
D3DRS_WRAP110
D3DRS_WRAP120
D3DRS_WRAP130
D3DRS_WRAP140
D3DRS_WRAP150
D3DRS_LOCALVIEWERTRUE
D3DRS_EMISSIVEMATERIALSOURCED3DMCS_MATERIAL
D3DRS_AMBIENTMATERIALSOURCED3DMCS_MATERIAL
D3DRS_DIFFUSEMATERIALSOURCED3DMCS_COLOR1
D3DRS_SPECULARMATERIALSOURCED3DMCS_COLOR2
D3DRS_COLORWRITEENABLE0x0000000f
D3DBLENDOP D3DBLENDOP_ADD
D3DRS_SCISSORTESTENABLEFALSE
D3DRS_SLOPESCALEDEPTHBIAS0
D3DRS_ANTIALIASEDLINEENABLEFALSE
D3DRS_TWOSIDEDSTENCILMODEFALSE
D3DRS_CCW_STENCILFAILD3DSTENCILOP_KEEP
D3DRS_CCW_STENCILZFAILD3DSTENCILOP_KEEP
D3DRS_CCW_STENCILPASSD3DSTENCILOP_KEEP
D3DRS_CCW_STENCILFUNCD3DCMP_ALWAYS
D3DRS_COLORWRITEENABLE10x0000000f
D3DRS_COLORWRITEENABLE20x0000000f
D3DRS_COLORWRITEENABLE30x0000000f
D3DRS_BLENDFACTOR0xffffffff
D3DRS_SRGBWRITEENABLE0
D3DRS_SEPARATEALPHABLENDENABLEFALSE
D3DRS_SRCBLENDALPHAD3DBLEND_ONE
D3DRS_DESTBLENDALPHAD3DBLEND_ZERO
D3DRS_BLENDOPALPHAD3DBLENDOP_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 StatesDefault Value
D3DSAMP_ADDRESSUD3DTADDRESS_WRAP
D3DSAMP_ADDRESSVD3DTADDRESS_WRAP
D3DSAMP_ADDRESSWD3DTADDRESS_WRAP
D3DSAMP_BORDERCOLOR0x00000000
D3DSAMP_MAGFILTERD3DTEXF_POINT
D3DSAMP_MINFILTERD3DTEXF_POINT
D3DSAMP_MIPFILTERD3DTEXF_NONE
D3DSAMP_MIPMAPLODBIAS0
D3DSAMP_MAXMIPLEVEL0
D3DSAMP_MAXANISOTROPY1
D3DSAMP_SRGBTEXTURE0
D3DSAMP_ELEMENTINDEX0

 

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 StatesDefault Value
D3DTSS_COLOROPD3DTOP_DISABLE
D3DTSS_COLORARG1D3DTA_TEXTURE
D3DTSS_COLORARG2D3DTA_CURRENT
D3DTSS_ALPHAOPD3DTOP_DISABLE
D3DTSS_ALPHAARG1D3DTA_TEXTURE
D3DTSS_ALPHAARG2D3DTA_CURRENT
D3DTSS_BUMPENVMAT000
D3DTSS_BUMPENVMAT010
D3DTSS_BUMPENVMAT100
D3DTSS_BUMPENVMAT110
D3DTSS_TEXCOORDINDEX0
D3DTSS_BUMPENVLSCALE0
D3DTSS_BUMPENVLOFFSET0
D3DTSS_TEXTURETRANSFORMFLAGSD3DTTFF_DISABLE
D3DTSS_COLORARG0D3DTA_CURRENT
D3DTSS_ALPHAARG0D3DTA_CURRENT
D3DTSS_RESULTARGD3DTA_CURRENT

 

 

 

Community Additions

ADD
Show:
© 2014 Microsoft