?/TD> |
Microsoft DirectX 9.0 |
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.
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 state | Type | Values |
---|---|---|
LightAmbient[n] | float4 | See the Ambient member of D3DLIGHT9. |
LightAttenuation0[n] | float | See the Attenuation0 member of D3DLIGHT9. |
LightAttenuation1[n] | float | See the Attenuation1 member of D3DLIGHT9. |
LightAttenuation2[n] | float | See the Attenuation2 member of D3DLIGHT9. |
LightDiffuse[n] | float4 | See the Diffuse member of D3DLIGHT9. |
LightDirection[n] | float3 | See the Direction member of D3DLIGHT9. |
LightEnable[n] | bool | True of False. See the bEnable argument in IDirect3DDevice9::LightEnable. |
LightFalloff[n] | float | D3DCOLORVALUE. See the Falloff member of D3DLIGHT9. |
LightPhi[n] | float | See the Phi member of D3DLIGHT9. |
LightPosition[n] | float3 | See the Position member of D3DLIGHT9. |
LightRange[n] | float | See the Range member of D3DLIGHT9. |
LightSpecular[n] | float4 | See the Specular member of D3DLIGHT9. |
LightTheta[n] | float | See the Theta member of D3DLIGHT9. |
LightType[n] | dword | Same value as the array of up to n?A HREF="../../d3d/enums/d3dlighttype.htm">D3DLIGHTTYPE values without the D3DLIGHT_ prefix. |
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 state | Type | Values |
---|---|---|
MaterialAmbient | float4 | Same value as Ambient. |
MaterialDiffuse | float4 | Same value as Diffuse. |
MaterialEmissive | float4 | Same value as Emissive. |
MaterialPower | float | Same values as Power. |
MaterialSpecular | float4 | Same value as Specular. |
Render states are as follows:
Effect file render states have names similar to the fixed function pipeline states, often with the prefix removed.
Render state | Type | Values |
---|---|---|
Ambient | float4 | Same values as D3DRS_AMBIENT. |
AmbientMaterialSource | dword | Same values as D3DMATERIALCOLORSOURCE without the D3DMCS_ prefix. See D3DRS_AMBIENTMATERIALSOURCE. |
Clipping | bool | True or False. Same values as D3DRS_CLIPPING. |
ClipPlaneEnable | dword | Bitwise combination of D3DCLIPPLANE0 - D3DCLIPPLANE5 macros. See D3DCLIPPLANEn and D3DRS_CLIPPLANEENABLE. |
ColorVertex | bool | True or False. Same values as D3DRS_COLORVERTEX. |
CullMode | dword | Same values as D3DCULL without the D3DCULL_ prefix. |
DiffuseMaterialSource | dword | Same values as D3DMATERIALCOLORSOURCE without the D3DMCS_ prefix. See D3DRS_DIFFUSEMATERIALSOURCE. |
EmissiveMaterialSource | dword | Same values as D3DMATERIALCOLORSOURCE without the D3DMCS_ prefix. See D3DRS_EMISSIVEMATERIALSOURCE. |
FogColor | dword | Same values as D3DCOLOR. See D3DRS_FOGCOLOR. |
FogDensity | float | Same values as D3DRS_FOGDENSITY. |
FogEnable | bool | True or False. Same values as D3DRS_FOGENABLE. |
FogEnd | float | Same values as D3DRS_FOGEND. |
FogStart | float | Same values as D3DRS_FOGSTART. |
FogTableMode | dword | Same values as D3DFOGMODE. See D3DRS_FOGTABLEMODE in D3DRENDERSTATETYPE. |
FogVertexMode | dword | Same values as D3DFOGMODE without the D3DFOG_ prefix. |
IndexedVertexBlendEnable | bool | True or False. Same values as D3DRS_INDEXEDVERTEXBLENDENABLE. |
Lighting | bool | True or False. Same values as D3DRS_LIGHTING. |
LocalViewer | bool | True or False. Same values as D3DRS_LOCALVIEWER. |
MultiSampleAntialias | bool | Same values as D3DRS_MULTISAMPLEANTIALIAS. |
MultiSampleMask | dword | Same values as D3DRS_MULTISAMPLEMASK. |
NormalizeNormals | bool | True or False. Same values as D3DRS_NORMALIZENORMALS. |
PatchSegments | float | Same values as nSegments in IDirect3DDevice9::SetNPatchMode. |
PointScale_A | float | Same values as D3DRS_POINTSCALE_A. |
PointScale_B | float | Same values as D3DRS_POINTSCALE_B. |
PointScale_C | float | Same values as D3DRS_POINTSCALE_C. |
PointScaleEnable | bool | Same values as D3DRS_POINTSCALEENABLE. |
PointSize | float | Same values as D3DRS_POINTSIZE. |
PointSize_Min | float | Same values as D3DRS_POINTSIZE_MIN. |
PointSize_Max | float | Same values as D3DRS_POINTSIZE_MAX without the D3DRS_ prefix. |
PointSpriteEnable | bool | True or False. Same values as D3DRS_POINTSPRITEENABLE. |
RangeFogEnable | bool | True or False. Same values as D3DRS_RANGEFOGENABLE. |
SpecularEnable | bool | True or False. Same values as D3DRS_SPECULARENABLE. |
SpecularMaterialSource | dword | Same values as D3DMATERIALCOLORSOURCE without the D3DMCS_ prefix. See D3DRS_SPECULARMATERIALSOURCE. |
TweenFactor | float | Same values as D3DRS_TWEENFACTOR. |
VertexBlend | dword | Same values as D3DVERTEXBLENDFLAGS without the D3DVBF_ prefix. See D3DRS_VERTEXBLEND. |
Effect file render states have names similar to the fixed function pipeline states, often with the prefix removed.
Render state | Type | Values |
---|---|---|
AlphaBlendEnable | bool | True or False. Same values as D3DRS_ALPHABLENDENABLE in D3DRENDERSTATETYPE. |
AlphaFunc | dword | Same values as D3DCMPFUNC without the D3DCMP_ prefix. See D3DRS_ALPHAFUNC. |
AlphaRef | dword | Same values as D3DRS_ALPHAREF. |
AlphaTestEnable | dword | True or False. See D3DRS_ALPHATESTENABLE. |
BlendOp | dword | Same values as D3DBLENDOP without the D3DBLENDOP_ prefix. |
ColorWriteEnable | dword | Bitwise combination of RED|GREEN|BLUE|ALPHA. See D3DRS_COLORWRITEENABLE. |
DepthBias | int | Same values as D3DRS_DEPTHBIAS. |
DestBlend | dword | Same values as D3DBLEND without the D3DBLEND_ prefix. |
DitherEnable | bool | True or False. Same values as D3DRS_DITHERENABLE. |
FillMode | dword | Same values as D3DFILLMODE without the D3DFILL_ prefix. |
LastPixel | dword | True or False. See D3DRS_LASTPIXEL. |
ShadeMode | dword | Same values as D3DSHADEMODE without the D3DSHADE_ prefix. |
SrcBlend | dword | Same values as D3DBLEND without the D3DBLEND_ prefix. |
StencilEnable | bool | True or False. Same values as D3DRS_STENCILENABLE. |
StencilFail | dword | Same values as D3DSTENCILCAPS without the D3DSTENCILCAP_ prefix. See D3DRS_STENCILFAIL. |
StencilFunc | dword | Same values as D3DCMPFUNC without the D3DCMP_ prefix. See D3DRS_STENCILFUNC. |
StencilMask | dword | Same values as D3DRS_STENCILMASK. |
StencilPass | dword | Same values as D3DSTENCILCAPS without the D3DSTENCILCAP_ prefix. See D3DRS_STENCILPASS. |
StencilRef | int | Same values as D3DRS_STENCILREF. |
StencilWriteMask | dword | Same values as D3DRS_STENCILWRITEMASK. |
StencilZFail | dword | Same values as D3DSTENCILCAPS without the D3DSTENCILCAP_ prefix. See D3DRS_STENCILZFAIL. |
TextureFactor | dword | Same values as D3DCOLOR. Same values as D3DRS_TEXTUREFACTOR. |
Wrap0 | dword | Same values as D3DRS_WRAP0 without the D3DDRS_ prefix in D3DRENDERSTATETYPE. |
Wrap1 | dword | Same values as in D3DRS_WRAP1 without the D3DDRS_ prefix. |
Wrap2 | dword | Same values as in D3DRS_WRAP2 without the D3DDRS_ prefix. |
Wrap3 | dword | Same values as in D3DRS_WRAP3 without the D3DDRS_ prefix. |
Wrap4 | dword | Same values as in D3DRS_WRAP4 without the D3DDRS_ prefix. |
Wrap5 | dword | Same values as in D3DRS_WRAP5 without the D3DDRS_ prefix. |
Wrap6 | dword | Same values as in D3DRS_WRAP6 without the D3DDRS_ prefix. |
Wrap7 | dword | Same values as in D3DRS_WRAP7 without the D3DDRS_ prefix. |
Wrap8 | dword | Same values as D3DRS_WRAP0 without the D3DDRS_ prefix in D3DRENDERSTATETYPE. |
Wrap9 | dword | Same values as in D3DRS_WRAP1 without the D3DDRS_ prefix. |
Wrap10 | dword | Same values as in D3DRS_WRAP2 without the D3DDRS_ prefix. |
Wrap11 | dword | Same values as in D3DRS_WRAP3 without the D3DDRS_ prefix. |
Wrap12 | dword | Same values as in D3DRS_WRAP4 without the D3DDRS_ prefix. |
Wrap13 | dword | Same values as in D3DRS_WRAP5 without the D3DDRS_ prefix. |
Wrap14 | dword | Same values as in D3DRS_WRAP6 without the D3DDRS_ prefix. |
Wrap15 | dword | Same values as in D3DRS_WRAP7 without the D3DDRS_ prefix. |
ZEnable | dword | Same values as D3DZBUFFERTYPE without the D3DZB_ prefix. |
ZFunc | dword | Same values as D3DCMPFUNC without the D3DCMP_ prefix. See D3DRS_ZFUNC. |
ZWriteEnable | bool | True or False. See D3DRS_ZWRITEENABLE. |
State | Type | Values |
---|---|---|
Sampler | sampler | NULL, or a sampler state block. |
Sampler state | Type | Values |
---|---|---|
AddressU[16] | dword | Same values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_ADDRESSU. |
AddressV[16] | dword | Same values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_ADDRESSV. |
AddressW[16] | dword | Same values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_ADDRESSW. |
BorderColor[16] | float4 | D3DCOLORVALUE. Same values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_BORDERCOLOR. |
MagFilter[16] | dword | Same values as D3DTEXTUREFILTERTYPE without the D3DTEXF_ prefix. See D3DSAMP_MAGFILTER. |
MaxAnisotropy[16] | dword | Same values as D3DSAMP_MAXANISOTROPY without the D3DSAMP_ prefix. |
MaxMipLevel[16] | int | Same values as D3DSAMP_MAXMIPLEVEL without the D3DSAMP_ prefix. |
MinFilter[16] | dword | Same values as D3DSAMP_MINFILTER without the D3DSAMP_ prefix. |
MipFilter[16] | dword | Same values as D3DSAMP_MIPFILTER without the D3DSAMP_ prefix. |
MipMapLodBias[16] | float | Same values as D3DSAMP_MIPMAPLODBIAS without the D3DSAMP_ prefix. |
SRGBTexture | float | Same value as D3DSAMP_SRGBTEXTURE without the D3DSAMP_ prefix. |
Shader states are as follows:
State | Type | Values |
---|---|---|
PixelShader | pixelshader | NULL, an assembly block, a compile target, or a pixel shader parameter. |
State | Type | Values |
---|---|---|
VertexShader | vertexshader | NULL, an assembly block, a compile target, or a pixel shader parameter. |
Shader constant states are as follows:
State | Type | Values |
---|---|---|
PixelShaderConstant | float[m[n]] | m x n array of floats; m and n are optional. |
PixelShaderConstant1 | float4 | One 4-D float. |
PixelShaderConstant2 | float4x2 | Two 4-D floats. |
PixelShaderConstant3 | float4x3 | Three 4-D floats. |
PixelShaderConstant4 | float4x4 | Four 4-D floats. |
PixelShaderConstantB | bool[m[n]] | m x n array of bools; m and n are optional. |
PixelShaderConstantI | int[m[n]] | m x n array of ints. m and n are optional. |
PixelShaderConstantF | float[m[n]] | m x n array of floats. m and n are optional. |
State | Type | Values |
---|---|---|
VertexShaderConstant | float[m[n]] | m x n array of floats. m and n are optional. |
VertexShaderConstant1 | float4 | One 4-D float. |
VertexShaderConstant2 | float4x2 | Two 4-D floats. |
VertexShaderConstant3 | float4x3 | Three 4-D floats. |
VertexShaderConstant4 | float4x4 | Four 4-D floats. |
VertexShaderConstantB | bool[m[n]] | m x n array of bools. m and n are optional. |
VertexShaderConstantI | int[m[n]] | m x n array of ints. m and n are optional. |
VertexShaderConstantF | float[m[n]] | m x n array of floats. m and n are optional. |
Texture state | Type | Values |
---|---|---|
Texture[8] | texture | NULL, or a texture parameter. |
Type | Texture stage state | Values |
---|---|---|
AlphaOp[8] | dword | Same as D3DTEXTUREOP without the D3DTOP_ prefix. See D3DTSS_ALPHAOP. |
AlphaArg0[8] | dword | Same as D3DTA without the D3DTA_ prefix. See D3DTSS_ALPHAARG0. |
AlphaArg1[8] | dword | Same as D3DTA without the D3DTA_ prefix. See D3DTSS_ALPHAARG1. |
AlphaArg2[8] | dword | Same as D3DTA without the D3DTA_ prefix. See D3DTSS_ALPHAARG2. |
ColorArg0[8] | dword | Same as D3DTA without the D3DTA_ prefix. See D3DTSS_COLORARG0. |
ColorArg1[8] | dword | Same as D3DTA without the D3DTA_ prefix. See D3DTSS_COLORARG1. |
ColorArg2[8] | dword | Same as D3DTA without the D3DTA_ prefix. See D3DTSS_COLORARG2. |
ColorOp[8] | dword | Same as D3DTEXTUREOP without the D3DTOP_ prefix. See D3DTSS_COLOROP. |
BumpEnvLScale[8] | float | Same values as D3DTSS_BUMPENVLSCALE without the D3DTSS_TCI prefix. |
BumpEnvLOffset[8] | float | Same values as D3DTSS_BUMPENVLOFFSET without the D3DTSS_TCI prefix. |
BumpEnvMat00[8] | float | Same values as D3DTSS_BUMPENVMAT00. |
BumpEnvMat01[8] | float | Same values as D3DTSS_BUMPENVMAT01. |
BumpEnvMat10[8] | float | Same values as D3DTSS_BUMPENVMAT10. |
BumpEnvMat11[8] | float | Same values as D3DTSS_BUMPENVMAT11. |
ResultArg[8] | dword | Same as D3DTA without the D3DTA_ prefix. See D3DTSS_RESULTARG. |
TexCoordIndex[8] | dword | Same values as D3DTSS_TEXCOORDINDEX without the D3DTSS_TCI prefix. |
TextureTransformFlags[8] | dword | Same values as D3DTEXTURETRANSFORMFLAGS values without the D3DTTFF_ prefix. See D3DTSS_TEXTURETRANSFORMFLAGS. |
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.
State | Type | Values |
---|---|---|
ProjectionTransform | float4x4 | A 4x4 matrix of floats. Same values as D3DTS_PROJECTION without the D3DTS_ prefix. |
TextureTransform[8] | float4x4 | A 4x4 matrix of floats. Same values as D3DTRANSFORMSTATETYPE without the D3DTS_ prefix. |
ViewTransform | float4x4 | A 4x4 matrix of floats. Same values as D3DTS_VIEW without the D3DTS_ prefix. |
WorldTransform | float4x4 | A 4x4 matrix of floats. |