Skip to content

Wireframe pipeline breaks after changing MSAA at runtime #25375

Description

@blaind

Bevy version and features

  • v0.19.0, verified on main at 860f0c9

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<ButtonInput<KeyCode>>,
+    mut camera_msaa: Single<&mut Msaa, With<Camera3d>>,
+) {
+    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 = '<Enable the debug feature to see the name>'
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorS-Needs-ReviewNeeds reviewer attention (from anyone!) to move forward

    Type

    No type

    Projects

    Status
    Needs SME Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions