Click or drag to resize
DigitalRuneEffectTechniqueDescriptionInstancingTechnique Property
Gets the associated effect technique that supports hardware instancing.

Namespace: DigitalRune.Graphics.Effects
Assembly: DigitalRune.Graphics (in DigitalRune.Graphics.dll) Version: 1.2.0.0 (1.2.1.14562)
Syntax
public EffectTechnique InstancingTechnique { get; }

Property Value

Type: EffectTechnique
The effect technique that supports hardware instancing, or if there is no associated technique that supports hardware instancing.
Remarks

An effect technique in a DirectX Effect may reference another technique, which supports instancing. This technique needs to have the same name plus the postfix "Instancing". Example:

// Technique without hardware instancing
technique MyTechnique
{
    pass
    {
        VertexShader = compile vs_2_0 VS();
        PixelShader = compile ps_2_0 PS();
    }
}

// Equivalent of MyTechnique that supports hardware instancing.
technique MyTechniqueInstancing
{
    pass
    {
        VertexShader = compile vs_3_0 HardwareInstancingVS();
        PixelShader = compile ps_3_0 PS();
    }
}

Alternatively, the technique can also be identified by adding an effect annotation to the effect technique:

// Default technique without hardware instancing
technique MyTechnique
<
    // There is an equivalent of this technique that supports hardware instancing.
    string InstancingTechnique = "HardwareInstancing"; 
>
{
    pass
    {
        VertexShader = compile vs_2_0 VS();
        PixelShader = compile ps_2_0 PS();
    }
}

// Hardware instancing technique.
technique HardwareInstancing
{
    pass
    {
        VertexShader = compile vs_3_0 HardwareInstancingVS();
        PixelShader = compile ps_3_0 PS();
    }
}
Caution note Caution

MonoGame currently does not support effect annotations. Therefore, this only works in XNA.

The EffectTechniqueDescription checks the names and annotations and will automatically resolve the technique for hardware instancing and store the reference in InstancingTechnique. The MeshRenderer and custom renderers can check this property, to see if hardware instancing is supported.

See Also