Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion kernels/common/instance_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ RTC_FORCEINLINE bool push(RTCPointQueryContext* context,
{
assert(context);
const size_t stackSize = context->instStackSize;
assert(stackSize < RTC_MAX_INSTANCE_LEVEL_COUNT);

/* We assert here because instances are silently dropped when the stack is full.
This might be quite hard to find in production. */
const bool spaceAvailable = stackSize < RTC_MAX_INSTANCE_LEVEL_COUNT;
assert(spaceAvailable);
if (unlikely(!spaceAvailable))
return false;

context->instID[stackSize] = instanceId;
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
context->instPrimID[stackSize] = instancePrimId;
Expand Down
Loading