alkahest icon indicating copy to clipboard operation
alkahest copied to clipboard

Certain GUI views are eating up performance

Open cohaereo opened this issue 1 year ago • 2 comments

The inspector eats up about 5ms of frametime alkahest_mGdm9NZKjM alkahest_DSunwmfnG4

The About menu is by far the worst, presumably due to my crappy implementation of the egui image loader alkahest_d4CiAVlttu

cohaereo avatar Jul 27 '24 20:07 cohaereo

For inspector, it is specifically static instance, not static instances. Terrain is also fine.

Froggy618157725 avatar Jul 30 '24 11:07 Froggy618157725

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

cohaereo avatar Sep 03 '24 19:09 cohaereo

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

cohaereo avatar Jan 26 '25 08:01 cohaereo

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 Image (fixed in b204ce3a37c4c77166b58854987102b2f806fc9c)

cohaereo avatar Feb 01 '25 18:02 cohaereo