MCPcopy Create free account
hub / github.com/RenderKit/embree / push

Function push

kernels/common/instance_stack.h:23–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 */
22template<typename Context>
23RTC_FORCEINLINE bool push(Context context,
24 unsigned instanceId,
25 unsigned instancePrimId)
26{
27#if RTC_MAX_INSTANCE_LEVEL_COUNT > 1
28 const bool spaceAvailable = context->instStackSize < RTC_MAX_INSTANCE_LEVEL_COUNT;
29 /* We assert here because instances are silently dropped when the stack is full.
30 This might be quite hard to find in production. */
31 assert(spaceAvailable);
32 if (likely(spaceAvailable)) {
33 context->instID[context->instStackSize] = instanceId;
34#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
35 context->instPrimID[context->instStackSize] = instancePrimId;
36#endif
37 context->instStackSize++;
38 }
39 return spaceAvailable;
40#else
41 const bool spaceAvailable = (context->instID[0] == RTC_INVALID_GEOMETRY_ID);
42 assert(spaceAvailable);
43 if (likely(spaceAvailable)) {
44 context->instID[0] = instanceId;
45#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
46 context->instPrimID[0] = instancePrimId;
47#endif
48 }
49 return spaceAvailable;
50#endif
51}
52
53/*
54 * Pop the last instance pushed to the stack.

Callers 14

intersect_instanceFunction · 0.85
intersectMethod · 0.85
occludedMethod · 0.85
pointQueryMethod · 0.85
intersectMethod · 0.85
occludedMethod · 0.85
pointQueryMethod · 0.85
rtcForwardIntersect1ExFunction · 0.85
rtcForwardIntersectNFunction · 0.85
rtcForwardOccluded1ExFunction · 0.85

Tested by

no test coverage detected