Optimize rendering performance by reduce Premultiplied AlphaMode#20757
Optimize rendering performance by reduce Premultiplied AlphaMode#20757lindexi wants to merge 14 commits intoAvaloniaUI:masterfrom
Conversation
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
…face do not set size.
|
You can test this PR using the following package version. |
Solve the `transaction` do not be disposed when CreateSurface exception.
|
You can test this PR using the following package version. |
This reverts commit da0af79.
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
What does the pull request do?
See #20643
Testing the RenderDemo in my device:
Test step:
GPU usage of DWM:
What is the current behavior?
Currently, regardless of whether a window requires transparency, the rendering backend on Windows is configured to use the Premultiplied AlphaMode. This forces the Desktop Window Manager (DWM) to handle alpha compositing even for opaque windows, resulting in unnecessary GPU resource overhead for the DWM. See #20643
What is the updated/expected behavior with this PR?
With the proposed modification, render backend will first determine if a window is opaque by
WindowTransparencyLevelas @maxkatz6 recommended (see #20643 (comment) ). If so, it will set the AlphaMode in the rendering backend to "Ignore". This adjustment enables the GPU to conserve substantial resources when processing opaque windows.Notably, this change will lead to a significant reduction in GPU resource usage on 4K-resolution devices without discrete graphics cards, especially when full-screen opaque windows are active.
How can I apply this optimization? Just settings the
window.TransparencyLevelHint = [WindowTransparencyLevel.None];How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #20643