Imagination PowerVR SDK Blog

Fragment Shader Compile Error...


#1

mediump float UnPackRGBAToFloat(const mediump vec4 v)
{

    const mediump vec4 vTest = vec4(1.0);
    const mediump vec4 vBitShift = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);
    return (dot(v, vBitShift));
}
void main()
{

    gl_FragColor = vec4(1.0);
}




 

which outputs 'Compile failed', but doesn't explain why...

 

If I comment out 'const' keyword(red only) like

 

mediump float UnPackRGBAToFloat(const mediump vec4 v)
{

    const mediump vec4 vTest = vec4(1.0);
    mediump vec4 vBitShift = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);

    ......

 

which outputs 'Success'...

 

I don't know why...

#2

This looks like it may be a compiler bug so I’ve put it into our system for further investigation (BRN28628).





Obviously, the workaround is not to use const for this line. Thanks for the report.Gordon2009-10-23 10:44:15