Hi,
Can’t I declare a bindless callable program as a member of a struct/class?
The following code fails to compile:
class MyClass {
typedef rtCallableProgramId<void()> ProgSig;
ProgSig m_callableProgram;
public:
__device__ MyClass(int32_t cpId) : m_callableProgram((ProgSig)cpId) {}
__device__ void func() const {
m_callableProgram();
}
};
Error Message:
no instance of overloaded function “optix::callableProgramId<ReturnT ()>::operator() [with ReturnT=void]” matches the argument list and object (the object has type qualifiers that prevent a match)
It seems possible to avoid the error by casting the ID in each function:
class MyClass {
typedef rtCallableProgramId<void()> ProgSig;
int32_t m_cpId;
public:
__device__ MyClass(int32_t cpId) : m_cpId(cpId) {}
__device__ void func() const {
ProgSig callableProgram = (ProgSig)m_cpId;
callableProgram();
}
};