Skip to content

AtlasEngine: Redraw immediately on opacity changes - #12226

Merged
1 commit merged into
mainfrom
dev/lhecker/atlas-engine-opacity-refresh
Jan 25, 2022
Merged

1 commit merged into
mainfrom
dev/lhecker/atlas-engine-opacity-refresh

Conversation

@lhecker

Copy link
Copy Markdown
Member

Since AtlasEngine prefers drawing without alpha for performance reasons,
calls to EnableTransparentBackground require a draw cycle.
This PR makes Renderer::_NotifyPaintFrame public and calls it.

Related to #9999.

PR Checklist

  • I work here
  • Tests added/passed

Validation Steps Performed

  • Open Windows Terminal command palette
  • Choose "Set background opacity..."
  • Cycling through the items without selecting one
    changes background opacity immediately ✅

@lhecker Leonard Hecker (lhecker) added Area-AtlasEngine Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) labels Jan 24, 2022
@lhecker Leonard Hecker (lhecker) changed the title Redraw AtlasEngine immediately on opacity changes AtlasEngine: Redraw immediately on opacity changes Jan 24, 2022

@zadjii-msft Mike Griese (zadjii-msft) left a comment

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.

Would it maybe be more idomatic to call TriggerSystemRedraw or TriggerRedrawAll rather than making NotifyPaintFrame a public part of the Renderer? Theoretically, you could imagine a renderer that actually does need to redraw everything when the opacity changes...

@lhecker

Leonard Hecker (lhecker) commented Jan 24, 2022 •

Copy link
Copy Markdown
Member Author

Mike Griese (@zadjii-msft) If you think TriggerSystemRedraw would be a better fit I'll use that of course.

However from the perspective of AtlasEngine it wouldn't be more idiomatic. Both TriggerSystemRedraw and TriggerRedrawAll actually mean "refresh the text from the buffer for this area", which isn't necessary here since neither the text nor the text attributes have changed. The underlying problem is that the swap chain is only created lazily during the next render pass. Since a IRenderEngine cannot indicate to the Renderer that it needs to redraw, we need to tell the Renderer ourselves that it needs to do a render pass. This is true for both DxEngine (which calls InvalidateAll inside EnableTransparentBackground itself already which makes TriggerRedrawAll at least not strictly necessary) as well as AtlasEngine (which doesn't need to invalidate anything).

@miniksa

Copy link
Copy Markdown
Contributor

When I originally wrote this, I had intended all paint calls to be indirectly triggered by some sort of "Invalidate*" call, not calling the paint frame directly.

However, since I wrote it, the threading and mechanisms of how this works have changed dramatically to make room for the various render types and scenarios we now need to cover. As well, Leonard has thoroughly proven to me how past-me has architected in a performance-poor solution here with all the indirect handwaving going on here.

So I'm inclined to go with what Leonard says here and just directly call the Notify in question for this scenario as there's no point in handwaving our way to a repaint through another indirection of sorts.

@zadjii-msft Mike Griese (zadjii-msft) left a comment

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.

Okeydokey if Niksa is cool with it I'm cool with it too. Just wanted to be sure ☺️

@zadjii-msft Mike Griese (zadjii-msft) added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jan 25, 2022
@ghost

Copy link
Copy Markdown

Hello Mike Griese (@zadjii-msft)!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost
ghost merged commit f210784 into main Jan 25, 2022
@ghost
ghost deleted the dev/lhecker/atlas-engine-opacity-refresh branch January 25, 2022 18:35
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-AtlasEngine AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Second It's a PR that needs another sign-off Priority-2 A description (P2)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants