bevy/crates
Connor Dalrymple 905965b842
Skip allocation of zero size meshes (#19938)
# Objective

Fixes #16525
Fixes #19710

## Solution

Not allocating a mesh if it is empty.

## Testing

I tested using the following minimum repro from #16525
```rust
use bevy::{asset::RenderAssetUsages, prelude::*, render::mesh::PrimitiveTopology};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(
    mut commands: Commands,
    mut meshes: ResMut<Assets<Mesh>>,
    mut materials: ResMut<Assets<ColorMaterial>>,
) {
    commands.spawn(Camera2d);

    let mesh = Mesh::new(
        PrimitiveTopology::TriangleList,
        RenderAssetUsages::default(),
    );

    commands.spawn((
        Mesh2d(meshes.add(mesh)),
        MeshMaterial2d(materials.add(Color::hsl(180.0, 0.95, 0.7))),
    ));
}
```
I was able to test on webgl2 and windows native and the issue seems to
be resolved. I am not familiar with how mesh rendering works and feel
like just skipping meshes should cause issues but I did not notice any.
2025-07-07 02:32:51 +00:00
..
bevy_a11y Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_animation consistently dont use smallvec default features (#19972) 2025-07-06 04:25:26 +00:00
bevy_anti_aliasing fix percentage signs in SMAA (#19987) 2025-07-06 22:24:26 +00:00
bevy_app Run RenderStartup in/before extract instead of after it. (#19926) 2025-07-07 01:31:40 +00:00
bevy_asset fix panic looking for extension in multibyte unicode paths (#19933) 2025-07-03 22:27:07 +00:00
bevy_audio Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_camera consistently dont use smallvec default features (#19972) 2025-07-06 04:25:26 +00:00
bevy_color Ugrade to wgpu version 25.0 (#19563) 2025-06-26 19:41:47 +00:00
bevy_core_pipeline consistently dont use smallvec default features (#19972) 2025-07-06 04:25:26 +00:00
bevy_core_widgets Newtyped ScrollPosition (#19881) 2025-07-01 17:41:48 +00:00
bevy_derive Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_dev_tools Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_diagnostic updating: very very minorly (#19827) 2025-06-26 21:48:20 +00:00
bevy_dylib Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_ecs Remove Bundle::register_required_components (#19967) 2025-07-06 18:15:28 +00:00
bevy_encase_derive Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_feathers Feathers toggle switches. (#19928) 2025-07-03 01:09:31 +00:00
bevy_gilrs Add newlines before impl blocks (#19746) 2025-06-22 23:07:02 +00:00
bevy_gizmos Use RenderStartup in bevy_gizmos. (#19898) 2025-07-02 20:38:37 +00:00
bevy_gltf consistently dont use smallvec default features (#19972) 2025-07-06 04:25:26 +00:00
bevy_image optimize ktx2 level data concatenation (#19845) 2025-06-29 21:59:56 +00:00
bevy_input bevy_input: build warnings without bevy_reflect (#19862) 2025-06-29 17:13:43 +00:00
bevy_input_focus Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_internal bevy_ui_render crate (#18703) 2025-07-03 23:36:35 +00:00
bevy_light bevy_light (#19991) 2025-07-07 00:07:38 +00:00
bevy_log Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_macro_utils Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_math consistently dont use smallvec default features (#19972) 2025-07-06 04:25:26 +00:00
bevy_mesh refactor(mesh): move Mesh3d and Mesh2d into bevy_mesh (#19943) 2025-07-04 16:24:21 +00:00
bevy_mikktspace Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_pbr bevy_light (#19991) 2025-07-07 00:07:38 +00:00
bevy_picking Split bevy_camera out of bevy_render (#19949) 2025-07-04 23:31:16 +00:00
bevy_platform bevy_platform: clippy without default features (#19860) 2025-06-29 17:12:57 +00:00
bevy_ptr Add newlines before impl blocks (#19746) 2025-06-22 23:07:02 +00:00
bevy_reflect consistently dont use smallvec default features (#19972) 2025-07-06 04:25:26 +00:00
bevy_remote Add support for returning all Component and values to query method in the Bevy Remote Protocol (#19857) 2025-07-03 18:51:32 +00:00
bevy_render Skip allocation of zero size meshes (#19938) 2025-07-07 02:32:51 +00:00
bevy_scene Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
bevy_solari Make render and compute pipeline descriptors defaultable. (#19903) 2025-07-02 18:47:27 +00:00
bevy_sprite Split bevy_camera out of bevy_render (#19949) 2025-07-04 23:31:16 +00:00
bevy_state Fix docs typo (#19937) 2025-07-03 19:02:50 +00:00
bevy_tasks Update derive_more requirement from 1 to 2 (#19671) 2025-06-24 11:13:04 +00:00
bevy_text consistently dont use smallvec default features (#19972) 2025-07-06 04:25:26 +00:00
bevy_time Bump Version after Release (#19774) 2025-06-22 23:06:43 +00:00
bevy_transform Update derive_more requirement from 1 to 2 (#19671) 2025-06-24 11:13:04 +00:00
bevy_ui consistently dont use smallvec default features (#19972) 2025-07-06 04:25:26 +00:00
bevy_ui_render consistently dont use smallvec default features (#19972) 2025-07-06 04:25:26 +00:00
bevy_utils Have System::run_unsafe return Result. (#19145) 2025-07-03 21:48:09 +00:00
bevy_window bevy_window: fix compilation without default features (#19870) 2025-06-30 20:51:52 +00:00
bevy_winit bevy_winit: fix compile and clippy on wasm (#19869) 2025-06-29 21:30:28 +00:00