Skip to content

radv: BVH intermediate representation

Friedrich Vock requested to merge pixelcluster/mesa:radv_bvh_ir into main

Converts the BVH builder to construct an intermediate binary BVH first, then converts to the RDNA-native BVH4.

This is mostly preliminary work for adding better BVH builders , but it also slightly improves RT performance on its own. I measured a decrease in frame times of a little bit under 10% (9% in Q2RTX, 7% in the nvpro-rt instances sample). Edit: Outdated. It seems like performance is about the same now with newest main.

A few notes:
Converting internal nodes can be done in a single dispatch at the expense of leaving unreferenced nodes around. I think the cleanest approach to removing these or arranging the BVH so that compaction can easily remove them would involve a task system like in AMD's gpurt.

f9fd7766 ("radv: Modify internal node shader to build BVH IR") and 8323c7ac ("radv: Modify leaf node shader to build BVH IR") will probably hang the GPU if built without 8b5cfd66 ("radv: Build acceleration structures using BVH IR"). To make eventual bisects easier I'd suggest squashing them into one commit before merging, for now I left them as-is to make it easier for review.

/cc @bnieuwenhuizen @KonstantinSeurer

Edited by Friedrich Vock

Merge request reports