Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine render passes where feasible #7040

Merged
merged 1 commit into from
Oct 15, 2024
Merged

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Oct 15, 2024

Optimization: when two (or more) following render passes render to the same render target + few other conditions are met, render them in a single pass. This is an optimization for tiled architecture (mostly mobile), to avoid the first pass having to write out the render target to main memory and then load it back in the following pass, keeping it all in the fast tile memory.

Typically a UI rendering is merged into RenderPassCompose (post-processing). We save the color buffer + depth buffer store and then load, which is costly especially when MSAA is used.
Screenshot 2024-10-15 at 16 06 49

@mvaligursky mvaligursky self-assigned this Oct 15, 2024
@mvaligursky mvaligursky added performance Relating to load times or frame rate area: graphics Graphics related issue labels Oct 15, 2024
@mvaligursky mvaligursky requested a review from a team October 15, 2024 15:13

// if the render targets are different, we can't merge the passes
// also only merge passes that have a render target
if (firstRT !== secondRT || firstRT === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

!firstRT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, a NULL is valid case, just not undefined. null means rendering to backbuffer.

@mvaligursky mvaligursky merged commit 4061758 into main Oct 15, 2024
8 checks passed
@mvaligursky mvaligursky deleted the mv-merge-render-passes branch October 15, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue performance Relating to load times or frame rate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants