Windows Dev Center

Effect Technique Syntax (Direct3D 10)

An effect technique is declared with the following syntax.

technique10 TechniqueName [ <Annotations > ]

{

pass PassName [ <Annotations > ]

{

[ SetStateGroup; ]
[ SetStateGroup; ]
...
[ SetStateGroup; ]
}

}

Parameters

technique10

Required keyword.

TechniqueName

Optional. An ASCII string that uniquely identifies the name of the effect technique.

Annotations

[in] Optional. One or more pieces of user-supplied information (metadata) that is ignored by the effect system. For syntax, see Annotation Syntax (Direct3D 10).

pass

Required keyword.

PassName

[in] Optional. An ASCII string that uniquely identifies the name of the pass.

SetStateGroup

[in] Set one or more state groups such as:

StateGroupSyntax
Blend State

SetBlendState( arguments ); 

See OMSetBlendState for the argument list.

Depth-stencil State

SetDepthStencilState( arguments ); 

See OMSetDepthStencilState for the argument list.

Rasterizer State

SetRasterizerState( arguments ); 

See RSSetState for the argument list.

Shader State

SetXXXShader( CompileShader( shader_profile, ShaderFunction( args ) ) );

or


SetXXXShader( CompileShader( NULL ) );

or


SetXXXShader( NULL );

SetXXXShader is one of SetVertexShader, SetGeometryShader, or SetPixelShader (which are similar to the API methods VSSetShader, GSSetShader, and PSSetShader).

 

Effect state groups are listed in effect state.

Examples

This example (from CubeMapGS sample) sets blending state.


BlendState NoBlend
{ 
    BlendEnable[0] = False;
};

...

technique10
{
    pass p2 
    {
	    ...
        SetBlendState( NoBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );
    }
}

This example sets up the rasterizer state to render an object in wireframe.


RasterizerState rsWireframe { FillMode = WireFrame; };

...

technique10
{
    pass p1 
    {
	    ....
        SetRasterizerState( rsWireframe );
    }
}

This example sets shader state (from BasicHLSL10 sample); which uses a vertex and pixel shader.


technique10 RenderSceneWithTexture1Light
{
    pass P0
    {
        SetVertexShader( CompileShader( vs_4_0, RenderSceneVS( 1, true, true ) ) );
        SetGeometryShader( NULL );
        SetPixelShader( CompileShader( ps_4_0, RenderScenePS( true ) ) );
    }
}

 

 

Community Additions

ADD
Show:
© 2015 Microsoft