I’ve recently started upgrading from OptiX 5.1 to 6.0 and ran into an unexpected issue. My bound callable programs that reference attribute variables are failing validation with the following error: “Validation error: Reading attributes is not allowed from bound callable program”.
Our closest hit and any hit programs use several bound callable programs to abstract how the materials calculate the payload. If this change is intentional we’d need to refactor how that works.
I wanted to confirm that this was in fact intentional (which seems likely since there’s a nice error message for it), and also to understand the rationale for the change. Previous versions and documentation explicitly states that this is supported.
// === Example Closest Hit ===
typedef rtCallableProgramX<float3()> TFloat3Func;
rtDeclareVariable(float4, ray_payload, rtPayload, );
rtDeclareVariable(TFloat3Func, shade_color_func, , );
RT_PROGRAM void closest_hit_program()
ray_payload = make_float4(shade_color_func(), 1.0f);
// === Example callable ===
rtDeclareVariable(float3, attrib_color, attribute ATTRIB_SEMANTIC_COLOR, );
RT_CALLABLE_PROGRAM float3 shade_color()