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

Eliminate an unnecessary copy operation while creating Unreal meshes from tiles #1516

Open
kring opened this issue Sep 4, 2024 · 1 comment
Labels
low hanging fruit performance Improvements to performance, including reductions in memory usage

Comments

@kring
Copy link
Member

kring commented Sep 4, 2024

CesiumGltfComponent.cpp copies the glTF vertex data into a TArray<FStaticMeshBuildVertex>, which represents the mesh as an array of structures. Then, it calls Init on various Unreal "vertex buffer" classes to copy that data into Unreal's structure of arrays form.

This is pointless. We can just copy the glTF data into the FPositionVertexBuffer, FColorVertexBuffer, and FStaticMeshVertexBuffer instances directly and save some heap allocations and a pass over the vertex data. The only slightly tricky thing about this is that we need to determine the total number of texture coordinates required before we can start populating any of them. Previously, we could count and copy simultaneously. So this will require a slight reorganization of the code.

@kring kring added performance Improvements to performance, including reductions in memory usage low hanging fruit labels Sep 4, 2024
@kring
Copy link
Member Author

kring commented Sep 4, 2024

I was originally going to do this as part of #1515, but decided against it in order to avoid merge conflicts. @azrogers is currently making significant changes to this same code as part of the Unreal side of CesiumGS/cesium-native#926.

@kring kring changed the title Eliminate an unnecessary copy operation while creating Unreal meshes from til4es Eliminate an unnecessary copy operation while creating Unreal meshes from tiles Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low hanging fruit performance Improvements to performance, including reductions in memory usage
Projects
None yet
Development

No branches or pull requests

1 participant