Calling a rtcallable program makes local variable nonsense.
rtCallableProgram(void, xs_eval, (int, CMPTYPE, CMPTYPE, CMPTYPE*,CMPTYPE*,CMPTYPE* ));
RT_PROGRAM void generate_ray()
{
float x;
x = 12;
for(istep=0;istep<steps;i++){
printf(x); //first print
x+=1;
printf(x); //second print
for(i=0;i<M;i++){ //M>=1
xs_eval(.....);
}
printf(x); //third print
}
}
If steps=1, the 3 prints are 12,13,13;
If steps=2, the 3 prints in 2 loops are 12,13,12;12,13,12;
If value of steps is passed with a rtVariable, even when steps = 1, the 3 prints are 12,13,12.
If xs_eval() is not invoked, x values agree with expectation.