acceleration structure doesn't render in gpu trace

I've got a scene which renders as I expect:

but in the acceleration structure inspector, the kraken primitive doesn't render:

In the list on the left, the structure is there. As expected, there is just one bounding-box primitive as a lot happens in the intersection function (doing it this way since I've already built my own octree and it takes too long to rebuild BVHs for dynamic geometry)

This is just based on the SimplePathTracer example.

The signatures of the sphereIntersectionFunction and octreeIntersectionFunction aren't that different:

[[intersection(bounding_box, triangle_data, instancing)]]
BoundingBoxIntersection sphereIntersectionFunction(// Ray parameters passed to the ray intersector below
                                                   float3 origin                        [[origin]],
                                                   float3 direction                     [[direction]],
                                                   float minDistance                    [[min_distance]],
                                                   float maxDistance                    [[max_distance]],
                                                   // Information about the primitive.
                                                   unsigned int primitiveIndex          [[primitive_id]],
                                                   unsigned int geometryIndex [[geometry_intersection_function_table_offset]],
                                                   // Custom resources bound to the intersection function table.
                                                   device void *resources               [[buffer(0), function_constant(useResourcesBuffer)]]
#if SUPPORTS_METAL_3
                                                   ,const device Sphere* perPrimitiveData [[primitive_data]]
#endif
                                                   ,ray_data IntersectionPayload& payload     [[payload]])
{

vs.

[[intersection(bounding_box, triangle_data, instancing)]]
BoundingBoxIntersection octreeIntersectionFunction(// Ray parameters passed to the ray intersector below
                                                  float3 origin               [[origin]],
                                                  float3 direction            [[direction]],
                                                  float minDistance           [[min_distance]],
                                                  float maxDistance           [[max_distance]],
                                                  // Information about the primitive.
                                                  unsigned int primitiveIndex [[primitive_id]],
                                                  unsigned int geometryIndex  [[geometry_intersection_function_table_offset]],
                                                  // Custom resources bound to the intersection function table.
                                                  device void *resources [[buffer(0)]],
                                                  const device BlockInfo* perPrimitiveData [[primitive_data]],
                                                  ray_data IntersectionPayload& payload     [[payload]])

Note: running 15.0 beta 5 (15A5209g) since even the unmodified SimplePathTracer example project will hang the acceleration structure viewer on Xcode 14.

Update:

Replacing the octreeIntersectionFunction's code with just a hard-coded sphere does render. Perhaps the viewer imposes a time (or instruction count) limit on intersection functions so as to not hang the GPU?

  • Are you using the payload in a non-trivial way? The Acceleration Structure Viewer in 15A5209g uses a payload of zeros.

  • @Graphics and Games Engineer I'm using this for my payload for both intersection functions:

    typedef struct { vector_float3 normal; vector_float3 color; } IntersectionPayload;

    (sorry I can't seem to get the code block to render correctly). It just returns the surface normal and color from the intersection function. I think that's a trivial usage.

  • Hi, can you share the gputrace to us by filing Feedback Assistant report? To do this when viewing the gputrace, in Xcode's menubar go to Help > Provide Feedback… Please share the feedback assistant report ID here so we can take a deeper look.