Combine accelerated Canvas2D solid-color and image/mask draws in the image shader program
Categories
(Core :: Graphics: Canvas2D, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: perf-ai-bot, Assigned: lsalzman)
References
(Blocks 1 open bug)
Details
(Whiteboard: [foofrix:279efb95-81e8-4e86-a73c-0d4afcbd5923])
Attachments
(1 external file, 1 obsolete file)
Combine accelerated Canvas2D solid-color and image/mask draws in the image shader program. A negative swizzle selects solid mode, bypassing the image-sampling branch and preserving the previous solid fragment calculation algebraically; image and A8-mask modes retain their existing swizzle calculation. UseImageProgram caches program selection and sampler/swizzle uniforms, directing the unused image sampler to the clip-mask texture unit during solid draws to avoid feedback validation against a render target bound on unit 0. DrawRectAccel and DrawStrokeMask share the image uniform cache, and the separate solid program is removed. Solid draws still execute the image vertex shader's texture-coordinate calculations. Supplied NVIDIA/Linux comparisons report approximately 0.33% and 1.165% end-to-end gains, with score granularity comparable to the smaller effect. These measurements and the reported pixel/test results were not independently reproduced in this audit; they do not establish cross-driver performance or bit-identical rendering.
Problem
Alternating eligible solid-color and image/mask draws previously switched between separate WebGL programs. Supplied NVIDIA/Linux profiles attribute substantial driver time to those switches. Sharing the program removes these transitions while retaining separate blur and filter programs. The tradeoff includes sampler/swizzle updates, potentially more updates to other shared uniforms, and additional shader and sampler-validation work for solids. The net benefit depends on workload and driver.
Performance
- Benchmark: speedometer4-scrollytelling-scrollama
- Test: sp4-scrollytelling-scrollama
- Component: Graphics
- Local Improvement: 0.33%
Validation
| Reporter | ||
Updated•1 month ago
|
| Reporter | ||
Comment 1•1 month ago
|
||
Please move this bug to the correct component.
Once the Phabricator patch is ready for review, please commandeer it.
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
| Reporter | ||
Comment 2•1 month ago
|
||
Combine accelerated Canvas2D solid-color and image/mask draws in the image shader program. A negative swizzle selects solid mode, bypassing the image-sampling branch and preserving the previous solid fragment calculation algebraically; image and A8-mask m
Updated•1 month ago
|
| Assignee | ||
Comment 3•1 month ago
|
||
Foofrix suggests that the costs of switching shaders between a solid color program and an
image program in mixed workloads leads to a much higher cost switching changes than the
small instruction saving of the solid color program versus the image program can compensate
for.
Overall, we are better off combining them into one program with a uniform branch to toggle
sampling from the image texture. This also results in a substantial reduction in the amount
of shader program code.
Updated•1 month ago
|
Updated•16 days ago
|
Description
•