Resolve one compositing space per camera stack - #25481
Open
stuartparmenter wants to merge 4 commits into
Open
Conversation
stuartparmenter
force-pushed
the
hdr-wave2-resolved-compositing-space
branch
from
August 20, 2026 04:31
2bd8146 to
0e03988
Compare
JMS55
suggested changes
Aug 20, 2026
JMS55
left a comment
Contributor
There was a problem hiding this comment.
Review of things minus composition.rs (haven't gotten to it yet).
Idea is sound to me, mostly some nits and some things I'm worried about changing.
JMS55
suggested changes
Aug 21, 2026
JMS55
left a comment
Contributor
There was a problem hiding this comment.
Reviewed composition.rs now. Overall idea is fine, but the comments could use a lot of work. They're making things more confusing, not less.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Part of the HDR upstreaming work. The display pipeline coming in later PRs needs cameras that share a render target to agree on one compositing space, since they composite into one shared buffer and later passes have to know how it's encoded. Two follow-up PRs build directly on this, the camera-stack composition contract and the shared writer-encode path.
Getting there also fixes real bugs that exist today. Stacked cameras can request different
CompositingSpaces, and each keys its own pipelines, so they write differently encoded pixels into one buffer and silently composite garbage.Oklabon a texture format that can't store its negative values breaks just as silently, as do requests on render paths that never encode.Solution
A new
bevy_render::view::compositionmodule resolves every view's request once per frame into aResolvedCompositingSpacecomponent. A stack resolves to the single distinct encoded request among its members, or to linear when there is none. Misconfigured shapes resolve to linear with a warning. Solo views and non-stack groups keep their own requests.Every consumer reads the resolved value instead of the raw request, including the sprite and mesh2d keys, the clear-color conversion, and the upscaling blit key.
ViewTarget::compositing_spaceis removed, with a migration guide entry. Two 2D specialization systems move later in the schedule so their caches see this frame's resolved value.Testing
Added lots of new tests, Check, clippy, and tests pass.
This PR was built by me with the assistance of Claude Code w/ Fable 5