/*
 * Copyright (c) Contributors to the Open 3D Engine Project.
 * For complete copyright and license terms please see the LICENSE at the root of this distribution.
 *
 * SPDX-License-Identifier: Apache-2.0 OR MIT
 *
 */

#include <Atom/Features/SrgSemantics.azsli>

ShaderResourceGroup PassSrg : SRG_PerPass
{
    Texture2D<float4> m_inputTexture;
    RWTexture2D<float4> m_outputTexture;
}

[numthreads(8,8,1)]
void MainCS(uint3 dispatch_id: SV_DispatchThreadID)
{
    // Calculate which pixel this thread maps to
    uint2 textureDimensions;
    PassSrg::m_inputTexture.GetDimensions(textureDimensions.x, textureDimensions.y);
    uint2 pixel = min(dispatch_id.xy, textureDimensions.xy);

    // Sample the color
    float4 color = PassSrg::m_inputTexture[pixel];

    // Invert the color
    color = 1.0f - color;

    // Output the color
    PassSrg::m_outputTexture[pixel] = color;
}