Set the glsl stack size more deliberately
Closed this issue · 3 comments
Decreasing the stack size can improve performance considerably. Probably at the max depth? 60 is too large - likely much larger than the largest stack required.
Rough improvement in the "gpuPathTracingSimple" (set to 15 depth):
- MacOS: ~80 -> ~115 fps (~43% increase)
- Android: ~12 -> ~45 (~275% increase)
Hone in and find a good default on Android, MacOS
A 32-bit uint array can store the ids for a tree up to layers 31 deep, anyway.
Max number of nodes in a balanced binary tree is 2 ** ( h + 1 ) - 1
or 4294967295
at 31 layers (same as the max uint value). Possibly we can represent more with a compressed-wide-bvh.
Seems to not have a lot of impact in more complex cases. Check if setting the stack to a global variable is best when multiple iterations are performed.
It seems to not have a huge impact either way in more complex scenarios