-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wgpu surface unnecessasrily recreated every frame #117
Comments
can you confirm if it is fixed in the new commit? I think I have fixed it |
it now draws much less often, but still reconfigures the surface for every drawn frame. additionally, on-hover events are now broken, as the iced ui only receives updates on click or from subscribers |
what do you mean by |
The counter example has a subscription for all iced/window events, which run in a separate thread: exwlshelleventloop/iced_examples/counter/src/main.rs Lines 76 to 78 in e005014
This includes mouse movement events. These are only used to debug log: exwlshelleventloop/iced_examples/counter/src/main.rs Lines 82 to 85 in e005014
Removing the subscription demonstrates the hover issue, which only appears after the latest commit |
This behaviour can be considered an iced bug. In the latest release of iced, button status is checked in draw not update: This is fixed in PR iced-rs/iced#2662, where it moves to update: Edit: Prior to the merging of iced-rs/iced#2662, it may be required by iced to draw every frame unconditionally, hence the fix to only draw when the ui state has changed is invalid for earlier versions of iced. |
I see.. maybe I should revert this fix.. it induced many problems |
I have read the code in iced.. maybe I should wait for new iced being published, then solve this problem |
iced_layershell performs a wgpu surface reconfigure event at the start of every frame, even if the surface size has not changed:
exwlshelleventloop/iced_layershell/src/application.rs
Lines 401 to 420 in 76a9c0c
this often takes up a whole frame to complete (vsync?), and corresponds to unnecessary CPU time
i tried a naive fix to avoid the code path, but it broke the actual rendering, which randomly took up to several frames to present the surface, hence i am not submitting a PR.
i used samply to obtain measurements and profiling. it's possible this process may be introducing bias i am unaware of.
The text was updated successfully, but these errors were encountered: