Skip to content

Fix SMAA resources not being cleaned up#22985

Merged
alice-i-cecile merged 2 commits intobevyengine:mainfrom
kristoff3r:ks/fix-smaa
Feb 22, 2026
Merged

Fix SMAA resources not being cleaned up#22985
alice-i-cecile merged 2 commits intobevyengine:mainfrom
kristoff3r:ks/fix-smaa

Conversation

@kristoff3r
Copy link
Contributor

@kristoff3r kristoff3r commented Feb 16, 2026

Objective

Fixes #22963

Solution

Remove derived resources for SMAA in the render world when the Smaa component is removed, so the view query doesn't keep running.

As a follow-up, we should add something equivalent to this as an option to the ExtractComponent macro.

Testing

Check that the problem with cargo run --example anti_aliasing and moving between AA modes.

@kristoff3r kristoff3r added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 16, 2026
@github-project-automation github-project-automation bot moved this to Needs SME Triage in Rendering Feb 16, 2026
@kristoff3r
Copy link
Contributor Author

This is in draft until someone confirms that it actually solves the problem.

@alice-i-cecile alice-i-cecile added this to the 0.19 milestone Feb 16, 2026
@alice-i-cecile alice-i-cecile added S-Needs-Testing Testing must be done before this is safe to merge and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 16, 2026
@atlv24
Copy link
Contributor

atlv24 commented Feb 16, 2026

This fixes it for me.

@kristoff3r kristoff3r marked this pull request as ready for review February 16, 2026 23:00
@mockersf
Copy link
Member

mockersf commented Feb 17, 2026

This should work, but it feels like the introduction of a new pattern that needs more ECS discussion

It's a form of linked components that must be removed together

I would prefer to fix this directly in the anti_aliasing example for now, or at least start with the follow up discussion, and add a big todo to use the general version once its done

@kristoff3r
Copy link
Contributor Author

This should work, but it feels like the introduction of a new pattern that needs more ECS discussion

It's a form of linked components that must be removed together

I would prefer to fix this directly in the anti_aliasing example for now, or at least start with the follow up discussion, and add a big todo to use the general version once its done

Yeah, it requires slightly more expressiveness than the extract system is currently capable of, specifically it currently doesn't handle components that are derived in the render world but are not part of extraction.

There are several other possible workarounds:

  • Make the render pass query for &Smaa as well, so it doesn't run when the component has been removed (FXAA does this). That still leaves the old data hanging around though.
  • Remove the ExtractComponent derive, and handle the removal during manual extraction (several other rendering systems currently do this), but that's a lot more boilerplate.

I'd prefer to add a TODO here, and then do a follow up PR that extends SyncComponent/ExtractComponent with features to solve this, and then a second follow up PR that goes through a bunch of the rendering systems and cleans the ad-hoc syncing up.

Copy link
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also fixes the example for me.

The plan to follow up afterwards sounds reasonable, but if things get busy, I’d suggest to make an issue from your comment so it’s not lost / someone else can continue the vision

@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Testing Testing must be done before this is safe to merge labels Feb 19, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Feb 22, 2026
Merged via the queue into bevyengine:main with commit 586f261 Feb 22, 2026
40 checks passed
@github-project-automation github-project-automation bot moved this from Needs SME Triage to Done in Rendering Feb 22, 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 D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Flickering in anti_aliasing example with FXAA enabled.

5 participants