-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Asset locking #15359
base: main
Are you sure you want to change the base?
Asset locking #15359
Commits on Sep 27, 2024
-
Create
AssetPresence
as a replacement to Option.This currently buys us nothing, but it's a nice stepping stone to making `AssetPresence` have a locked variant.
Configuration menu - View commit details
-
Copy full SHA for 17d84eb - Browse repository at this point
Copy the full SHA 17d84ebView commit details -
Add a
Locked
variant toAssetPresence
.This variant is still unused.
Configuration menu - View commit details
-
Copy full SHA for d030b11 - Browse repository at this point
Copy the full SHA d030b11View commit details -
Configuration menu - View commit details
-
Copy full SHA for c56b6e2 - Browse repository at this point
Copy the full SHA c56b6e2View commit details -
Allow locking and unlocking assets.
Now assets can be "locked" into an `Arc`.
Configuration menu - View commit details
-
Copy full SHA for cf8024c - Browse repository at this point
Copy the full SHA cf8024cView commit details -
Keep track of the set of currently locked assets.
This will make it more performant to try unlocking all the locked assets in the "happy case" that few assets are locked.
Configuration menu - View commit details
-
Copy full SHA for 67a60c8 - Browse repository at this point
Copy the full SHA 67a60c8View commit details -
Create a system to automatically unlock assets every frame.
This way, if you lock an asset, you just have to drop its `Arc` and wait a frame for the asset to become mutable again (as opposed to requiring a system to figure out which assets can be unlocked and trying to unlock just those). The price is constant polling whenever an asset is locked. We have to repeatedly try unlocking an asset until it is actually ready to be unlocked.
Configuration menu - View commit details
-
Copy full SHA for 7450ba5 - Browse repository at this point
Copy the full SHA 7450ba5View commit details -
Add some convenience functions to AssetPresenceMut.
This makes it easier to just unwrap a mutable borrow by just doing `.as_mut().unwrap()`.
Configuration menu - View commit details
-
Copy full SHA for 209465d - Browse repository at this point
Copy the full SHA 209465dView commit details -
Configuration menu - View commit details
-
Copy full SHA for e654299 - Browse repository at this point
Copy the full SHA e654299View commit details -
Handle locked assets when moving assets from the render world to the …
…main world. For simplicity, we just clone the assets. In theory, we could have an enum to store the RenderAssets as either a locked Arc or an Unlocked asset, but I'd rather just avoid that branch.
Configuration menu - View commit details
-
Copy full SHA for ed80653 - Browse repository at this point
Copy the full SHA ed80653View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2574e62 - Browse repository at this point
Copy the full SHA 2574e62View commit details -
Handle meshlets possibly being locked.
This is actually a totally fine case, we just need a borrow to be able to clone the internal Arc's.
Configuration menu - View commit details
-
Copy full SHA for 13019fe - Browse repository at this point
Copy the full SHA 13019feView commit details -
Configuration menu - View commit details
-
Copy full SHA for c8ffbf1 - Browse repository at this point
Copy the full SHA c8ffbf1View commit details -
Configuration menu - View commit details
-
Copy full SHA for a8f4663 - Browse repository at this point
Copy the full SHA a8f4663View commit details -
Configuration menu - View commit details
-
Copy full SHA for 167aad4 - Browse repository at this point
Copy the full SHA 167aad4View commit details -
This makes working with asset locking much more palatable, as users don't need to explicitly handle the locking case in most situations.
Configuration menu - View commit details
-
Copy full SHA for 816fb29 - Browse repository at this point
Copy the full SHA 816fb29View commit details -
Use
get_mut_or_clone
in all the examples.This is likely the common case for users, so we should have our examples use this function.
Configuration menu - View commit details
-
Copy full SHA for 2c87377 - Browse repository at this point
Copy the full SHA 2c87377View commit details