public RenderTarget2D UpdateRenderTarget(RenderTarget2D renderTarget, IGameContext gameContext)
{
if (IsRenderTargetOutOfDate(renderTarget, gameContext))
{
if (renderTarget != null)
{
renderTarget.Dispose();
}
if (gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferWidth == 0 &&
gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferHeight == 0)
{
return null;
}
renderTarget = new RenderTarget2D(
gameContext.Graphics.GraphicsDevice,
gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferWidth,
gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferHeight,
false,
gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferFormat,
gameContext.Graphics.GraphicsDevice.PresentationParameters.DepthStencilFormat,
gameContext.Graphics.GraphicsDevice.PresentationParameters.MultiSampleCount,
RenderTargetUsage.PreserveContents);
}
return renderTarget;
}