mirror of
https://github.com/bevyengine/bevy
synced 2024-12-20 10:03:07 +00:00
3fb6cefb2f
# Objective - Make the meshlet fill cluster buffers pass slightly faster - Address https://github.com/bevyengine/bevy/issues/15920 for meshlets - Added PreviousGlobalTransform as a required meshlet component to avoid extra archetype moves, slightly alleviating https://github.com/bevyengine/bevy/issues/14681 for meshlets - Enforce that MeshletPlugin::cluster_buffer_slots is not greater than 2^25 (glitches will occur otherwise). Technically this field controls post-lod/culling cluster count, and the issue is on pre-lod/culling cluster count, but it's still valid now, and in the future this will be more true. Needs to be merged after https://github.com/bevyengine/bevy/pull/15846 and https://github.com/bevyengine/bevy/pull/15886 ## Solution - Old pass dispatched a thread per cluster, and did a binary search over the instances to find which instance the cluster belongs to, and what meshlet index within the instance it is. - New pass dispatches a workgroup per instance, and has the workgroup loop over all meshlets in the instance in order to write out the cluster data. - Use a push constant instead of arrayLength to fix the linked bug - Remap 1d->2d dispatch for software raster only if actually needed to save on spawning excess workgroups ## Testing - Did you test these changes? If so, how? - Ran the meshlet example, and an example with 1041 instances of 32217 meshlets per instance. Profiled the second scene with nsight, went from 0.55ms -> 0.40ms. Small savings. We're pretty much VRAM bandwidth bound at this point. - How can other people (reviewers) test your changes? Is there anything specific they need to know? - Run the meshlet example ## Changelog (non-meshlets) - PreviousGlobalTransform now implements the Default trait |
||
---|---|---|
.. | ||
asset.rs | ||
cull_clusters.wgsl | ||
downsample_depth.wgsl | ||
dummy_visibility_buffer_resolve.wgsl | ||
fill_cluster_buffers.wgsl | ||
from_mesh.rs | ||
instance_manager.rs | ||
material_pipeline_prepare.rs | ||
material_shade_nodes.rs | ||
meshlet_bindings.wgsl | ||
meshlet_mesh_manager.rs | ||
meshlet_mesh_material.wgsl | ||
meshlet_preview.png | ||
mod.rs | ||
persistent_buffer.rs | ||
persistent_buffer_impls.rs | ||
pipelines.rs | ||
remap_1d_to_2d_dispatch.wgsl | ||
resolve_render_targets.wgsl | ||
resource_manager.rs | ||
visibility_buffer_hardware_raster.wgsl | ||
visibility_buffer_raster_node.rs | ||
visibility_buffer_resolve.wgsl | ||
visibility_buffer_software_raster.wgsl |