Skip to content

Make ClearColorConfig::None work correctly (esp in the presence of MSAA)#23844

Open
tychedelia wants to merge 4 commits intobevyengine:mainfrom
tychedelia:view-target-fixes
Open

Make ClearColorConfig::None work correctly (esp in the presence of MSAA)#23844
tychedelia wants to merge 4 commits intobevyengine:mainfrom
tychedelia:view-target-fixes

Conversation

@tychedelia
Copy link
Copy Markdown
Member

Two separate issues:

  1. Because we were re-creating the atomics used for tracking which main texture is "active", post-process writes could be lost across frames because the atomic was being reset. This is a bug even without MSAA.
  2. We need to force writeback when the user opts into Load semantics on their camera and MSAA is enabled, otherwise we'll throw away the main target texture incorrectly.

@tychedelia tychedelia 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 Apr 17, 2026
@github-project-automation github-project-automation bot moved this to Needs SME Triage in Rendering Apr 17, 2026
@tychedelia tychedelia added this to the 0.19 milestone Apr 17, 2026
@tychedelia
Copy link
Copy Markdown
Member Author

@beicause Some more here about MSAA writeback, I know you've had opinions here before.

Comment on lines +1245 to +1254
// re-use the same atomics frame to frame for views with the same main texture
// to ensure post process writes persist through msaa writeback
let main_texture = main_texture_atomics
.get(&key)
.and_then(Weak::upgrade)
.unwrap_or_else(|| {
let arc = Arc::new(AtomicUsize::new(0));
main_texture_atomics.insert(key.clone(), Arc::downgrade(&arc));
arc
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can use HashMap.entry

Is it correct to use Weak<AtomicUsize>, won’t it be dropped at the start of each frame?

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.

2 participants