Raytracing bugs on M1

Hi, I'm working on integrating Rayquery, into my game-engine. Vulkan/DX12 work fine on PC, but Metal(on Mac) doesn't:

Here is screenshot on how rendering looks:

And similar spot from XCode-debugger shows:

Ship, cannons, items are there - TLAS look as they should. Note: in game screenshoot above there are no shadows, but it not always the case:

Here only some parts of object do cast shadow.

Fragment shader: https://shader-playground.timjones.io/44de178b7b8a715ea235c7f12cd0aabc

// relevant part
bool isShadow(...)
{
    ...
    uint flags = 4u;
    flags |= 128u;
    rayQuery.reset(ray(rayOrigin, rayDirection, tMin, rayDistance), topLevelAS, spvMakeIntersectionParams(flags));
    for (;;) // spirv-cross not pretty here :(
    {
        bool _116 = rayQuery.next();
        if (_116)
        {
            continue;
        }
        else
        {
            break;
        }
    }
    
    uint _120 = uint(rayQuery.get_committed_intersection_type());
    if (_120 == 0u)
    {
        return false;
    }
    return true;
}
----
intersection_params spvMakeIntersectionParams(uint flags)
{
    // hacked this part, while debugging - setting up for simple most any-hit
    intersection_params ip;
    ip.force_opacity(forced_opacity::opaque);
    ip.accept_any_intersection(true);
    return ip;
}

After verifying TLAS and ray-query loop can conclude, that most likely it's a driver bug here, or generated shader code is wrong (but looks correct to me!).

PS: one more small thing about Metal-RT: Metal doc about MTL::AccelerationStructureTriangleGeometryDescriptor::setIndexBufferOffset says: "Specify an offset that is a multiple of the index data type size and a multiple of the platform’s buffer offset alignment." Buffer-offset-alignment (32 bytes in worst case) is very hard to workaround for multi-material meshes . No other api requires so, and there is no good workaround for this.

UPD: macOS ventura 13.0.1 (22A400); no messages in validation layer

Is there any chance I can ask for a Feedback Assistant with a repro for this one? If the acceleration structure shows up in the viewer, at least the structure itself should be correct.

I'm not sure how to use Feedback-assistant, in this case: open XCode and click report bug? In mean time: project is opensource: https://github.com/Try/OpenGothic, so you can just grab sources from github

The Feedback Assistant application on your Mac can be found using Spotlight (command space). Alternatively it is available online at http://feedbackassistant.apple.com . Filing a feedback report here with a repro will get the issue routed to the engineers that will need to take a deeper diagnose at this. If you file a feedback assistant report, please post the feedback ID on here. Thanks!

Feedback id: FB12487682

I took a look at your gputrace but don't see any useResource calls for the primitive acceleration structures. When using an instanced acceleration structure, be sure to call useResource or useHeap to make the acceleration structures referenced in your instance acceleration structure available on the GPU.

Raytracing bugs on M1
 
 
Q