public override void BindSurface( int attachment, RenderTexture target )
{
Contract.Requires( attachment < Config.MaxMultipleRenderTargets );
// Get buffer and surface to bind to
D3DHardwarePixelBuffer buffer = (D3DHardwarePixelBuffer)( target[ "BUFFER" ] );
Proclaim.NotNull( buffer );
// Find first non null target
int y;
for ( y = 0; y < Config.MaxMultipleRenderTargets && this._targets[ y ] == null; y++ )
;
if ( y != Config.MaxMultipleRenderTargets )
{
if ( this._targets[ y ].Width != buffer.Width
&& this._targets[ y ].Height != buffer.Height
&& PixelUtil.GetNumElemBits( this._targets[ y ].Format ) != PixelUtil.GetNumElemBits( this._targets[ y ].Format ) )
{
throw new AxiomException( "MultiRenderTarget surfaces are not the same size or bit depth." );
}
}
this._targets[ attachment ] = buffer;
this.CheckAndUpdate();
}