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

Migration Guide 0.13 - "Unload render assets from RAM" is outdated #984

Closed
afonsolage opened this issue Feb 17, 2024 · 5 comments · Fixed by #991
Closed

Migration Guide 0.13 - "Unload render assets from RAM" is outdated #984

afonsolage opened this issue Feb 17, 2024 · 5 comments · Fixed by #991
Labels
A-Migration Guides C-Correction A typo, problem or factual issue in what we've written
Milestone

Comments

@afonsolage
Copy link
Contributor

Unload render assets from RAM migration guide is outdated due to RenderAssetPersistencePolicy → RenderAssetUsages.

I could just make a PR to replace RenderAssetPersistencePolicy::Keep with RenderAssetUsage::MAIN_WORLD | RenderAssetUsage::RENDER_WORLD as per #11399, but I don't know if it will make sense:


  • Asset loaders (GLTF, etc) now load meshes and textures without cpu_persistent_access. These assets will be removed from Assets<Mesh> and Assets<Image> once RenderAssets<Mesh> and RenderAssets<Image> contain the GPU versions of these assets, in order to reduce memory usage. If you require access to the asset data from the CPU in future frames after the GLTF asset has been loaded, modify all dependent Mesh and Image assets and set cpu_persistent_access to RenderAssetUsage::MAIN_WORLD | RenderAssetUsage::RENDER_WORLD.
  • Mesh now requires a new cpu_persistent_access field. Set it to RenderAssetUsage::MAIN_WORLD | RenderAssetUsage::RENDER_WORLD to mimic the previous behavior.
  • Image now requires a new cpu_persistent_access field. Set it to RenderAssetUsage::MAIN_WORLD | RenderAssetUsage::RENDER_WORLD to mimic the previous behavior.
  • MorphTargetImage::new() now requires a new cpu_persistent_access parameter. Set it to RenderAssetUsage::MAIN_WORLD | RenderAssetUsage::RENDER_WORLD to mimic the previous behavior.
  • DynamicTextureAtlasBuilder::add_texture() now requires that the TextureAtlas you pass has an Image with cpu_persistent_access: RenderAssetUsage::MAIN_WORLD | RenderAssetUsage::RENDER_WORLD. Ensure you construct the image properly for the texture atlas.
  • The RenderAsset trait has significantly changed, and requires adapting your existing implementations.
  • The trait now requires Clone.
  • The ExtractedAsset associated type has been removed (the type itself is now extracted).
  • The signature of prepare_asset() is slightly different
  • A new persistence_policy() method is now required (return RenderAssetUsage::RENDER_WORLD to match the previous behavior).
@rparrett
Copy link
Contributor

I could just make a PR to replace RenderAssetPersistencePolicy::Keep with RenderAssetUsage::MAIN_WORLD | RenderAssetUsage::RENDER_WORLD as per #11399, but I don't know if it will make sense:

That is RenderAssetUsage::default() since bevyengine/bevy#11212.

@alice-i-cecile alice-i-cecile added this to the Release 0.13 milestone Feb 17, 2024
@alice-i-cecile alice-i-cecile added A-Migration Guides C-Correction A typo, problem or factual issue in what we've written labels Feb 17, 2024
@brianreavis
Copy link
Contributor

Just a note: it's RenderAssetUsages, not RenderAssetUsage.

Also, the cpu_persistent_access fields are now asset_usage, and the persistence_policy() method is now asset_usage().

@afonsolage
Copy link
Contributor Author

#987

@afonsolage
Copy link
Contributor Author

Fixed on #987

@alice-i-cecile
Copy link
Member

This fix was made to a branch, not to main, so needs to be redone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Migration Guides C-Correction A typo, problem or factual issue in what we've written
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants