Skip to content
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

Limit amount of time taken by texture loading per frame #4192

Merged
merged 2 commits into from
Mar 9, 2025

Conversation

10110111
Copy link
Contributor

@10110111 10110111 commented Mar 9, 2025

Description

Previously (#3148) we thought that it was file I/O that lead to stalls during texture loading. It appears that it is I/O, but not a file one. Instead it's the calls to glTexImage2D that have to happen in the main thread, and that are done on first successful StelTexture::bind call. This PR reduces total time per frame taken by such texture uploads, deferring them to subsequent frames when this time is used up.

This lets us have smoother performance while not even having to limit the amount of threads that load and decode texture data. This PR also lifts this limitation on the number of threads (leaving the pool size still equal to the "ideal thread count").

Please keep the commits separated, just in case a need to revert one of them arises.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • Housekeeping

How Has This Been Tested?

Test Configuration:

  • Operating system: Ubuntu 20.04
  • Graphics Card: Intel UHD Graphics 620

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (header file)
  • I have updated the respective chapter in the Stellarium User Guide
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

10110111 added 2 commits March 9, 2025 15:11
It's not the threads that cause stalls, but the amount of glTexImage2D
calls in the main thread happening in the same frame.
@alex-w alex-w added this to the 25.1 milestone Mar 9, 2025
@github-actions github-actions bot requested review from alex-w and gzotti March 9, 2025 07:15
Copy link

github-actions bot commented Mar 9, 2025

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

This is an automatically generated QA checklist based on modified files.

Copy link
Member

@alex-w alex-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it better now. Thanks!

Copy link
Member

@gzotti gzotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very smooth now, thanks!

@alex-w alex-w merged commit 1179599 into master Mar 9, 2025
29 of 30 checks passed
@alex-w alex-w deleted the texture-loading-without-lags branch March 9, 2025 09:52
@alex-w alex-w added the state: published The fix has been published for testing in weekly binary package label Mar 9, 2025
Copy link

github-actions bot commented Mar 9, 2025

Hello @10110111!

Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

@alex-w alex-w removed the state: published The fix has been published for testing in weekly binary package label Mar 23, 2025
Copy link

Hello @10110111!

Please check the latest stable version of Stellarium:
https://github.com/Stellarium/stellarium/releases/latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants