public DepthBuffer AddManualDepthBuffer(Device depthSurfaceDevice, Surface depthSurface)
{
//If this depth buffer was already added, return that one
foreach (var itor in depthBufferPool[PoolId.Default].Cast<D3D9DepthBuffer>())
{
if( itor.DepthBufferSurface == depthSurface )
return itor;
}
//Nope, get the info about this depth buffer and create a new container fot it
var dsDesc = depthSurface.Description;
var newDepthBuffer = new D3D9DepthBuffer( PoolId.Default, this,
depthSurfaceDevice, depthSurface,
dsDesc.Format, dsDesc.Width, dsDesc.Height,
dsDesc.MultisampleType, dsDesc.MultisampleQuality, true );
//Add the 'main' depth buffer to the pool
depthBufferPool[newDepthBuffer.PoolId].Add(newDepthBuffer);
return newDepthBuffer;
}