Effect State Groups (Direct3D 11)

Effect states are name value pairs in the form of an expression.

Blend State

Effect state Group
ALPHATOCOVERAGEENABLEBLENDENABLESRCBLENDDESTBLENDBLENDOP SRCBLENDALPHADESTBLENDALPHABLENDOPALPHARENDERTARGETWRITEMASK Members of D3D11_BLEND_DESC

 

Depth and Stencil State

Effect state Group
DEPTHENABLEDEPTHWRITEMASKDEPTHFUNCSTENCILENABLESTENCILREADMASKSTENCILWRITEMASK Members of D3D11_DEPTH_STENCIL_DESC
FRONTFACESTENCILFAILFRONTFACESTENCILZFAILFRONTFACESTENCILPASSFRONTFACESTENCILFUNCBACKFACESTENCILFAILBACKFACESTENCILZFAILBACKFACESTENCILPASSBACKFACESTENCILFUNC Member of D3D11_DEPTH_STENCILOP_DESC

 

Rasterizer State

Effect state Group
FILLMODE D3D11_FILL_MODE
CULLMODE D3D11_CULL_MODE
FRONTCOUNTERCLOCKWISEDEPTHBIASDEPTHBIASCLAMPSLOPESCALEDDEPTHBIAS ZCLIPENABLESCISSORENABLEMULTISAMPLEENABLEANTIALIASEDLINEENABLE Members of D3D11_RASTERIZER_DESC

 

Sampler State

Effect state Group
Filter AddressU AddressV AddressW MipLODBias MaxAnisotropy ComparisonFunc BorderColor MinLOD MaxLOD Members of D3D11_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_STENCILREFAB_BLENDFACTORAB_SAMPLEMASK Members of D3DX11_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 11). 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 );
    

Effect Technique Syntax

Effect Format (Direct3D 11)