Microsoft DirectX 8.1 (C++)

Effect File States

The following table contains the effect file states and their possible values.

// Values can be set individually.
SrcBlend = One;

// Or they can be combined with a bitwise operator.
TextureTransformFlags[0] = Count3 | Projected;

In addition, Begin and End can save and restore state modified by an effect file. This is done by setting the Flags parameter in Begin. State is never saved or restored between passes.

Render States

Effect file render states have names similar to the state names used by Microsoft® Direct3D® but with the D3DBLEND_ prefix removed.

.
Type Render state Values
DWORD ZEnable Same values as D3DZBUFFERTYPE without the D3DZB_ prefix.
DWORD FillMode Same values as D3DFILLMODE without the D3DFILL_ prefix.
DWORD ShadeMode Same values as D3DSHADEMODE without the D3DSHADE_ prefix.
DWORD LinePattern Same values as D3DLINEPATTERN.
DWORD ZWriteEnable Same values as D3DRS_ZWRITEENABLE.
DWORD AlphaTestEnable Same values as D3DRS_ALPHATESTENABLE.
DWORD LastPixel Same values as D3DRS_LASTPIXEL.
DWORD SrcBlend Same values as D3DBLEND without the D3DBLEND_ prefix.
DWORD DestBlend Same values as D3DBLEND without the D3DBLEND_ prefix.
DWORD CullMode Same values as D3DCULL without the D3DCULL_ prefix.
DWORD ZFunc Same values as D3DRS_ZFUNC without the D3DCMP_ prefix.
DWORD AlphaRef Same values as D3DRS_ALPHAREF.
DWORD AlphaFunc Same values as D3DRS_ALPHAFUNC without the D3DCMP_ prefix.
DWORD DitherEnable Same values as D3DRS_DITHERENABLE.
DWORD AlphaBlendEnable Same values as D3DRS_ALPHABLENDENABLE
DWORD FogEnable Same values as D3DRS_FOGENABLE.
DWORD SpecularEnable Same values as D3DRS_SPECULARENABLE.
DWORD ZVisible This value is not supported.
DWORD FogColor Same values as D3DRS_FOGCOLOR.
DWORD FogTableMode Same values as D3DRS_FOGTABLEMODE.
float FogStart Same values as D3DRS_FOGSTART.
float FogEnd Same values as D3DRS_FOGEND.
float FogDensity Same values as D3DRS_FOGDENSITY.
DWORD EdgeAntialias Same values as D3DRS_EDGEANTIALIAS.
int Zbias Same values as D3DRS_ZBIAS.
DWORD RangeFogEnable Same values as D3DRS_RANGEFOGENABLE.
DWORD StencilEnable Same values as D3DRS_STENCILENABLE.
DWORD StencilFail Same values as D3DRS_STENCILOP without the D3DSTENCILOP_ prefix.
DWORD StencilZFail Same values as D3DRS_STENCILZFAIL without the D3DSTENCILOP_ prefix.
DWORD StencilPass Same values as D3DRS_STENCILPASS without the D3DSTENCILOP_ prefix.
DWORD StencilFunc Same values as D3DRS_STENCILFUNC.
int StencilRef Same values as D3DRS_STENCILREF.
DWORD StencilMask Same values as D3DRS_STENCILMASK.
DWORD StencilWriteMask Same values as D3DRS_STENCILWRITEMASK.
DWORD TextureFactor Same values as D3DRS_TEXTUREFACTOR.
DWORD Wrap0 Same values as D3DWRAP0without the D3DWRAP_ prefix.
DWORD Wrap1 Same values as D3DWRAP1without the D3DWRAP_ prefix.
DWORD Wrap2 Same values as D3DWRAP2without the D3DWRAP_ prefix.
DWORD Wrap3 Same values as D3DWRAP3without the D3DWRAP_ prefix.
DWORD Wrap4 Same values as D3DWRAP4without the D3DWRAP_ prefix.
DWORD Wrap5 Same values as D3DWRAP5without the D3DWRAP_ prefix.
DWORD Wrap6 Same values as D3DWRAP6without the D3DWRAP_ prefix.
DWORD Wrap7 Same values as D3DWRAP7without the D3DWRAP_ prefix.
BOOL Clipping Same values as D3DRS_CLIPPING.
BOOL Lighting Same values as D3DRS_LIGHTING.
D3DCOLORVALUE Ambient Same values as D3DRS_AMBIENT.
DWORD FogVertexMode Same values as D3DFOGMODE without the D3DFOG_ prefix.
BOOL ColorVertex Same values as D3DRS_COLORVERTEX.
BOOL LocalViewer Same values as D3DRS_LOCALVIEWER.
BOOL NormalizeNormals Same values as D3DRS_NORMALIZENORMALS.
DWORD DiffuseMaterialSource Same values as D3DRS_DIFFUSEMATERIALSOURCE without the D3DMCS_ prefix.
DWORD SpecularMaterialSource Same values as D3DRS_SPECULARMATERIALSOURCE without the D3DMCS_ prefix.
DWORD AmbientMaterialSource Same values as D3DRS_AMBIENTMATERIALSOURCE without the D3DMCS_ prefix.
DWORD EmissiveMaterialSource Same values as D3DRS_EMISSIVEMATERIALSOURCE without the D3DMCS_ prefix.
DWORD VertexBlend Same values as D3DRS_VERTEXBLEND without the D3DVBF_ prefix.
DWORD ClipPlaneEnable Bitwise combination of CLIPPLANE0 to CLIPPLANE5
float PointSize Same values as D3DRS_POINTSIZE.
float PointSize_Min Same values as D3DRS_POINTSIZE_MIN.
float PointSize_Max D3DRS_POINTSIZE_MAX without the D3DRS_ prefix.
BOOL PointSpriteEnable Same values as D3DRS_POINTSPRITEENABLE.
BOOL PointScaleEnable D3DRS_POINTSCALEENABLE.
float PointScale_A Same values as D3DRS_POINTSCALE_A.
float PointScale_B Same values as D3DRS_POINTSCALE_B.
float PointScale_C Same values as D3DRS_POINTSCALE_C.
BOOL MultiSampleAntialias Same values as D3DRS_MULTISAMPLEANTIALIAS.
DWORD MultiSampleMask Same values as D3DRS_MULTISAMPLEMASK.
float PatchSegments Same values as D3DRS_PATCHSEGMENTS.
BOOL IndexedVertexBlendEnable Same values as D3DRS_INDEXEDVERTEXBLENDENABLE.
UINT ColorWriteEnable Bitwise combination of RED|GREEN|BLUE|ALPHA.
float TweenFactor Same values as D3DRS_TWEENFACTOR.
DWORD BlendOp Same values as D3DBLENDOP without the D3DBLENDOP_ prefix.

