bevy/examples/2d
Patrick Walton f5de3f08fb
Use multidraw for opaque meshes when GPU culling is in use. (#16427)
This commit adds support for *multidraw*, which is a feature that allows
multiple meshes to be drawn in a single drawcall. `wgpu` currently
implements multidraw on Vulkan, so this feature is only enabled there.
Multiple meshes can be drawn at once if they're in the same vertex and
index buffers and are otherwise placed in the same bin. (Thus, for
example, at present the materials and textures must be identical, but
see #16368.) Multidraw is a significant performance improvement during
the draw phase because it reduces the number of rebindings, as well as
the number of drawcalls.

This feature is currently only enabled when GPU culling is used: i.e.
when `GpuCulling` is present on a camera. Therefore, if you run for
example `scene_viewer`, you will not see any performance improvements,
because `scene_viewer` doesn't add the `GpuCulling` component to its
camera.

Additionally, the multidraw feature is only implemented for opaque 3D
meshes and not for shadows or 2D meshes. I plan to make GPU culling the
default and to extend the feature to shadows in the future. Also, in the
future I suspect that polyfilling multidraw on APIs that don't support
it will be fruitful, as even without driver-level support use of
multidraw allows us to avoid expensive `wgpu` rebindings.
2024-12-06 17:22:03 +00:00
..
2d_shapes.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
2d_viewport_to_world.rs simplify example, replace get_single to Single Query (#16187) 2024-11-01 18:25:42 +00:00
bloom_2d.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
bounding_2d.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
cpu_draw.rs Make some examples deterministic (#16488) 2024-11-23 18:28:47 +00:00
custom_gltf_vertex_attribute.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
mesh2d.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
mesh2d_alpha_mode.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
mesh2d_arcs.rs Implement From translation and rotation for isometries (#15733) 2024-10-08 16:09:28 +00:00
mesh2d_manual.rs Use multidraw for opaque meshes when GPU culling is in use. (#16427) 2024-12-06 17:22:03 +00:00
mesh2d_vertex_color_texture.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
move_sprite.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
pixel_grid_snap.rs Improve API for scaling orthographic cameras (#15969) 2024-10-17 17:50:06 +00:00
rotation.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
sprite.rs Migrate bevy_sprite to required components (#15489) 2024-10-09 16:17:26 +00:00
sprite_animation.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
sprite_flipping.rs Migrate bevy_sprite to required components (#15489) 2024-10-09 16:17:26 +00:00
sprite_sheet.rs Migrate bevy_sprite to required components (#15489) 2024-10-09 16:17:26 +00:00
sprite_slice.rs Improved UiImage and Sprite scaling and slicing APIs (#16088) 2024-11-04 15:14:03 +00:00
sprite_tile.rs Improved UiImage and Sprite scaling and slicing APIs (#16088) 2024-11-04 15:14:03 +00:00
text2d.rs aligning public apis of Time,Timer and Stopwatch (#15962) 2024-10-16 21:09:32 +00:00
texture_atlas.rs Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
transparency_2d.rs Make some examples deterministic (#16488) 2024-11-23 18:28:47 +00:00
wireframe_2d.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00