Effect state groups (Direct3D 10)
Effect states are name-value pairs in the form of an expression.
Blend state
Effect state | Group |
---|---|
ALPHATOCOVERAGEENABLE, BLENDENABLE, SRCBLEND, DESTBLEND, BLENDOP, SRCBLENDALPHA, DESTBLENDALPHA, BLENDOPALPHA, RENDERTARGETWRITEMASK | Members of D3D10_BLEND_DESC |
Depth and stencil state
Effect state | Group |
---|---|
DEPTHENABLE, DEPTHWRITEMASK, DEPTHFUNC, STENCILENABLE, STENCILREADMASK, STENCILWRITEMASK | Members of D3D10_DEPTH_STENCIL_DESC |
FRONTFACESTENCILFAIL, FRONTFACESTENCILZFAIL, FRONTFACESTENCILPASS, FRONTFACESTENCILFUNC, BACKFACESTENCILFAIL, BACKFACESTENCILZFAIL, BACKFACESTENCILPASS, BACKFACESTENCILFUNC | Member of D3D10_DEPTH_STENCILOP_DESC |
Rasterizer state
Effect state | Group |
---|---|
FILLMODE | D3D10_FILL_MODE |
CULLMODE | D3D10_CULL_MODE |
FRONTCOUNTERCLOCKWISE, DEPTHBIAS, DEPTHBIASCLAMP, SLOPESCALEDDEPTHBIAS, ZCLIPENABLE, SCISSORENABLE, MULTISAMPLEENABLE, ANTIALIASEDLINEENABLE | Members of D3D10_RASTERIZER_DESC |
Sampler state
Effect state | Group |
---|---|
Filter, AddressU, AddressV, AddressW, MipLODBias, MaxAnisotropy, ComparisonFunc, BorderColor, MinLOD, MaxLOD | Members of D3D10_SAMPLER_DESC |
See Sampler type (DirectX HLSL) for examples.
Effect object state
This effect object | Maps to |
---|---|
RASTERIZERSTATE | A Rasterizer State state object. |
DEPTHSTENCILSTATE | A Depth and Stencil State state object. |
BLENDSTATE | A Blend State state object. |
VERTEXSHADER | A compiled vertex shader object. |
PIXELSHADER | A compiled pixel shader object. |
GEOMETRYSHADER | A compiled geometry shader object. |
DS_STENCILREF AB_BLENDFACTOR AB_SAMPLEMASK | Members of D3D10_PASS_DESC. |
Defining and using state objects
State objects are declared in FX files in the following format. StateObjectType is one of the states listed above, and MemberName is the name of any member that will have a non-default value.
StateObjectType ObjectName {
MemberName = value;
...
MemberName = value;
};
For example, to set up a blend state object with AlphaToCoverageEnable and BlendEnable[0] set to FALSE, the following code would be used.
BlendState NoBlend {
AlphaToCoverageEnable = FALSE;
BlendEnable[0] = FALSE;
};
The state object is applied to a technique pass using one of the SetStateGroup functions described in Effect Technique Syntax (Direct3D 10). For example, to apply the BlendState object described above the following code would be used.
SetBlendState( NoBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );
For a tutorial describing the use of states see State management.