Skip to content

Fix wireframe specialization - #25376

Open
blaind wants to merge 1 commit into
bevyengine:mainfrom
blaind:fix/wireframe-view-respecialization
Open

Fix wireframe specialization#25376
blaind wants to merge 1 commit into
bevyengine:mainfrom
blaind:fix/wireframe-view-respecialization

Conversation

@blaind

@blaind blaind commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Objective

Fixes #25375

Solution

When msaa changes, bevy detects the view key as changed. Existing code sets only DirtySpecializations as dirty, but leaves DirtyWireframeSpecializations untouched. This patch adds the dirty flag to the latter as well.

Testing

To test the before-after behavior, please apply the patch at #25375 to the bevy wireframe example.

Before this patch: error logs + crash

After this patch: continues working

Tested both 3d & 2d.

2D repro
diff --git a/examples/2d/wireframe_2d.rs b/examples/2d/wireframe_2d.rs
index 9b3e16a39..6d5a3a9c6 100644
--- a/examples/2d/wireframe_2d.rs
+++ b/examples/2d/wireframe_2d.rs
@@ -55,6 +55,7 @@ fn main() {
         })
         .insert_resource(UiTheme(theme::basic_example_theme(Color::WHITE)))
         .add_systems(Startup, setup)
+        .add_systems(Update, toggle_msaa)
         .add_observer(update_radio_button)
         .add_observer(radio_self_update)
         .run();
@@ -164,7 +165,19 @@ fn setup(
         },
     ));

-    commands.spawn(Camera2d);
+    commands.spawn((Camera2d, Msaa::Sample4));
+}
+
+fn toggle_msaa(
+    keyboard_input: Res<ButtonInput<KeyCode>>,
+    mut camera_msaa: Single<&mut Msaa, With<Camera2d>>,
+) {
+    if keyboard_input.just_pressed(KeyCode::Space) {
+        **camera_msaa = match **camera_msaa {
+            Msaa::Off => Msaa::Sample4,
+            _ => Msaa::Off,
+        };
+    }
 }

 /// This system lets you toggle various wireframe settings

AI disclosure: the root cause analysis, patch & test code for 2D was written by AI.

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 12, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Wireframe pipeline breaks after changing MSAA at runtime

2 participants