cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

svnfulcr
Journeyman III

GLSL bug in 18.3.4 drivers: Variable expected

Hello,

I've found a reproducible GLSL bug that still happens after updating to the 18.3.4 drivers. It occurs when a global variable and a for-loop variable share the same name, with some additional complexity. I've cut the code down to the following minimal sample that doesn't do anything useful but still triggers the error:

float a=0;

void main()

{

    for(int a=0;a<10;a++)

        if(a==9)

            break;         

    a=0;    

    gl_FragColor.rgb=vec3(a);

   }

The error is "Variable expected:a" on the line "a=0;" Clearly, at this point the local "a" should already be out of scope and the global "a" should be used, but for some reason the compiler is confused. Removing the "a=0;" line causes the bug to vanish, as does removing the "if(a==9)" line (probably then the entire loop gets optimized away).

Greets,

Svn/Fulcr

0 Likes
1 Reply
xhuang
Staff

Hello svnfulcr, thank you for your report, we'll have engineer work on this.

0 Likes