?/TD>
Microsoft DirectX 9.0

States


Effect states are used to initialize pipeline states in preparation for vertex and pixel processing.

effect state [ [index] ] = expression

Where:

Effect states can be broken up into the following categories.

Light States

To enable the best performance for applying an effect, all components of a light or a material should be specified in the effect file. States that you fail to declare are set to some default value because there is no way for Microsoft?Direct3D?to set light states individually.

Light stateTypeValues
LightAmbient[n]float4See the Ambient member of D3DLIGHT9.
LightAttenuation0[n]floatSee the Attenuation0 member of D3DLIGHT9.
LightAttenuation1[n]floatSee the Attenuation1 member of D3DLIGHT9.
LightAttenuation2[n]floatSee the Attenuation2 member of D3DLIGHT9.
LightDiffuse[n]float4See the Diffuse member of D3DLIGHT9.
LightDirection[n]float3See the Direction member of D3DLIGHT9.
LightEnable[n]boolTrue of False. See the bEnable argument in IDirect3DDevice9::LightEnable.
LightFalloff[n]floatD3DCOLORVALUE. See the Falloff member of D3DLIGHT9.
LightPhi[n]floatSee the Phi member of D3DLIGHT9.
LightPosition[n]float3See the Position member of D3DLIGHT9.
LightRange[n]floatSee the Range member of D3DLIGHT9.
LightSpecular[n]float4See the Specular member of D3DLIGHT9.
LightTheta[n]floatSee the Theta member of D3DLIGHT9.
LightType[n]dwordSame value as the array of up to n?A HREF="../../d3d/enums/d3dlighttype.htm">D3DLIGHTTYPE values without the D3DLIGHT_ prefix.

Material States

States that you fail to declare are set to some default value because there is no way for Direct3D to set material states individually.

Material stateTypeValues
MaterialAmbientfloat4Same value as Ambient.
MaterialDiffusefloat4Same value as Diffuse.
MaterialEmissivefloat4Same value as Emissive.
MaterialPowerfloatSame values as Power.
MaterialSpecularfloat4Same value as Specular.

Render States

Render states are as follows:

Vertex Pipe Render States

Effect file render states have names similar to the fixed function pipeline states, often with the prefix removed.

