GLSL compiler error

I get the strangest error when trying to compile the following code:

void pack_u16(in float depth, out float byte_a, out float byte_b)
{        
    float tmp = depth / 256.0f;
    byte_a = floor(tmp) / 256.0f;
    byte_b = frac(tmp);
    
}

float unpack_u16(in float byte_a, in float byte_b)
{
    return ((byte_a * 256.0f) * 256.0f) + (byte_b * 256.0f);
}

void pack_16bit_normal_component(in float n, out float byte_a, out float byte_b)
{
    n = ((n * 0.5f) + 0.5f) * 65535.0f;

    pack_u16(n, byte_a, byte_b);
}

float unpack_16bit_normal_component(in float byte_a, in float byte_b)
{
    return ((unpack_u16(byte_a, byte_b) / 65535.0f) - 0.5f) * 2.0f;
}

vec4 pack_normalxy_into_rgba8(float normal1, float normal2)
{
    vec4 ret;
    pack_16bit_normal_component(normal1, ret.x, ret.y);
    pack_16bit_normal_component(normal2, ret.z, ret.w);
    return ret;
}

vec4 unpack_normalxy_from_rgba8(vec4 packed)
{
    return vec4(  unpack_16bit_normal_component(packed.x, packed.y),
                    unpack_16bit_normal_component(packed.z, packed.w),
                    0.0f,
                    0.0f);
}

The error I get is:

0(297) : error C1012: abstract parameters not allowed in function definition “unpack_normalxy_from_rgba8”

I’ve tried to figure out what an abstract parameter even means, but I assume it suggests ‘vec4’ is not defined in the context? I’m using 64-bit W7 with a GTX 690 driver version 320.18.

It works perfectly fine on my other ATI card.

Thanks in advance.

Solved it!

It turned out you cannot use variables with name ‘packed’. The compiler doesn’t complain about it being a reserved keyword, however it fails to compile with

C0000: syntax error, unexpected ‘.’ expecting ‘::’ at token ‘.’.

I did a find and replaced on packed and it worked out just fine. The function was actually:

vec4 PackObjectDepth(in float ObjectId, in float NormalGroupId, in float depth)
{    
    vec4 packed;
    packed.x = ObjectId;
    packed.y = NormalGroupId;
    // we packedto multiply the depth by a factor, otherwise we would have a raster on small distances
    // normal minimal raster is 1 / 255 (0.00392)
    depth = depth * depthScale;
    pack_u16(depth, packed.z, packed.w);
    return packed;
}

ARE YOU SERIOUS NVIDIA ??
It’s been more than 15 years now and this is still actual ?? This makes no sense. I banged my head on the wall because of this compilation error only to eventually find someone that worked around this nonsense by themselves.

At least add a warning

Nvidia are not responsible for the opengl standard treating packed as a storage qualifier to influence struct alignment.