// https://github.com/aras-p/glsl-optimizer/issues/49 uniform int loopNum; void main() { int myIdx; vec4 r = vec4(0.0); myIdx = 1; for ( ; myIdx < loopNum; ++myIdx) { r.x += 1.0; r.y += 2.0; r.z += 3.0; } myIdx = 2; for ( ; myIdx < loopNum; ++myIdx) { r.x += 1.0; r.y += 2.0; r.z += 3.0; } gl_FragColor = r; }