/// <summary> /// Prepares a render target to hold the result of this pass. /// </summary> public override RenderTarget2D PrepareRenderTarget(GraphicsDevice graphics, Texture2D input, SurfaceFormat?preferredFormat) { int w, h; if (renderTargetSize.HasValue) { w = (int)renderTargetSize.Value.X; h = (int)renderTargetSize.Value.Y; } else { if (input != null) { w = input.Width; h = input.Height; } else { w = graphics.Viewport.Width; h = graphics.Viewport.Height; } } var format = surfaceFormat ?? preferredFormat ?? (input != null ? input.Format : graphics.PresentationParameters.BackBufferFormat); return(RenderTargetPool.GetRenderTarget(graphics , (int)(w * renderTargetScale) , (int)(h * renderTargetScale) , format , DepthFormat.None)); }