#version 310 es
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;

layout(binding = 0, std430) readonly buffer Distribution
{
    vec2 distribution[];
} _137;

layout(binding = 2, std140) uniform UBO
{
    vec4 uModTime;
} _166;

layout(binding = 1, std430) writeonly buffer HeightmapFFT
{
    uint heights[];
} _225;

void main()
{
    uvec2 _264 = uvec2(64u, 1u) * gl_NumWorkGroups.xy;
    uvec2 _269 = _264 - gl_GlobalInvocationID.xy;
    bvec2 _271 = equal(gl_GlobalInvocationID.xy, uvec2(0u));
    uint _454;
    if (_271.x)
    {
        _454 = 0u;
    }
    else
    {
        _454 = _269.x;
    }
    uint _455;
    if (_271.y)
    {
        _455 = 0u;
    }
    else
    {
        _455 = _269.y;
    }
    uint _276 = _264.x;
    uint _280 = (gl_GlobalInvocationID.y * _276) + gl_GlobalInvocationID.x;
    uint _290 = (_455 * _276) + _454;
    vec2 _297 = vec2(gl_GlobalInvocationID.xy);
    vec2 _299 = vec2(_264);
    float _309 = sqrt(9.81000041961669921875 * length(_166.uModTime.xy * mix(_297, _297 - _299, greaterThan(_297, _299 * 0.5)))) * _166.uModTime.z;
    vec2 _316 = vec2(cos(_309), sin(_309));
    vec2 _387 = _316.xx;
    vec2 _392 = _316.yy;
    vec2 _395 = _392 * _137.distribution[_280].yx;
    vec2 _421 = _392 * _137.distribution[_290].yx;
    vec2 _429 = (_137.distribution[_290] * _387) + vec2(-_421.x, _421.y);
    _225.heights[_280] = packHalf2x16(((_137.distribution[_280] * _387) + vec2(-_395.x, _395.y)) + vec2(_429.x, -_429.y));
}

