godot-extended-libraries / godot-debug-menu

Display in-game FPS/performance/hardware metrics in a Godot 4.x project
https://github.com/godot-extended-libraries/godot-debug-menu-demo
MIT License
429 stars 16 forks source link

Implement recommended thread access to prevent error spam on startup #12

Open isirode opened 1 year ago

isirode commented 1 year ago

Hi,

The PR as requested.

I removed the thread safety check, since it does not seem necessary anymore.

I tested it on 4.1 official [970459615] (downloaded recently), on a game with multiple scenes, the errors are not present.

Have a good day,

isirode commented 1 year ago

I do not notice it, but I have a pretty good CPU, so it might be why.

Do you know if it is the get_viewport() or the get_viewport_rid() method which is slowing done the startup ?

isirode commented 1 year ago

Can you indicate me why your fix was not complete also ? It did not produce any warnings on my side when I tested it.

Calinou commented 1 year ago

Do you know if it is the get_viewport() or the get_viewport_rid() method which is slowing done the startup ?

The slowdown is mostly in update_information_label(), as getting graphics driver version information is slow.

isirode commented 1 year ago

Oh, I see, it was previously called inside the thread, but now, it runs inside the main thread.

I did not think of it, since it seemed normal to do graphic operations on the main thread.