Texture Stage States

Type Texture stage state Values
DWORD ColorOp[8] Array of up to 8 D3DTSS_COLOROP values without the D3DTOP_ prefix.
DWORD ColorArg0[8] Array of up to 8 D3DTSS_COLORARG0 values without the D3DTA_ prefix.
DWORD ColorArg1[8] Array of up to 8 D3DTSS_COLORARG1 values without the D3DTA_ prefix.
DWORD ColorArg2[8] Array of up to 8 D3DTSS_COLORARG2 values without the D3DTA_ prefix.
DWORD AlphaOp[8] Array of up to 8 D3DTSS_ALPHAOP values without the D3DTOP_ prefix.
DWORD AlphaArg0[8] Array of up to 8 D3DTSS_ALPHAARG0 values without the D3DTA_ prefix.
DWORD AlphaArg1[8] Array of up to 8 D3DTSS_ALPHAARG1 values without the D3DTA_ prefix.
DWORD AlphaArg2[8] Array of up to 8 D3DTSS_ALPHAARG2 values without the D3DTA_ prefix.
DWORD ResultArg[8] Array of up to 8 D3DTSS_RESULTARG values without the D3DTA_ prefix.
float BumpEnvMat00[8] Array of up to 8 D3DTSS_BUMPENVMAT00 values.
float BumpEnvMat01[8] Array of up to 8 D3DTSS_BUMPENVMAT01 values.
float BumpEnvMat10[8] Array of up to 8 D3DTSS_BUMPENVMAT10 values.
float BumpEnvMat11[8] Array of up to 8 D3DTSS_BUMPENVMAT11 values.
DWORD TexCoordIndex[8] Array of up to 8 D3DTSS_TEXCOORDINDEX values without the D3DTSS_TCI prefix.
DWORD AddressU[8] Array of up to 8 D3DTEXTUREADDRESS values without the D3DTADDRESS_ prefix.
DWORD AddressV[8] Array of up to 8 D3DTEXTUREADDRESS values without the D3DTADDRESS_ prefix.
DWORD AddressW[8] Array of up to 8 D3DTEXTUREADDRESS values without the D3DTADDRESS_ prefix.
D3DCOLORVALUE BorderColor[8] Array of up to 8 D3DTSS_BORDERCOLOR values.
DWORD MagFilter[8] Array of up to 8 D3DTEXTUREFILTERTYPE values without the D3DTEXF_ prefix.
DWORD MinFilter[8] Array of up to 8 D3DTEXTUREFILTERTYPE values without the D3DTEXF_ prefix.
DWORD MipFilter[8] Array of up to 8 D3DTEXTUREFILTERTYPE values without the D3DTEXF_ prefix.
float MipMapLodBias[8] Array of up to 8 D3DTSS_MIPMAPLODBIAS values.
int MaxMipLevel[8] Array of up to 8 D3DTSS_MIPMAPLEVEL values.
DWORD MaxAnisotropy[8] Array of up to 8 D3DTSS_MAXANISOTROPY values.
float BumpEnvLScale[8] Array of up to 8 D3DTSS_BUMPENVLSCALE values.
float BumpEnvLOffset[8] Array of up to 8 D3DTSS_BUMPENVOFFSET values.
DWORD TextureTransformFlags[8] Array of up to 8 D3DTEXTURETRANSFORMFLAGS values without the D3DTTFF_ prefix.

