bevy/crates/bevy_pbr/src/meshlet
vero 6465e3bd9f
Fix Mesh allocator bug and reduce Mesh data copies by two (#15566)
# Objective

- First step towards #15558

## Solution

- Rename `get_vertex_buffer_data` to `create_packed_vertex_buffer_data`
to make it clear that it is not "free" and actually allocates
- Compute length analytically for preallocation instead of creating the
buffer to get its length and immediately discard it
- Use existing vertex attribute size calculation method to reduce code
duplication
- Fix a bug where mesh index data was being replaced by unnecessarily
newly created mesh vertex data in some cases
- Overall reduces mesh copies by two. We still have plenty to go, but
these were the easy ones.

## Testing

- I ran 3d_scene, lighting, and many_cubes, they look fine.
- Benchmarks would be nice, but this is very obviously a win in perf and
correctness.

---

## Migration Guide

- `Mesh::create_packed_vertex_buffer_data` has been renamed
`Mesh::create_packed_vertex_buffer_data` to reflect the fact that it
copies data and allocates.

## Showcase

- look mom, less copies
2024-10-01 17:15:57 +00:00
..
asset.rs Cleanup unneeded lifetimes in bevy_asset (#15546) 2024-09-30 21:54:59 +00:00
cull_clusters.wgsl Meshlet software raster + start of cleanup (#14623) 2024-08-26 17:54:34 +00:00
downsample_depth.wgsl Meshlet software raster + start of cleanup (#14623) 2024-08-26 17:54:34 +00:00
dummy_visibility_buffer_resolve.wgsl Meshlet rendering (initial feature) (#10164) 2024-03-25 19:08:27 +00:00
fill_cluster_buffers.wgsl Meshlet software raster + start of cleanup (#14623) 2024-08-26 17:54:34 +00:00
from_mesh.rs Fix Mesh allocator bug and reduce Mesh data copies by two (#15566) 2024-10-01 17:15:57 +00:00
instance_manager.rs The Cooler 'Retain Rendering World' (#15320) 2024-09-30 18:51:43 +00:00
material_pipeline_prepare.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
material_shade_nodes.rs Meshlet software raster + start of cleanup (#14623) 2024-08-26 17:54:34 +00:00
meshlet_bindings.wgsl Meshlet screenspace-derived tangents (#15084) 2024-09-29 18:39:25 +00:00
meshlet_mesh_manager.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
meshlet_mesh_material.wgsl Meshlet misc (#13761) 2024-06-10 13:06:08 +00:00
meshlet_preview.png Meshlet rendering (initial feature) (#10164) 2024-03-25 19:08:27 +00:00
mod.rs Meshlet software raster + start of cleanup (#14623) 2024-08-26 17:54:34 +00:00
persistent_buffer.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
persistent_buffer_impls.rs Meshlet screenspace-derived tangents (#15084) 2024-09-29 18:39:25 +00:00
pipelines.rs Meshlet software raster + start of cleanup (#14623) 2024-08-26 17:54:34 +00:00
remap_1d_to_2d_dispatch.wgsl Meshlet software raster + start of cleanup (#14623) 2024-08-26 17:54:34 +00:00
resolve_render_targets.wgsl More triangles/vertices per meshlet (#15023) 2024-09-08 17:55:57 +00:00
resource_manager.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
visibility_buffer_hardware_raster.wgsl More triangles/vertices per meshlet (#15023) 2024-09-08 17:55:57 +00:00
visibility_buffer_raster_node.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
visibility_buffer_resolve.wgsl Meshlet screenspace-derived tangents (#15084) 2024-09-29 18:39:25 +00:00
visibility_buffer_software_raster.wgsl More triangles/vertices per meshlet (#15023) 2024-09-08 17:55:57 +00:00