// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.

namespace Stride.Rendering.Images
{
    compose DepthAwareDirectionalBlurShader blurShader;

    /// <summary>
    /// Optimized version of the McIntosh bokeh effect. 
    /// Based on a first blur pass, computes the 2 diagonal blurs and keeps the minimum. 
    /// Expects as input: 
    ///  - Texture0: a color buffer with a first directional blur
    ///  - Texture1: the corresponding depth buffer
    /// </summary>
    shader McIntoshOptimizedShader : ImageEffectShader
    {
        compose ComputeColor directionalBlurA;
        compose ComputeColor directionalBlurB;

        stage override float4 Shading()
        {
            // First diagonal blur
            float4 blurColorA = directionalBlurA.Compute();

            // Second diagonal blur
            float4 blurColorB = directionalBlurB.Compute();

            return min(blurColorA, blurColorB);
        }
    };
}
