public override void GetBestDepthStencil( All internalFormat, out All depthFormat, out All stencilFormat )
{
FormatProperties props = _props[ (int)internalFormat ];
/// Decide what stencil and depth formats to use
/// [best supported for internal format]
int bestmode = 0;
int bestscore = 1;
for ( int mode = 0; mode < props.Modes.Count; mode++ )
{
int desirability = 0;
/// Find most desirable mode
/// desirability == 0 if no depth, no stencil
/// desirability == 1000...2000 if no depth, stencil
/// desirability == 2000...3000 if depth, no stencil
/// desirability == 3000+ if depth and stencil
/// beyond this, the total numer of bits (stencil+depth) is maximised
if ( props.Modes[ mode ].Stencil != 0 )
desirability += 1000;
if ( props.Modes[ mode ].Depth != 0 )
desirability += 2000;
if ( DepthBits[ props.Modes[ mode ].Depth ] == 24 ) // Prefer 24 bit for now
desirability += 500;
if ( DepthFormats[ props.Modes[ mode ].Depth ] == All.Depth24Stencil8Oes ) // Prefer 24/8 packed
desirability += 5000;
desirability += StencilBits[ props.Modes[ mode ].Stencil ] + DepthBits[ props.Modes[ mode ].Depth ];
if ( desirability > bestscore )
{
bestscore = desirability;
bestmode = mode;
}
}//end for mode
depthFormat = DepthFormats[ props.Modes[ bestmode ].Depth ];
stencilFormat = StencilFormats[ props.Modes[ bestmode ].Stencil ];
}