bevy/crates/bevy_sprite/src/mesh2d
Patrick Walton 8f36106f9e
Split out the IndirectParametersMetadata into CPU-populated and GPU-populated buffers. (#17863)
The GPU can fill out many of the fields in `IndirectParametersMetadata`
using information it already has:

* `early_instance_count` and `late_instance_count` are always
initialized to zero.

* `mesh_index` is already present in the work item buffer as the
`input_index` of the first work item in each batch.

This patch moves these fields to a separate buffer, the *GPU indirect
parameters metadata* buffer. That way, it avoids having to write them on
CPU during `batch_and_prepare_binned_render_phase`. This effectively
reduces the number of bits that that function must write per mesh from
160 to 64 (in addition to the 64 bits per mesh *instance*).

Additionally, this PR refactors `UntypedPhaseIndirectParametersBuffers`
to add another layer, `MeshClassIndirectParametersBuffers`, which allows
abstracting over the buffers corresponding indexed and non-indexed
meshes. This patch doesn't make much use of this abstraction, but
forthcoming patches will, and it's overall a cleaner approach.

This didn't seem to have much of an effect by itself on
`batch_and_prepare_binned_render_phase` time, but subsequent PRs
dependent on this PR yield roughly a 2× speedup.
2025-02-18 00:53:44 +00:00
..
color_material.rs Weak handle migration (#17695) 2025-02-05 22:44:20 +00:00
color_material.wgsl Add AlphaMask2d phase (#14724) 2024-08-15 14:10:37 +00:00
material.rs Cache MeshInputUniform indices in each RenderBin. (#17772) 2025-02-11 22:38:52 +00:00
mesh2d_bindings.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
mesh2d_functions.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
mesh2d_types.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
mesh2d_vertex_output.wgsl pbr shader cleanup (#10105) 2023-10-13 19:12:40 +00:00
mesh2d_view_bindings.wgsl add tonemapping LUT bindings for sprite and mesh2d pipelines (#13262) 2024-05-28 12:09:26 +00:00
mesh2d_view_types.wgsl Refactor Globals and View structs into separate shaders (#7512) 2023-02-11 17:55:18 +00:00
mesh2d.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
mesh.rs Split out the IndirectParametersMetadata into CPU-populated and GPU-populated buffers. (#17863) 2025-02-18 00:53:44 +00:00
mod.rs Support wireframes for 2D meshes (#12135) 2024-03-29 18:34:04 +00:00
wireframe2d.rs Weak handle migration (#17695) 2025-02-05 22:44:20 +00:00
wireframe2d.wgsl Support wireframes for 2D meshes (#12135) 2024-03-29 18:34:04 +00:00