Optix 6.0: Validation error: Reading attributes is not allowed from bound callable program

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 code:

// === Example Closest Hit ===

#include “optix.h”
#include “optixu/optixu_math_namespace.h”

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 ===

#include “optix.h”

rtDeclareVariable(float3, attrib_color, attribute ATTRIB_SEMANTIC_COLOR, );

RT_CALLABLE_PROGRAM float3 shade_color()
return attrib_color;

Hi @mkelley,

The decision to disallow attributes in bound callables was indeed intentional. Sorry that’s forcing you to do some refactoring.

The high level reason for the decision is because it costs some compute time and uses a couple of registers to support it. Not everyone needs attributes in their callables, so we didn’t want to inflict the performance penalty on everyone.


Thank you for the clarification, I just wanted to make sure I wasn’t missing something obvious.