Environment:
- Windows 10 version 1803
- nVidia GeForce GTX 780 Ti
- Latest driver 398.36 installed
- Visual Studio 2015 Update 3
- OpenGL 4.6
GLSL Source:
#version 460 core
in vec4 vPos;
void
main()
{
float coeff[];
int i,j;
coeff[7] = 2.38;
i=coeff.length();
coeff[9] = 4.96;
j=coeff.length();
if(i<j)
gl_Position = vPos;
}
My expectation is that i is 8 and j is 10 so gl_Position = vPos; should be executed, but shader debugging using Nsight shows me that both i and j are 10 so gl_Position = vPos; is bypassed for all vertices. What is the matter? Is it related to compiler optimization? If I want GLSL to be compiled as expected (i<j is true), how to fix the code? Thanks.