Hi there, I’m trying to use callable programs to implement light sources in my renderer. I have a simple dome light implementation in light_infinite_area.cu:
#include "lights.h"
#include "raydata.h"
using namespace optix;
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 = make_float3(1.0f);
ls.pdf = 1.0f;
return ls;
}
It all compiles fine, along with the rest of my cuda that also depends on the lights.h and raydata.h headers, but when I try to load it with
RTprogram prg;
RTresult res = rtProgramCreateFromPTXFile(_ctx, "light_infinite_area.ptx", "light_sample", &prg);
the result is RT_INVALID_SOURCE. The API docs don’t mention what this return code means exactly, and I can’t see anything immediately wrong with my code from comparing it to the callable example program.
I’m using OptiX 4.0.2 on OS X 10.11.6
Cheers,
Anders