bevy
bevy copied to clipboard
Faster MeshletMesh deserialization
Objective
- Using bincode to deserialize binary into a MeshletMesh is expensive (~77ms for a 5mb file).
Solution
- Write a custom deserializer using bytemuck's Pod types and slice casting.
- Total asset load time has gone from ~102ms to ~12ms.
- Change some types I never meant to be public to private and other misc cleanup.
Testing
- Ran the meshlet example and added timing spans to the asset loader.
Changelog
- Improved
MeshletMeshloading speed - The
MeshletMeshdisk format has changed, andMESHLET_MESH_ASSET_VERSIONhas been bumped -
MeshletMeshfields are now private - Renamed
MeshletMeshSaverLoadtoMeshletMeshSaverLoader - The
Meshlet,MeshletBoundingSpheres, andMeshletBoundingSpheretypes are now private - Removed
MeshletMeshSaveOrLoadError::SerializationOrDeserialization - Added
MeshletMeshSaveOrLoadError::WrongFileType
Migration Guide
- Regenerate your
MeshletMeshassets, as the disk format has changed, andMESHLET_MESH_ASSET_VERSIONhas been bumped -
MeshletMeshfields are now private -
MeshletMeshSaverLoadis now namedMeshletMeshSaverLoader - The
Meshlet,MeshletBoundingSpheres, andMeshletBoundingSpheretypes are now private -
MeshletMeshSaveOrLoadError::SerializationOrDeserializationhas been removed - Added
MeshletMeshSaveOrLoadError::WrongFileType, match on this variant if you match onMeshletMeshSaveOrLoadError