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.