Don't update the lights UBO if it hasn't changed #5972
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After doing some profiling on the RPi:
This doesn't really remove the cost but it avoids updating the UBO needlessly if the data hasn't changed between calls to SetLights.
Real Results
In the best case this performs as above with a massive reduction in the cost of SetLights, for example on the pad at Mars start.
Really though this simply performs no worse most of the time and occassionally makes a large difference.
Tagging @Web-eWorks as this is an area you've been working on and I just tried this on a whim to see what would happen 🤷♂️ no worries if it's not suitable but I thought it worth trying.
Would you mind double checking the results when you have time?
Testing
Started on Mars, flew to Torvalds (Earth) station and docked, left and hyperspaced to Barnards Star, flew to SysAdminResting and docked. Everything seemed lit correctly at all times. Menus all worked.
Test on Windows and RPi5