On macOS, kick off shader compilation of a certain set of shaders before the first draw
Categories
(Core :: Graphics: WebRender, enhancement, P3)
Tracking
()
People
(Reporter: mstange, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
(Whiteboard: wr-planning)
Attachments
(3 files, 1 external file)
Profile: https://perfht.ml/2WvDuUB
The first paint of a freshly-launched Firefox process takes an extra long time with WebRender on macOS because macOS doesn't let us cache OpenGL shaders.
Bug 1604615 aims at making shader compilation faster.
Another thing we can do is to trigger shader compilation ahead-of-time. During startup, there is a window of time before the first paint during which the Renderer thread is already alive but the main thread is still busy with other stuff. We can use that window to front-load some shader compilation, of a set of shaders that we expect to be used during the first paint.
Updated•6 years ago
|
Comment 1•6 years ago
|
||
It looks like we can accomplish this by starting shader compilation in webrender::shade::Shaders::new()
Profile prior to bug patch: https://share.firefox.dev/2M5Vj6a
Profile following bug patch: https://share.firefox.dev/3enDHid
It seems the large chunk where the parent process gets blocked was reduced from about 235ms to 195ms (~20%) as a result of the precompilation.
| Reporter | ||
Comment 5•6 years ago
|
||
Looks great! Eliminating the remaining time would probably require bug 1624042, as a follow-up.
Comment 6•6 years ago
|
||
It would be interesting to time the individual shaders to see if the bulk of the time is being spent in some or if it's spread evenly.
(In reply to Jeff Muizelaar [:jrmuizel] from comment #6)
It would be interesting to time the individual shaders to see if the bulk of the time is being spent in some or if it's spread evenly.
I'll look into it soon!
Updated•6 years ago
|
Updated•6 years ago
|
Comment 8•6 years ago
|
||
It looks like this causes a major startup regression:
https://treeherder.mozilla.org/perf.html#/compare?originalProject=mozilla-central&newProject=try&newRevision=3fb282e4005a86db8532d78265418b0bf7ec448b&framework=1&selectedTimeRange=172800
Next steps might be to try to reduce the shaders that are precompiled. Because the list was chosen based on macOS perhaps we're compiling shaders that we wouldn't otherwise be.
Comment 10•4 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:bhood, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•4 years ago
|
Updated•4 years ago
|
Updated•2 years ago
|
| Reporter | ||
Comment 11•2 years ago
|
||
This is still relevant. Shader compilation still causes an appreciable amount of delay during startup. Updated profile on a faster machine: https://share.firefox.dev/3TF63Lc
Description
•