Render stateTypeValues
Ambientfloat4Same values as D3DRS_AMBIENT.
AmbientMaterialSourcedwordSame values as D3DMATERIALCOLORSOURCE without the D3DMCS_ prefix. See D3DRS_AMBIENTMATERIALSOURCE.
ClippingboolTrue or False. Same values as D3DRS_CLIPPING.
ClipPlaneEnabledwordBitwise combination of D3DCLIPPLANE0 - D3DCLIPPLANE5 macros. See D3DCLIPPLANEn and D3DRS_CLIPPLANEENABLE.
ColorVertexboolTrue or False. Same values as D3DRS_COLORVERTEX.
CullModedwordSame values as D3DCULL without the D3DCULL_ prefix.
DiffuseMaterialSourcedwordSame values as D3DMATERIALCOLORSOURCE without the D3DMCS_ prefix. See D3DRS_DIFFUSEMATERIALSOURCE.
EmissiveMaterialSourcedwordSame values as D3DMATERIALCOLORSOURCE without the D3DMCS_ prefix. See D3DRS_EMISSIVEMATERIALSOURCE.
FogColordwordSame values as D3DCOLOR. See D3DRS_FOGCOLOR.
FogDensityfloatSame values as D3DRS_FOGDENSITY.
FogEnableboolTrue or False. Same values as D3DRS_FOGENABLE.
FogEndfloatSame values as D3DRS_FOGEND.
FogStartfloatSame values as D3DRS_FOGSTART.
FogTableModedwordSame values as D3DFOGMODE. See D3DRS_FOGTABLEMODE in D3DRENDERSTATETYPE.
FogVertexModedwordSame values as D3DFOGMODE without the D3DFOG_ prefix.
IndexedVertexBlendEnableboolTrue or False. Same values as D3DRS_INDEXEDVERTEXBLENDENABLE.
LightingboolTrue or False. Same values as D3DRS_LIGHTING.
LocalViewerboolTrue or False. Same values as D3DRS_LOCALVIEWER.
MultiSampleAntialiasboolSame values as D3DRS_MULTISAMPLEANTIALIAS.
MultiSampleMaskdwordSame values as D3DRS_MULTISAMPLEMASK.
NormalizeNormalsboolTrue or False. Same values as D3DRS_NORMALIZENORMALS.
PatchSegmentsfloat Same values as nSegments in IDirect3DDevice9::SetNPatchMode.
PointScale_AfloatSame values as D3DRS_POINTSCALE_A.
PointScale_BfloatSame values as D3DRS_POINTSCALE_B.
PointScale_CfloatSame values as D3DRS_POINTSCALE_C.
PointScaleEnableboolSame values as D3DRS_POINTSCALEENABLE.
PointSizefloatSame values as D3DRS_POINTSIZE.
PointSize_MinfloatSame values as D3DRS_POINTSIZE_MIN.
PointSize_MaxfloatSame values as D3DRS_POINTSIZE_MAX without the D3DRS_ prefix.
PointSpriteEnableboolTrue or False. Same values as D3DRS_POINTSPRITEENABLE.
RangeFogEnableboolTrue or False. Same values as D3DRS_RANGEFOGENABLE.
SpecularEnableboolTrue or False. Same values as D3DRS_SPECULARENABLE.
SpecularMaterialSourcedwordSame values as D3DMATERIALCOLORSOURCE without the D3DMCS_ prefix. See D3DRS_SPECULARMATERIALSOURCE.
TweenFactorfloatSame values as D3DRS_TWEENFACTOR.
VertexBlenddwordSame values as D3DVERTEXBLENDFLAGS without the D3DVBF_ prefix. See D3DRS_VERTEXBLEND.

Pixel Pipe Render States

Effect file render states have names similar to the fixed function pipeline states, often with the prefix removed.

Render stateTypeValues
AlphaBlendEnableboolTrue or False. Same values as D3DRS_ALPHABLENDENABLE in D3DRENDERSTATETYPE.
AlphaFuncdwordSame values as D3DCMPFUNC without the D3DCMP_ prefix. See D3DRS_ALPHAFUNC.
AlphaRefdwordSame values as D3DRS_ALPHAREF.
AlphaTestEnabledwordTrue or False. See D3DRS_ALPHATESTENABLE.
BlendOpdwordSame values as D3DBLENDOP without the D3DBLENDOP_ prefix.
ColorWriteEnabledwordBitwise combination of RED|GREEN|BLUE|ALPHA. See D3DRS_COLORWRITEENABLE.
DepthBiasintSame values as D3DRS_DEPTHBIAS.
DestBlenddwordSame values as D3DBLEND without the D3DBLEND_ prefix.
DitherEnableboolTrue or False. Same values as D3DRS_DITHERENABLE.
FillModedwordSame values as D3DFILLMODE without the D3DFILL_ prefix.
LastPixeldwordTrue or False. See D3DRS_LASTPIXEL.
ShadeModedwordSame values as D3DSHADEMODE without the D3DSHADE_ prefix.
SrcBlenddwordSame values as D3DBLEND without the D3DBLEND_ prefix.
StencilEnableboolTrue or False. Same values as D3DRS_STENCILENABLE.
StencilFaildwordSame values as D3DSTENCILCAPS without the D3DSTENCILCAP_ prefix. See D3DRS_STENCILFAIL.
StencilFuncdwordSame values as D3DCMPFUNC without the D3DCMP_ prefix. See D3DRS_STENCILFUNC.
StencilMaskdwordSame values as D3DRS_STENCILMASK.
StencilPassdwordSame values as D3DSTENCILCAPS without the D3DSTENCILCAP_ prefix. See D3DRS_STENCILPASS.
StencilRefintSame values as D3DRS_STENCILREF.
StencilWriteMaskdwordSame values as D3DRS_STENCILWRITEMASK.
StencilZFaildwordSame values as D3DSTENCILCAPS without the D3DSTENCILCAP_ prefix. See D3DRS_STENCILZFAIL.
TextureFactordwordSame values as D3DCOLOR. Same values as D3DRS_TEXTUREFACTOR.
Wrap0dwordSame values as D3DRS_WRAP0 without the D3DDRS_ prefix in D3DRENDERSTATETYPE.
Wrap1dwordSame values as in D3DRS_WRAP1 without the D3DDRS_ prefix.
Wrap2dwordSame values as in D3DRS_WRAP2 without the D3DDRS_ prefix.
Wrap3dwordSame values as in D3DRS_WRAP3 without the D3DDRS_ prefix.
Wrap4dwordSame values as in D3DRS_WRAP4 without the D3DDRS_ prefix.
Wrap5dwordSame values as in D3DRS_WRAP5 without the D3DDRS_ prefix.
Wrap6dwordSame values as in D3DRS_WRAP6 without the D3DDRS_ prefix.
Wrap7dwordSame values as in D3DRS_WRAP7 without the D3DDRS_ prefix.
Wrap8dwordSame values as D3DRS_WRAP0 without the D3DDRS_ prefix in D3DRENDERSTATETYPE.
Wrap9dwordSame values as in D3DRS_WRAP1 without the D3DDRS_ prefix.
Wrap10dwordSame values as in D3DRS_WRAP2 without the D3DDRS_ prefix.
Wrap11dwordSame values as in D3DRS_WRAP3 without the D3DDRS_ prefix.
Wrap12dwordSame values as in D3DRS_WRAP4 without the D3DDRS_ prefix.
Wrap13dwordSame values as in D3DRS_WRAP5 without the D3DDRS_ prefix.
Wrap14dwordSame values as in D3DRS_WRAP6 without the D3DDRS_ prefix.
Wrap15dwordSame values as in D3DRS_WRAP7 without the D3DDRS_ prefix.
ZEnabledwordSame values as D3DZBUFFERTYPE without the D3DZB_ prefix.
ZFuncdwordSame values as D3DCMPFUNC without the D3DCMP_ prefix. See D3DRS_ZFUNC.
ZWriteEnableboolTrue or False. See D3DRS_ZWRITEENABLE.

Sampler States

StateTypeValues
SamplersamplerNULL, or a sampler state block.

Sampler Stage States

Sampler stateTypeValues
AddressU[16]dwordSame values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_ADDRESSU.
AddressV[16]dwordSame values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_ADDRESSV.
AddressW[16]dwordSame values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_ADDRESSW.
BorderColor[16]float4D3DCOLORVALUE. Same values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_BORDERCOLOR.
MagFilter[16]dwordSame values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_MAGFILTER.
MaxAnisotropy[16]dwordSame values as D3DSAMP_MAXANISOTROPY without the D3DSAMP_ prefix.
MaxMipLevel[16]intSame values as D3DSAMP_MAXMIPLEVEL without the D3DSAMP_ prefix.
MinFilter[16]dwordSame values as D3DSAMP_MINFILTER without the D3DSAMP_ prefix.
MipFilter[16]dwordSame values as D3DSAMP_MIPFILTER without the D3DSAMP_ prefix.
MipMapLodBias[16]floatSame values as D3DSAMP_MIPMAPLODBIAS without the D3DSAMP_ prefix.
SRGBTexturefloatSame value as D3DSAMP_SRGBTEXTURE without the D3DSAMP_ prefix.

Shader States

Shader states are as follows:

Pixel Shader States

StateTypeValues
PixelShaderpixelshaderNULL, an assembly block, a compile target, or a pixel shader parameter.

Vertex Shader States

StateTypeValues
VertexShadervertexshaderNULL, an assembly block, a compile target, or a pixel shader parameter.

Shader Constant States

Shader constant states are as follows:

Pixel Shader Constant States

