Default shader compilation takes unreasonably long on iOS

115 views
Skip to first unread message

BerstanioDev

unread,
Dec 28, 2024, 12:47:13 PM12/28/24
to angleproject
Hello,
I'm maintaining an ANGLE build with a GLKit replacement for iOS: https://github.com/Berstanio/MetalANGLEKit

I noticed that on iOS, especially on weaker devices, the compiling of the default shaders takes a very long time (`DisplayMtl::initializeShaderLibrary` to be specific).
On an iPad Mini 5th generation I measured a 7sec startup delay because of the shader compilation.
While the delay often only occurs first startup, it's still too long for a small mobile app to startup.
Looking at the source it seems theoretically possible to precompile the shaders, but it is noted that `Building internal shaders for iOS is not supported.`

Is there a way to somehow still prebuild the shaders for iOS? Or any other way to cut down on startup time? 

Geoff Lang

unread,
Jan 7, 2025, 1:28:32 PMJan 7
to bersta...@gmail.com, angleproject
We disable prebuilt Metal shaders on iOS because Chrome's hermetic MacOS SDK doesn't include the compiler for iOS. It could probably be made to work on iOS if you're building with a local full SDK.

Prebuilt shaders are disabled on iOS in metal_backend.gni. The actual compilation happens with the build steps here which appears to handle iOS already. You could try enabling metal_internal_shader_compilation_supported locally and with some print statements in the compile actions to verify it finds the compilers.

--
You received this message because you are subscribed to the Google Groups "angleproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angleproject...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/angleproject/e5575f09-a488-476e-ab58-6cecc4911a4en%40googlegroups.com.

BerstanioDev

unread,
Feb 20, 2025, 5:01:01 AMFeb 20
to angleproject
Thank you for the help! As I'm building with a full SDK, I managed to prebuild the shaders for iOS and got the fast startup time back.
I was wondering, whether this is something that could be configured automatically? Whether the SDK contains an iOS compiler or not.
Because when using ANGLE for an iOS App, the delay is just too long and users might just close the app.

Reply all
Reply to author
Forward
0 new messages