Certain GUI views are eating up performance
The inspector eats up about 5ms of frametime
The About menu is by far the worst, presumably due to my crappy implementation of the egui image loader
For inspector, it is specifically static instance, not static instances. Terrain is also fine.
The cause of the performance hit in the inspector was caused by the continuous polling of the distance from the camera to the fragment under the crosshair, as this was pulling depth buffer data synchronously each frame, causing significant slowdowns.
The polling behaviour has been removed since c863cf5594711f564e8a659a80a93d098b3ab287, may be reimplemented in the future with a better distance testing solution
The polling behaviour has been removed since c863cf5, may be reimplemented in the future with a better distance testing solution
We could use collision detection for this, once that's implemented
Pros:
- A lot faster than depth buffer testing
- Works with solid transparent objects like glass
Cons:
- Any non-solid opaque objects (eg. out of box geometry) will no longer work
Turns out the lag in the about menu was caused by me running rustc --version each frame....
The rustc version string is now baked during the build, and the about menu runs buttery smooth once more
(fixed in b204ce3a37c4c77166b58854987102b2f806fc9c)