Open Bug 1954587 Opened 1 month ago Updated 6 days ago

GL shader caching is not very effective with some drivers

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

People

(Reporter: mstange, Unassigned)

References

(Blocks 1 open bug)

Details

In startup profiles from the Samsung A55 (which has an Xclipse 530 GPU), we are seeing a lot of time spent in glProgramBinary: https://share.firefox.dev/4iBTOdr

We call glProgramBinary expecting it to be fast - it's called in the path where we have cached shaders and we want to avoid the overhead of compiling shaders from scratch.

But it's not fast. It takes 440ms to process all the startup shaders.

The GL driver seems to be using Angle and Vulkan. For cached GL shaders, it looks like the only thing it's caching is the SPIRV of the shader. (ANGLE code)

The severity field is not set for this bug.
:gw, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(gwatson)
Severity: -- → S3
Flags: needinfo?(gwatson)
Depends on: 1959846

It seems like ANGLE supports saving vulkan pipelines into the program binary:
https://github.com/google/angle/blob/4b9525b2667f3e2c2655cef164693c2161c7063b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp#L852

Maybe this isn't working properly for some reason.

I asked a Pixel 6 running Android 14 to use the ANGLE driver by executing the following:

adb shell settings put global angle_gl_driver_selection_pkgs org.mozilla.fenix
adb shell settings put global angle_gl_driver_selection_values angle

This gives the following profile: https://share.firefox.dev/43UFzw9

But it shows very different characteristics: glProgramBinary is fast, but then there's compilation during the first draw.

Here's one single sample in glProgramBinary: https://share.firefox.dev/4ji4pee
And here's compilation under glDrawElementsInstanced: https://share.firefox.dev/4iknVVS

So I wonder if the ANGLE driver on the A55 makes different decisions about when to do the compilation.

ANGLE's warmUpPipelineCacheAtLink flag sounds related: https://source.chromium.org/chromium/chromium/src/+/main:third_party/angle/src/libANGLE/renderer/vulkan/vk_renderer.cpp;l=5826-5854;drc=2ea511fc39b2923a38a4d01ab063f4a6530047d6

You need to log in before you can comment on or make changes to this bug.