Light States

If you set light states in your effect, you should set all states necessary to completely describe the light. States that you fail to declare are set to some default value because there is no way for Direct3D to set light states individually.

Type Light state Values
DWORD LightType[n] Array of up to n D3DLIGHTTYPE values without the D3DLIGHT_ prefix.
D3DCOLORVALUE LightDiffuse[n] Array of up to n Diffuse values.
D3DCOLORVALUE LightSpecular[n] Array of up to n Specular values.
D3DCOLORVALUE LightAmbient[n] Array of up to n Ambient values.
D3DCOLORVALUE LightPosition[n] Array of up to n Position values.
D3DCOLORVALUE LightDirection[n] Array of up to n Direction values.
float LightRange[n] Array of up to n Range values.
float LightFalloff[n] Array of up to n Falloff values.
float LightAttenuation0[n] Array of up to n Attenuation0 values.
float LightAttenuation1[n] Array of up to n Attenuation1 values.
float LightAttenuation2[n] Array of up to n Attenuation2 values.
float LightTheta[n] Array of up to n Theta values.
float LightPhi[n] Array of up to n Phi values.
BOOL LightEnable[n] Array of up to n bEnable values.

Material States

If you set material states in your effect, you should set all states necessary to completely describe the material. States that you fail to declare are set to some default value because there is no way for Direct3D to set material states individually.

Type Material state Values
D3DCOLORVALUE MaterialDiffuse Same values as Diffuse.
D3DCOLORVALUE MaterialAmbient Same values as Ambient.
D3DCOLORVALUE MaterialSpecular Same values as Specular.
D3DCOLORVALUE MaterialEmissive Same values as Emissive.
float MaterialPower Same values as Power.

Other States

Type State Values
VERTEXSHADER VertexShader Same value as VERTEXSHADER.
PIXELSHADER PixelShader Same value as PIXELSHADER.
4 floats VertexShaderConstant[n] Array of up to n constant register values.
4 floats PixelShaderConstant[n] Array of up to n constant register values.
TEXTURE Texture[8] Array of up to 8 TEXTURE values.
D3DMATRIX ProjectionTransform Same values as D3DTS_PROJECTION D3DTRANSFORMSTATETYPE without the D3DTS_ prefix.
D3DMATRIX ViewTransform Same values as D3DTS_VIEW D3DTRANSFORMSTATETYPE without the D3DTS_ prefix.
D3DMATRIX WorldTransform[256] Array of up to 256 D3DTRANSFORMSTATETYPE macros.
D3DMATRIX TextureTransform[8] Array of up to 8 D3DTRANSFORMSTATETYPE values without the D3DTS_ prefix.