shader-slang / slang

Making it easier to work with shaders
MIT License
1.98k stars 168 forks source link

Design a plan to support ray tracing on metal. #4576

Open csyonghe opened 2 months ago

natevm commented 1 month ago

For what it’s worth, there was an initiative to get MetalRT working through MoltenVK.

There, the challenge iiuc has been that MetalRT doesn’t seem to support VkDeviceAddress, which is an important field in the instance records of a TLAS’s primitives that both DXR and VK depend on. ( I haven’t personally investigated it, but I’ve been talking with the dev working on the feature )

natevm commented 1 month ago

For completeness, these are the structures in question: in DXR https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html#d3d12_raytracing_instance_desc

And in VK: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkAccelerationStructureInstanceKHR.html

In theory, GFX could do some sort of indirection here, but I’m nervous that’s going to break certain cases. Eg, when scenes move dynamically where these structs are populated from a compute shader.