#pragma MSP stage(vertex) layout(location=0) in vec4 position; layout(location=1) in vec3 direction; void main() { vec3 p = position.xyz; int step = -1; for(int i=0; i<10; ++i) { float scale = 2.0; p += direction*scale; if(p.z<0.0) break; step = i; } gl_Position = position+vec4(step, 0.0, 0.0, 0.0); } /* Expected output: vertex layout(location=0) in vec4 position; layout(location=1) in vec3 direction; void main() { vec3 p = position.xyz; int step = -1; for(int i=0; i<10; ++i) { p += direction*2.0; if(p.z<0.0) break; step = i; } gl_Position = position+vec4(step, 0.0, 0.0, 0.0); } */