public void Draw(RenderDrawContext context, float sigmaRatio, Texture inputTexture, Texture outputTexture) { // Check if we need to regenerate offsetsWeights if (offsetsWeights == null || this.sigmaRatio != sigmaRatio) { offsetsWeights = GaussianUtil.Calculate1D(Radius, sigmaRatio); // Update parameters blurH.Parameters.Set(GaussianBlurShaderKeys.OffsetsWeights, offsetsWeights); blurV.Parameters.Set(GaussianBlurShaderKeys.OffsetsWeights, offsetsWeights); this.sigmaRatio = sigmaRatio; } // Get a temporary texture for the intermediate pass // This texture will be allocated only in the scope of this draw and returned to the pool at the exit of this method var desc = inputTexture.Description; desc.MultisampleCount = MultisampleCount.None; // TODO we should have a method to get a non-multisampled RT var outputTextureH = gaussianBlur.NewScopedRenderTarget2D(desc); // Horizontal pass blurH.SetInput(inputTexture); blurH.SetOutput(outputTextureH); blurH.Draw(context, nameGaussianBlurH); // Vertical pass blurV.SetInput(outputTextureH); blurV.SetOutput(outputTexture); blurV.Draw(context, nameGaussianBlurV); }