Skip to content

R_FindPlane optimization

Hannu Hanhi requested to merge Hannu_Hanhi/SRB2:sw-findplane-opt into next

Optimize R_FindPlane to work faster with FOFs. This should not change the behavior of the function.

FOF visplanes are moved outside of the visplane hash table. This makes sense because R_FindPlane does not allow using FOFs anyway, so the FOF entries in the hash table are just waste. Therefore the behaviour of R_FindPlane should stay the same even with these changes. The callers of new_visplane are changed to take this change into account.

Performance gains are large on certain complex scenes, though timedemos show just 0-5% improvement. (probably that low because the complex scenes are not very common) Performance results have been checked on my main Ryzen machine and an old Intel gaming laptop.

srb20291 srb20292

The screenshots show that time spent in R_RenderBSPNode drops from 20 ms to 4 ms, potentially almost quadrupling the FPS in this FOF-heavy part of the map.

Merge request reports