[GUI] Remove CPU scanline polygon rasterizer (RecordedCoarseGeometry) and 4x4 CPU supersampling (RecordedGeometryCoverage) from Skia GPU path
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 32/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- performance
Research direction
Start with sources/Cairo/wrapper/RecordedCoarseGeometry.cs and sources/Cairo/wrapper/RecordedGeometryCoverage.cs, then inspect the Skia GUI drawing path and pixel-diff tests. Compare the current CPU mask generation with drawing paths and dashed strokes through SKCanvas, and identify which tests need tolerance changes. Done means both CPU rasterizers are removed, GPU drawing uses Skia anti-aliasing and dash effects, and pixel-diff tests pass with appropriate tolerances.
Written by the indexing model from the issue text.
Description
Problem
To match libcairo-2 fixed-point scanline rounding pixel-for-pixel in synthetic diff tests, the Skia GUI pipeline rasterizes paths on the CPU using per-pixel GetPixel / SetPixel loops and uploads the resulting alpha masks as textures:
RecordedCoarseGeometry.Fast(sources/Cairo/wrapper/RecordedCoarseGeometry.cs:112-151):- Implements a software scanline polygon rasterizer in C# using
Int128fixed-point edge division (FixedX), per-scanlineList<Edge>allocations andactive.Sort(...)calls across 4 sub-rows per pixel row, followed bybitmap.SetPixel(x - left, y - top, ...)andSKImage.FromBitmap(bitmap).
- Implements a software scanline polygon rasterizer in C# using
RecordedCoarseGeometry.Aliased(sources/Cairo/wrapper/RecordedCoarseGeometry.cs:76-110):- Converts aliased paths into thousands of 1-pixel-tall
SKRectspans on the CPU by sorting active edges aty + 127.0 / 256on every row.
- Converts aliased paths into thousands of 1-pixel-tall
RecordedGeometryCoverage.Capture(sources/Cairo/wrapper/RecordedGeometryCoverage.cs:22-50):- Allocates 4x-scaled
SKBitmaptiles on the CPU, averages alpha coverage in a quadruple nested loop callingtile.GetPixel(x * scale + sx, y * scale + sy)andmask.SetPixel(...), and uploads the CPU mask viaSKImage.FromBitmap(mask).
- Allocates 4x-scaled
Running software scanline rasterization and GetPixel/SetPixel supersampling on the CPU inside the GPU rendering path defeats hardware acceleration and adds substantial CPU and GC overhead.
Proposed Fix
- Delete
RecordedCoarseGeometryandRecordedGeometryCoverage. - Draw paths and dashed strokes directly on the GPU
SKCanvasusing standardSKPaintanti-aliasing (IsAntialias = antialias != Antialias.None) and nativeSKPathEffect.CreateDash. - Relax pixel-diff test tolerances where needed to allow standard Skia GPU anti-aliasing rather than emulating Cairo 24.8 fixed-point scanline quantization on the CPU.
- Dominant language
- C#
- Stars
- 22
- Forks
- 4
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 40
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from StratumServer/Optimum
-
complexity: hard enhancement performance rendering
Difficulty 5/5 Over a week Newbie friendliness 25/100
StratumServer/Optimum#230 ·
Maintainers usually reply within 1 day
-
complexity: easy performance rendering
Difficulty 4/5 3-5 days Newbie friendliness 52/100
StratumServer/Optimum#228 ·
Maintainers usually reply within 1 day
-
complexity: medium enhancement rendering
Difficulty 5/5 Over a week Newbie friendliness 24/100
StratumServer/Optimum#226 ·
Maintainers usually reply within 1 day
-
complexity: hard performance rendering
Difficulty 5/5 Over a week Newbie friendliness 35/100
StratumServer/Optimum#225 ·
Maintainers usually reply within 1 day
-
[GUI] Avoid per-command clip array cloning and redundant SKPath allocations in SurfaceRecorderPossibly taken @Zaldaryon claimed this today. Opencomplexity: medium performance rendering
Difficulty 4/5 3-5 days Newbie friendliness 35/100
StratumServer/Optimum#224 ·
Maintainers usually reply within 1 day
All issues in StratumServer/Optimum
Similar issues
-
needs-triage
Difficulty 1/5 1-3 hours Newbie friendliness 76/100
Azure/azure-sdk-for-net#64658 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/aspnetcore#70370 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NethermindEth/nethermind#15684 ·
Maintainers usually reply within 1 day
-
area/ai-assistant squad/flyt
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Altinn/altinn-studio#21798 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
SubtitleEdit/subtitleedit#16699 ·
Maintainers usually reply within 1 day