radv: Refactor/rewrite acceleration structures
This MR aims to convert all the acceleration structure build kernels to GLSL/C++. The benefits will be:
- It will be easier to implement non trivial kernels.
- We can share code between the CPU and GPU path.
- This will also enable us to work on new algorithms without ever using the GPU. (CPU builds + some form of BVH validator/debugger)
This is done in 3 parts:
- Split
radv_acceleration_structures.c
into a common, CPU and GPU file. - Port all the existing kernels to GLSL.
- Add CPU 'dispatch' code.
Why C++?
C++ is more compatible with GLSL than C because
- We don't have to always add the struct keyword.
- We can use operator overloading to implement the builtin GLSL types.
TODOs:
-
Port the internal nodes kernel. -
Port the copy/[de]serialization kernel.I don't know how the serialization code works and I won't know it anytime soon. -
Port the leaf nodes kernel. -
Add the dispatch code for CPU builds. -
Compatibility with older generations. (Without atomic float min/max) -
Run CTS. (nothing broke)
Just opening this MR to get some early feedback about the general idea :)
Edited by Konstantin Seurer