COLRv1 group rendering, zero-callback layered glyph cache, WebGPU blend parity and CPU-exact brush colors - #412
Merged
Conversation
Port the remaining CPU blend and Porter-Duff composition behavior to the WebGPU fine shader, including precise target-format round-tripping, half-float quantization, lossless clip backdrop storage, and support for additional blend/composition modes such as ColorDodge, ColorBurn, SoftLight, Hue, Saturation, Color, Luminosity, and Plus. The scene encoder now defers and specializes solid colors and gradient ramps for the bound target pixel type so GPU brush inputs match CPU snapping. Text rendering also gains proper isolated COLR group lowering, glyph clip propagation, and layered glyph cache replay fixes. Tests and reference outputs were expanded to cover the new blending parity and COLR behavior.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #412 +/- ##
======================================
Coverage 79% 79%
======================================
Files 232 232
Lines 27005 27340 +335
Branches 3086 3112 +26
======================================
+ Hits 21541 21858 +317
- Misses 4574 4589 +15
- Partials 890 893 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Prerequisites
Description
Consumes the reworked Fonts renderer API and completes two WebGPU parity efforts.
COLRv1 groups
BaseGlyphBuilderandRichTextGlyphRendererimplementBeginGroup/EndGroup; the canvaslowers each group to one isolated layer whose modes apply when it ends. Caller opacity
applies once to the outermost group, never per leaf. The per-glyph clip bounds become a
single rectangle intersect on each operation's rasterizer interest; no polygon clipping is
involved anywhere.
Layered glyph cache
A layered COLR cache hit now replays its stored operation sequence with zero renderer
callbacks: no outline decode and no path construction per draw. Replay tests assert
operation-for-operation equality and pixel-identical output.
WebGPU blend parity
blend.wgslports ImageSharp'sAssociatedAlphaPorterDuffFunctionsand the straight-RGBblend curves for every
PixelColorBlendingMode. Stores quantize in-shader(round-to-nearest-even binary16, exact unorm packing) so both backends store identical
pixels.
CPU-exact brush colors
Solid colors and gradient ramp texels snap through
ToPixel<TPixel>at flush, mirroring theCPU's render-time brush creation: the retained scene streams specialize once per pixel
format and ride the ordinary uploads. Opaque fills are bit-exact against the CPU;
translucent fills sit within the wire format's binary16 rounding, documented at the patch
sites. Also fixes stale recolor payloads surviving a pixel-format switch.