StateTypeValues
PixelShaderConstantfloat[m[n]]m x n array of floats; m and n are optional.
PixelShaderConstant1float4One 4-D float.
PixelShaderConstant2float4x2Two 4-D floats.
PixelShaderConstant3float4x3Three 4-D floats.
PixelShaderConstant4float4x4Four 4-D floats.
PixelShaderConstantBbool[m[n]]m x n array of bools; m and n are optional.
PixelShaderConstantIint[m[n]]m x n array of ints. m and n are optional.
PixelShaderConstantFfloat[m[n]]m x n array of floats. m and n are optional.

Vertex Shader Constant States

StateTypeValues
VertexShaderConstantfloat[m[n]]m x n array of floats. m and n are optional.
VertexShaderConstant1float4One 4-D float.
VertexShaderConstant2float4x2Two 4-D floats.
VertexShaderConstant3float4x3Three 4-D floats.
VertexShaderConstant4float4x4Four 4-D floats.
VertexShaderConstantBbool[m[n]]m x n array of bools. m and n are optional.
VertexShaderConstantIint[m[n]]m x n array of ints. m and n are optional.
VertexShaderConstantFfloat[m[n]]m x n array of floats. m and n are optional.

Texture States

Texture stateTypeValues
Texture[8]textureNULL, or a texture parameter.

Texture Stage States

TypeTexture stage stateValues
AlphaOp[8]dwordSame as D3DTEXTUREOP without the D3DTOP_ prefix. See D3DTSS_ALPHAOP.
AlphaArg0[8]dwordSame as D3DTA without the D3DTA_ prefix. See D3DTSS_ALPHAARG0.
AlphaArg1[8]dwordSame as D3DTA without the D3DTA_ prefix. See D3DTSS_ALPHAARG1.
AlphaArg2[8]dwordSame as D3DTA without the D3DTA_ prefix. See D3DTSS_ALPHAARG2.
ColorArg0[8]dwordSame as D3DTA without the D3DTA_ prefix. See D3DTSS_COLORARG0.
ColorArg1[8]dwordSame as D3DTA without the D3DTA_ prefix. See D3DTSS_COLORARG1.
ColorArg2[8]dwordSame as D3DTA without the D3DTA_ prefix. See D3DTSS_COLORARG2.
ColorOp[8]dwordSame as D3DTEXTUREOP without the D3DTOP_ prefix. See D3DTSS_COLOROP.
BumpEnvLScale[8]floatSame values as D3DTSS_BUMPENVLSCALE without the D3DTSS_TCI prefix.
BumpEnvLOffset[8]floatSame values as D3DTSS_BUMPENVLOFFSET without the D3DTSS_TCI prefix.
BumpEnvMat00[8]floatSame values as D3DTSS_BUMPENVMAT00.
BumpEnvMat01[8]floatSame values as D3DTSS_BUMPENVMAT01.
BumpEnvMat10[8]floatSame values as D3DTSS_BUMPENVMAT10.
BumpEnvMat11[8]floatSame values as D3DTSS_BUMPENVMAT11.
ResultArg[8]dwordSame as D3DTA without the D3DTA_ prefix. See D3DTSS_RESULTARG.
TexCoordIndex[8]dwordSame values as D3DTSS_TEXCOORDINDEX without the D3DTSS_TCI prefix.
TextureTransformFlags[8]dwordSame values as D3DTEXTURETRANSFORMFLAGS values without the D3DTTFF_ prefix. See D3DTSS_TEXTURETRANSFORMFLAGS.

Transform States

Effects use transposed matrices for efficiency. You can provide transposed matrices to an effect, or an effect will automatically transpose the matrices before using them.

StateTypeValues
ProjectionTransformfloat4x4A 4x4 matrix of floats. Same values as D3DTS_PROJECTION without the D3DTS_ prefix.
TextureTransform[8]float4x4A 4x4 matrix of floats. Same values as D3DTRANSFORMSTATETYPE without the D3DTS_ prefix.
ViewTransformfloat4x4A 4x4 matrix of floats. Same values as D3DTS_VIEW without the D3DTS_ prefix.
WorldTransformfloat4x4A 4x4 matrix of floats.


© 2002 Microsoft Corporation. All rights reserved.