/*
 * 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
 *
 */

ShaderResourceGroupSemantic SRG_Frequency0
{
    FrequencyId = 0;
};

ShaderResourceGroup DispatchSRG : SRG_Frequency0
{
    float m_time;
    struct BufferData
    {
        float4 m_data;
    };
    RWStructuredBuffer<BufferData> m_IABuffer;
};

[numthreads(1,1,1)]
void MainCS(uint3 thread_id: SV_DispatchThreadID)
{
    float lerpValue = (sin(DispatchSRG::m_time) + 1) * 0.5;
    float yCoord = 0.5 * sqrt(3);
    DispatchSRG::m_IABuffer[0].m_data = float4(lerp(-1.0, -0.5, lerpValue), 0, 0, 1.0);
    DispatchSRG::m_IABuffer[1].m_data = float4(-0.5, yCoord, 0, 1.0);
    DispatchSRG::m_IABuffer[2].m_data = float4(-0.5, -yCoord, 0, 1.0);
    DispatchSRG::m_IABuffer[3].m_data = float4(0.5, yCoord, 0, 1.0);
    DispatchSRG::m_IABuffer[4].m_data = float4(0.5, -yCoord, 0, 1.0);
    DispatchSRG::m_IABuffer[5].m_data = float4(lerp(1.0, 0.5, lerpValue), 0, 0, 1.0);
}