Optimize UI model instance - #7246
Merged
Merged
Conversation
MjnMixael
force-pushed
the
optimize_ui_model_instance
branch
from
February 24, 2026 17:29
4d94863 to
0163107
Compare
MjnMixael
force-pushed
the
optimize_ui_model_instance
branch
2 times, most recently
from
March 1, 2026 14:32
a3948d0 to
e9d13a0
Compare
MjnMixael
force-pushed
the
optimize_ui_model_instance
branch
from
March 16, 2026 03:32
7c94c28 to
c420993
Compare
MjnMixael
force-pushed
the
optimize_ui_model_instance
branch
from
March 24, 2026 17:34
c420993 to
3da71d1
Compare
MjnMixael
force-pushed
the
optimize_ui_model_instance
branch
from
April 10, 2026 16:33
7081c52 to
de8c573
Compare
Member
|
I'll defer to @BMagnu for this one |
MjnMixael
force-pushed
the
optimize_ui_model_instance
branch
from
April 20, 2026 00:52
de8c573 to
ea8eab8
Compare
BMagnu
reviewed
May 8, 2026
BMagnu
left a comment
Member
There was a problem hiding this comment.
I'm a touch wary of using timestamps instead of number of frames unused, but I guess it's fine. It'll be good enough to prevent frequent reinitialization of the model instance every frame when used through scripting
MjnMixael
force-pushed
the
optimize_ui_model_instance
branch
from
May 10, 2026 04:02
ea8eab8 to
7a8fdde
Compare
Contributor
Author
Changing this to frames was actually trivial. So there we go. |
BMagnu
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Addresses an issue that came up while reviewing #7225 (Note that this PR branches from that PR, so that one should be merged first) where we really shouldn't be creating instances for UI models every frame.
Here we use some of the model details to create a cache of instances for the UI. Each frame we check for stale instances and clear them as well as clearing all instances between game states. With this framework, the call sites can lazy load model instances as needed and the engine takes care of keeping things tidy. This is especially useful for the Lua side where any number of models can be rendered and we don't want to have to rely on the script to remember to clean up after itself.
Be aware that the code for using destroyed subsystems as part of the instance key is setting up for supporting #7218 . Additionally the tristatebool return type will allow for that code path to skip some model setup each frame if it returns true.
Also adds model instance support for 3D icons and Fixes #7054