-
Notifications
You must be signed in to change notification settings - Fork 97
The Fast Texture Loading Rewrite #1031
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
base: dev
Are you sure you want to change the base?
Conversation
…emory usage tracking
microlith57
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first pass, picking the low hanging fruit first! nothing here is blocking
|
@microlith57 all feedback has been addressed! |
|
/azp run |
6d31720 to
f232dea
Compare
DashingCat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Linux and works as expected, without significant changes in loading times compared to the previous "Fast Texture Loading" implementation.
| [SettingNeedsRelaunch] | ||
| [SettingInGame(false)] | ||
| [SettingIgnore] // TODO: Show as advanced setting. | ||
| public bool? FastTextureLoadingPoolUseGC { get; set; } = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe FastTextureLoadingPoolUseGC should be a bool instead of a bool?, as both null and false are equivalent when using the property in Celeste.Mod.mm/Mod/Helpers/TextureContentHelper.cs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea behind having a default third state is the ability to change what it actually defaults to if we ever need to, because if the default were to be false we would not be able to switch all the users who didn't manually disable the feature (since we could not distinguish that).
And if you look further _FastTextureLoading and ThreadedGL have been doing this for a while now.
As the title suggests, this PR attempts to rewrite the entirety of the good old FTL, into a more maintainable and future proof codebase, splitting code into a new class
TextureContentHelperto keep file sizes small.The main intention of this PR is to make
VirtualTexturefully thread safe, and re-enginneer an implementation of FTL.For context FTL has simply the following goal: decode the texture data from disk to a CPU buffer asynchronously, then upload to GPU memory on the main thread. This speeds up loading times and fixes some crashes on Nvidia gpus. Theres a writeup about most of the significant FTL details at the top of the
VirtualTexturefile diving deep into this and other topics.As for performance, it should be on par, this PR does not have any intentional speed improvements (in fact, it may be slower due to the heavier synchronization in
VirtualTexturebut it should be fairly small). I have some plans and some ongoing tests to improve performance and bound memory usage even lower, but those will land in a follow up PR once ready that will build off of this one. (Runtime atlasing is still on the TODO list, I did not forget!)Finally CI will fail, specifically the SJ TAS test since this is breaking for CollabUtils2. Luckily that mod has been updated already to be compatible and the only required extra steps for local testing are: clone the repo anddotnet build -c Release; mostly because it has not yet been released on gamebanana.An update has been pushed to CollabUtils2 making it compatible with the changes of this PR.