I have a light sampling program like so:
rtDeclareVariable(float3, L_e, , );
rtDeclareVariable(rtCallableProgramId<float3()>, get_color, , );
RT_CALLABLE_PROGRAM LightSample light_sample(const float3 p, const Onb onb, const float u1, const float u2) {
LightSample ls;
float3 omega_l;
cosine_sample_hemisphere(u1, u2, omega_l);
ls.omega_i = normalize(omega_l.z * onb.m_normal + omega_l.x * onb.m_tangent + omega_l.y * onb.m_binormal);
/*ls.L_i = L_e;*/ //< this works fine
ls.L_i = get_color(); //< this also works fine, but only if get_color() returns a hard-coded value
ls.pdf = 1.0f;
return ls;
}
the callable program get_color is defined like so:
rtDeclareVariable(float3, in_color, , );
RT_CALLABLE_PROGRAM float3 get_color() {
/* returning the float3 directly here works, returning the variable doesn't */
/*return make_float3(0.2f, 0.5f, 1.0f);*/
return in_color;
}
I can set the variable L_e in the light_sample program and everything works, and if construct and return a hard-coded value in get_color(), that works too, but trying to read from the in_color variable doesn’t work - the function just returns (0,0,0). Both L_e and in_color are set in the exact same way on their respective programs.
Everything validates correctly and no exceptions fire. I’m using OptiX 4.0.2 with cuda 8 on a sm_30 card on OS X. Any ideas?