Wireframe pipeline breaks after changing MSAA at runtime
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version and features
- v0.19.0, verified on main at 860f0c93e804833f557fe9e91ed7eeeb4668a0fa
## What you did
1. Enable `WireframePlugin`
2. Spawn `Camera3d` with `Msaa:Sample4`
3. Spawn a mesh with a wireframe
4. After a moment, replace msaa with `Msaa::Off`
Repro diff
applies to `860f0c93e804833f557fe9e91ed7eeeb4668a0fa`
```
diff --git a/examples/3d/wireframe.rs b/examples/3d/wireframe.rs
index 74376ab0b..9482692e4 100644
--- a/examples/3d/wireframe.rs
+++ b/examples/3d/wireframe.rs
@@ -45,7 +45,7 @@ fn main() {
..default()
})
.add_systems(Startup, setup)
- .add_systems(Update, update_colors)
+ .add_systems(Update, (update_colors, toggle_msaa))
.run();
}
@@ -113,6 +113,7 @@ fn setup(
// camera
commands.spawn((
Camera3d::default(),
+ Msaa::Sample4,
Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
));
@@ -150,6 +151,7 @@ X - Change global color
C - Change color of the green cube wireframe
V - Line width (current: {current_width:.1}px)
B - Toggle topology (current: {:?})
+ Space - Toggle Msaa
WireframeConfig
-------------
@@ -201,3 +203,15 @@ Color: {:?}",
};
}
}
+
+fn toggle_msaa(
+ keyboard_input: Res>,
+ mut camera_msaa: Single<&mut Msaa, With>,
+) {
+ if keyboard_input.just_pressed(KeyCode::Space) {
+ **camera_msaa = match **camera_msaa {
+ Msaa::Off => Msaa::Sample4,
+ _ => Msaa::Off,
+ };
+ }
+}
```
## What went wrong
After pressing space (msaa:off)
- Console shows repeated wgpu sample count mismatch errors.
- Wireframe stops rendering and bevy exits
Error log
```
2026-08-12T16:36:11.558845Z ERROR bevy_render::error_handler: Caught rendering error: Validation Error
Caused by:
In a CommandEncoder, label = ''
In a set_pipeline command
Render pipeline targets are incompatible with render pass
Incompatible sample count: the RenderPass uses textures with sample count 1 but the RenderPipeline with 'wireframe_3d_pipeline' label uses attachments with format 4
2026-08-12T16:36:11.561072Z ERROR bevy_render::error_handler: Caught rendering error: Validation Error
Caused by:
In Queue::submit
In a set_pipeline command
Render pipeline targets are incompatible with render pass
Incompatible sample count: the RenderPass uses textures with sample count 1 but the RenderPipeline with 'wireframe_3d_pipeline' label uses attachments with format 4
2026-08-12T16:36:11.565248Z ERROR bevy_render::error_handler: Quitting the application due to Validation RenderError
2026-08-12T16:36:11.588176Z WARN bevy_ecs::world::command_queue: CommandQueue has un-applied commands being dropped. Did you forget to call SystemState::apply?
2026-08-12T16:36:11.588280Z WARN bevy_ecs::world::command_queue: CommandQueue has un-applied commands being dropped. Did you forget to call SystemState::apply?
```
Expected:
- Wireframe rendering would have continued
Contributor guide
Research direction
Start with examples/3d/wireframe.rs and the WireframePlugin path, then trace the wireframe_3d_pipeline entry point while reproducing the Space-key MSAA toggle. Verify the render pass and pipeline remain compatible when MSAA changes to Off; done means wireframe rendering continues without sample-count validation errors or application exit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100