Closed Bug 1837068 Opened 1 year ago Closed 1 year ago

Support alpha on stroked paths


(Core :: Graphics: Canvas2D, enhancement)




116 Branch
Tracking Status
firefox116 --- fixed


(Reporter: lsalzman, Assigned: lsalzman)


(Blocks 3 open bugs, Regressed 2 open bugs)


(Whiteboard: [sp3])


(2 files)

The AAStroke library can't probably deal overlap in the generated triangle meshes. This means every time a Canvas2D user tries to stroke a path, and they request alpha < 1, we fall back to software.

Since AAStroke can't deal with non-opaque stroked path, we first generate a normal opaque, anti-aliased
stroked path with AAStroke and render it to a cache texture bound to a render target. We can then later
just use that texture with alpha to support the initial alpha stroke request.

One caveat is that trying to both render to a texture bound to a framebuffer and also upload directly to
it with texSubImage2D can expose bugs in some OpenGL drivers that have different underlying representations
for data textures and for render target textures. To avoid this problem, we segregate the texture cache
pages based on whether they are used as render targets or for direct data uploads.

This ultimately all avoids the fallback of having to draw the alpha stroke in software with Skia and
then upload it to a texture. For stroked paths with large hollow areas, uploading a Skia surface whose
bounds contain the full stroke can cause a lot of uploading of unnecessary pixel data. This allows us
to only upload the triangle mesh for AAStroke and otherwise keep generation solely on the GPU.

Blocks: 1823198
Pushed by
Support alpha strokes by rendering with AAStroke to a mask render target. r=aosmond
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
Blocks: 1803604

Since we use unsynchronized BufferSubData, the wrong data can be used for some draw calls.
Ensure the path vertex offset is always advanced to avoid any races.

Regressions: 1837728
Pushed by
Always advance path vertex offset. r=aosmond
Blocks: 1819996
Whiteboard: [sp3]
Regressions: 1838576
Regressions: 1850727
Regressions: 1869288
You need to log in before you can comment on or make changes to this bug.