Skip to content

fix(webgpu): Blend acrylic luminosity and tint layers instead of overlaying them - #26290

Closed
MartinZikmund wants to merge 2 commits into
masterfrom
dev/mazi/webgpu-acrylic-luminosity
Closed

MartinZikmund wants to merge 2 commits into
masterfrom
dev/mazi/webgpu-acrylic-luminosity

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: internal (found while preparing the Uno Platform 7.0 Drawing Backends marketing sample)

PR Type:

🐞 Bugfix

What changed? 🚀

On the WebGPU backend, AcrylicBrush lost its see-through look. The acrylic composite shader mixed the luminosity colour over the blurred backdrop as plain SrcOver (mix(backdrop, lum.rgb, lum.a)), and the tint was drawn as a separate SrcOver quad. With the dark theme's AcrylicInAppFillColorDefaultBrush (TintLuminosityOpacity = 0.96), that painted a nearly opaque flat grey slab over the blur.

The acrylic effect graph is actually Color(tint) ∘ Luminosity(lumColor) ∘ Blur(backdrop), and the Skia backend already renders it that way. This PR makes the WebGPU composite shader apply the real blend modes:

  • Luminosity blend with the luminosity colour, mixed by its alpha. This keeps the backdrop's hue/saturation and takes its luminance.
  • Color blend with the tint, mixed by its alpha. The tint now rides in the image uniform's unused m0 slot, so the separate SrcOver tint draw (DrawBackdropTint) is gone. That saves one draw per backdrop as a bonus.
Before (WebGPU) After (WebGPU)
Dark in-app acrylic over solid red #302727 (flat grey) red hue preserved, matches Skia

PR Checklist ✅

  • 🧪 Added runtime test Given_AcrylicBrush.When_AcrylicBrush_Over_Saturated_Background_Dark_Theme. It fails on WebGPU without the fix (#FF302727) and passes on both Skia and WebGPU with it. All 6 Given_AcrylicBrush tests pass locally on both backends (Windows desktop, RTX 4090 / Vulkan).
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features)
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

🤖 Generated with Claude Code

https://claude.ai/code/session_01TXMNu2yWM6tTnT3RcHvzek

MartinZikmund and others added 2 commits November 10, 2026 16:36
…laying them

The acrylic backdrop composite mixed the luminosity colour over the blurred
backdrop as plain SrcOver and drew the tint as a separate SrcOver quad. With
the dark in-app acrylic's 0.96 luminosity opacity that hid the backdrop behind
a flat grey slab. Apply the Luminosity and Color blends from the acrylic
effect graph in the composite shader, matching the Skia backend.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu2yWM6tTnT3RcHvzek
Copilot AI balanced review requested due to automatic review settings November 10, 2026 15:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is closed, so it cannot be queued. Reopen it to get the box back.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 23s —— View job


Review summary

Verdict: ship. One nit and no blocking issues.

  • Correctness (code review only): The shader math matches the W3C non-separable blend definitions. Luminosity is SetLum(backdrop, Lum(lumColor)) and Color is SetLum(tint, Lum(backdrop)), with weights 0.3/0.59/0.11 and the usual clip-colour step. This is the Color ∘ Luminosity ∘ Blur graph that Skia uses. Writing the tint to fields[8..11] lands in the m0 slot of struct U. The uniform is zero-initialised, and the other m0 uses (lines 279–287) are in different shader branches from the acrylic one.
  • Perf: Removing DrawBackdropTint drops one draw, one vertex buffer and one clip bind group per backdrop. That is a clear win.
  • Test: The new runtime test is a fail-before/pass-after regression test (#FF302727 before the fix). The R − max(G,B) > 0x40 assertion is loose enough to tolerate backend differences.
  • Not verified: I did not build or run the tests. Runtime validation is the PR author's report only (Windows desktop, Vulkan). Please check the Screenshots Compare run, since the checklist item is still unchecked.
Severity Count
Blocking 0
Nit 1 (stale doc comment, inline)

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 245235 found UI Test snapshots differences: skia-linux-screenshots: 222, skia-windows-screenshots: 273

Details
  • skia-linux-screenshots: 222 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • Basics.png-dark
    • Basics.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • AnimatedBackVisualSourceSamplePage.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedVisualsTestbedPage.png
    • AnimatedVisualsTestbedPage.png-dark
    • AppWindowTitleBar Properties.png
    • AppWindowTitleBar Properties.png-dark
    • AutomationPropertiesExtensions_Role.png-dark
    • AutomationPropertiesExtensions_Role.png
    • BenchmarkDotNet.png-dark
    • Border_CornerRadius_Binding.png-dark
    • BenchmarkDotNet.png
    • Border_CornerRadius_Binding.png
  • skia-windows-screenshots: 273 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png
    • Basics.png-dark
    • Basics.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AnimatedVisualsTestbedPage.png
    • AppWindowTitleBar Properties.png
    • BasicAcrylicBrushTest.png-dark
    • BasicAcrylicBrushTest.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • CompositionPath.png-dark

@MartinZikmund

Copy link
Copy Markdown
Member Author

Superseded by #26303, which applies the same Luminosity + Color blend fix but shares the non-separable blend helpers instead of duplicating them, and links #25357.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants